Skip to content

Build Instructions for Windows

Oleg Shparber edited this page Sep 16, 2023 · 11 revisions

Build Dependencies

Compiler

Any C++17 compatible compiler should work. Microsoft Visual C++ is recommended.

Build Tools

Install with Scoop:

scoop install cmake ninja

Install with Windows Package Manager:

winget install -e --id Kitware.CMake
winget install -e --id Ninja-build.Ninja

Vcpkg

Vcpkg makes it easy to manage, build and deploy dependencies on Windows.

To install vcpkg follow the official guide.

Here is how vcpkg can be installed in c:\dev\vcpkg directory:

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 with vcpkg is possible, but requires significant time investment and processing power.

Installing official Qt SDK is recommended. Qt 6.5.2 or later is required to build installer package.

Alternatively, aqtinstall is a handy tool to download official Qt binaries without installer:

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):

$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 for building. In this scenario, Zeal can be built with one command:

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:

cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE="$Env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"
cmake --build build

Packaging

To produce MSI package (not applicable to portable build), install WiX toolset. Make sure installed binaries are available in %PATH%.

WiX toolset can be installed with Scoop:

scoop install wixtoolset

Note: CMake (CPack) currently only supports version 3 of the WiX toolset.

Now both ZIP and MSI packages can be built:

cmake --build build --preset ninja-multi-vcpkg-release --target package