2024-07-11 18:45:55 +00:00
The `release-*` and `PR-check-*` workflow files under `.github` in the source code has actual build & commands for reference.
2023-07-06 02:20:43 +00:00
## Dependencies
2024-07-11 07:05:10 +00:00
* C++17 compiler (For windows it must be MSVC)
2023-07-06 02:20:43 +00:00
* Latest QT6
For debian/ubuntu, those packages are needed
```shell
libavformat-dev libavutil-dev libbz2-dev libeb16-dev libhunspell-dev \
liblzma-dev liblzo2-dev libopencc-dev libvorbis-dev \
libx11-dev libxtst-dev libzim-dev libzstd-dev qt6-5compat-dev \
qt6-base-dev qt6-multimedia-dev qt6-speech-dev qt6-svg-dev \
qt6-tools-dev qt6-tools-dev-tools qt6-webchannel-dev \
qt6-webengine-dev x11proto-record-dev zlib1g-dev
```
In other words, those libraries
* ffmpeg
* libzim
* xapian
* hunspell
* opencc
* libeb
* libvorbis
* x11 (linux only)
And a few compression libraries:
2023-07-08 20:29:54 +00:00
2023-07-06 02:20:43 +00:00
* xz (lzma)
* bzip2
* lzo2
* zlib
2024-07-11 07:05:10 +00:00
## Build
2023-07-06 02:20:43 +00:00
2024-05-03 20:14:27 +00:00
Basically, you need those commands:
2023-07-06 02:20:43 +00:00
```shell
cd goldendict-ng & & mkdir build_dir
# config step
2024-09-12 00:03:53 +00:00
cmake -S . -B build_dir
-G "Ninja"/"Unix Makefiles"/"Xcode"... (Optional)
-install-prefix=/usr/local/ (Optional)
-DCMAKE_BUILD_TYPE=Release (Optional)
2023-07-06 02:20:43 +00:00
# actual build
2024-07-11 07:05:10 +00:00
cmake --build build_dir
2024-09-12 00:03:53 +00:00
--parallel 7 (Optional if Ninja was chosen)
2023-07-06 02:20:43 +00:00
cmake --install ./build_dir/
```
### Feature flags
2024-07-11 07:05:10 +00:00
Append `-D{flag_names}=ON/OFF` to cmake's config step.
2023-07-06 02:20:43 +00:00
2023-08-06 11:16:53 +00:00
Available flags can be found on the top of `CMakeLists.txt`
2023-07-06 02:20:43 +00:00
### Windows
2024-07-11 07:05:10 +00:00
Install Qt6 (MSVC) through [Qt Online Installer ](https://doc.qt.io/qt-6/get-and-install-qt.html ) and add Qt's path to CMake
2023-07-06 02:20:43 +00:00
```
-DCMAKE_PREFIX_PATH=F:\Qt\6.4.1\msvc2019_64
```
2023-08-06 11:16:53 +00:00
2024-07-11 07:05:10 +00:00
#### Make the `.exe` runable
2023-08-06 11:16:53 +00:00
2024-07-11 07:05:10 +00:00
Call `cmake --install {the cmake output folder}` will copy all necessary dependencies to correct locations.
2023-08-06 11:16:53 +00:00
2024-07-11 07:05:10 +00:00
TODO: (untested) you can also `${Qt's install path}\Qt\6.5.2\msvc2019_64\bin` and vcpkg's bin paths to your PATH environment variable
2023-08-06 11:16:53 +00:00
2024-07-11 07:05:10 +00:00
Note that using `-G Ninja` in CMake is assumed to be used. TODO: MSBuild has minor bugs for being "Multi-Config".
2024-05-13 19:27:36 +00:00
2024-07-11 07:05:10 +00:00
#### Vcpkg
2024-05-13 19:27:36 +00:00
2024-07-11 07:05:10 +00:00
vcpkg is the primary method to build GoldenDict-ng's dependencies.
2024-05-13 19:27:36 +00:00
2024-07-11 07:05:10 +00:00
There are a few ways to use it.
2024-05-13 19:27:36 +00:00
2024-07-11 07:05:10 +00:00
First, just do nothing. Without any additional CMake config options, a pre-built cached version of vcpkg will be automatically obtained and setup.
2023-08-06 11:16:53 +00:00
2024-07-11 07:05:10 +00:00
Second, install vcpkg on your local machine, then set `CMAKE_TOOLCHAIN_FILE` as described [here ](https://learn.microsoft.com/vcpkg/consume/manifest-mode?tabs=cmake%2Cbuild-MSBuild#2---integrate-vcpkg-with-your-build-system ), which says append `-DCMAKE_TOOLCHAIN_FILE={Your vcpkg install location}/scripts/buildsystems/vcpkg.cmake` to CMake's config step. Note that this cost long time to build
2023-07-06 02:20:43 +00:00
2024-07-07 04:23:32 +00:00
2023-07-06 02:20:43 +00:00
### macOS
2024-05-05 07:45:19 +00:00
If you build in an IDE, then the created `GoldenDict.app` will be runnable from the IDE which set up necessary magics for you.
2023-07-06 02:20:43 +00:00
2024-05-03 20:14:27 +00:00
To make the `.app` runnable elsewhere, you can run `cmake --install build_dir/` which will invoke macdeployqt, ad-hoc code signing and various other things. The produced app will end up in `build_dir/redist/goldendict-ng.app`
2023-07-06 02:20:43 +00:00
2024-05-03 20:14:27 +00:00
To create `.dmg` installer, you have to have [create-dmg ](https://github.com/create-dmg/create-dmg ) installed on your machine, then also `cmake --install build_dir/` .