Update Windows build instructions

Oleg Shparber 2023-09-16 13:29:30 -04:00
parent 3174c33f41
commit e4e83efcc4

@ -1,47 +1,96 @@
## Build Zeal with vcpkg ## Build Dependencies
### Compiler
Any C++17 compatible compiler should work. Microsoft Visual C++ is recommended.
### Build Tools
* [CMake](https://cmake.org/)
* [Ninja](https://ninja-build.org/) (optional)
Install with [Scoop](https://scoop.sh/):
Use vcpkg install dependencies, then build
```powershell ```powershell
git clone https://github.com/microsoft/vcpkg.git --depth=1 scoop install cmake ninja
.\vcpkg\bootstrap-vcpkg.bat
.\vcpkg\vcpkg install --triplet=x64-windows
cmake -B ./build -S . "-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake"
cmake --build ./build
``` ```
## Installing dependencies Install with [Windows Package Manager](https://learn.microsoft.com/en-us/windows/package-manager/):
Qt 5.5 mingw version: [https://download.qt.io/new_archive/qt/5.5/5.5.1/qt-opensource-windows-x86-mingw492-5.5.1.exe](https://github.com/EclipseFond/eclipse-collections/releases/download/v2.0.15/AppLauncher-inst-win64.zip)
libarchive: [https://bintray.com/zealdocs/windows-ci/download_file?file_path=libarchive-3.2.1-win32-mingw492.7z](https://github.com/EclipseFond/eclipse-collections/releases/download/v2.0.15/AppLauncher-inst-win64.zip)
sqlite3: [http://sqlite.org/2016/sqlite-amalgamation-3140200.zip](https://github.com/EclipseFond/eclipse-collections/releases/download/v2.0.15/AppLauncher-inst-win64.zip)
## Building Zeal (Use the path setting above)
```powershell ```powershell
# Set Qt Install dir winget install -e --id Kitware.CMake
Set-Variable -Name "qt_dir" -Value "C:\Qt\Qt5.5.1" winget install -e --id Ninja-build.Ninja
```
$env:Path = "${qt_dir}\5.5\mingw492_32\bin;${qt_dir}\Tools\mingw492_32\bin;C:\Program Files\7-Zip;$env:Path" ### Vcpkg
# Put libarchive to mingw path [Vcpkg](https://vcpkg.io/en/) makes it easy to manage, build and deploy dependencies on Windows.
7z x libarchive-3.2.1-win32-mingw492.7z -o${qt_dir}\Tools\mingw492_32\i686-w64-mingw32
# Building sqlite and Put it to mingw path To install vcpkg follow the [official guide](https://vcpkg.io/en/getting-started.html).
7z x sqlite-amalgamation-3140200.zip
cd sqlite-amalgamation-3140200
gcc -c sqlite3.c
ar rcs libsqlite3.a sqlite3.o
cp *.h ${qt_dir}\Tools\mingw492_32\i686-w64-mingw32\include
cp *.a ${qt_dir}\Tools\mingw492_32\i686-w64-mingw32\lib
# Get and building zeal Here is how vcpkg can be installed in `c:\dev\vcpkg` directory:
git clone -q --branch=master https://github.com/zealdocs/zeal.git C:\projects\zeal
qmake -r -spec win32-g++ ```powershell
mingw32-make New-Item -ItemType Directory -Path c:\dev\vcpkg -Force
cd c:\dev\vcpkg
git clone https://github.com/microsoft/vcpkg.git
.\vcpkg\bootstrap-vcpkg.bat
```
### Qt
Building [Qt](https://www.qt.io/) with vcpkg is possible, but requires significant time investment and processing power.
Installing official [Qt SDK](https://www.qt.io/download-qt-installer-oss) is recommended. Qt 6.5.2 or later is required to build installer package.
Alternatively, [aqtinstall](https://github.com/miurahr/aqtinstall) is a handy tool to download official Qt binaries without installer:
```powershell
aqt install-qt -O c:/dev/qt windows desktop 6.5.2 win64_msvc2019_64 --modules qtwebchannel qtwebengine qtpositioning qtimageformats
```
## Build Zeal
Set the following environment variables (update paths accordingly):
```powershell
$Env:VCPKG_ROOT="c:/dev/vcpkg"
$Env:VCPKG_DEFAULT_TRIPLET="x64-windows-release"
$Env:QT_DIR="c:/dev/qt/6.5.2/msvc2019_64"
$Env:Qt6_DIR="c:/dev/qt/6.5.2/msvc2019_64"
```
All the commands listed below need to be executed in the directory where source code of Zeal is located, e.g. `c:\dev\zeal`.
While not required, it is recommended to use [CMake presets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html) for building. In this scenario, Zeal can be built with one command:
```powershell
cmake --build build --preset ninja-multi-vcpkg-release
```
Replace preset with `ninja-multi-vcpkg-portable` if interested in portable build.
If not using presets, use the following commands:
```powershell
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE="$Env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"
cmake --build build
``` ```
## Packaging ## Packaging
to be added
You can use Qt Creator run and debug the program now. To produce MSI package (not applicable to portable build), install [WiX toolset](https://wixtoolset.org/). Make sure installed binaries are available in `%PATH%`.
WiX toolset can be installed with Scoop:
```powershell
scoop install wixtoolset
```
*Note:* CMake (CPack) currently [only supports](https://gitlab.kitware.com/cmake/cmake/-/issues/23910) version 3 of the WiX toolset.
Now both ZIP and MSI packages can be built:
```powershell
cmake --build build --preset ninja-multi-vcpkg-release --target package
```