12 Windows
Benjamin Goisser edited this page 2026-07-01 00:25:58 +02:00

Windows

MSVC

Building

Download and install:

  • Qt for Windows. By default, only the mingw toolchain will be selected in the installer, so be sure to select msvc as well.
  • cmake from the official website, NOT from the Visual Studio Installer.
  • ninja, either from the website or the Visual Studio Installer.

To build, open the x64 Native Tools Command Prompt for VS 2022, navigate to the project directory and run:

mkdir build
cd build
cmake .. -GNinja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH="C:\Qt\6.11.1\msvc2022_64" -DCMAKE_C_FLAGS="-D_AMD64_=1" -DCMAKE_CXX_FLAGS="-D_AMD64_=1"

Replace CMAKE_BUILD_TYPE with desired build type:

  • Debug
  • RelWithDebugInfo
  • Release

Replace CMAKE_PREFIX_PATH with the Qt toolchain directory, usually C:\Qt\6.11.1\msvc2022_64.

Then run ninja.

Deploying

Copy the generated executable to the deployment directory and run:

mkdir deploy
"C:\Qt\6.11.1\msvc2022_64\bin\windeployqt6.exe" --no-translations --dir deploy libgruppensprechen\test\test-app.exe
copy libgruppensprechen/test/test-app.exe deploy

Then the executable in the deployment directory should run even outside the development environment.

Boost

Because Boost takes a long time to download (and especially untar on Windows) when the build system is reset, it can be preinstalled and is then automatically found by CMake. For this to work when building with the MSVC toolchain, one has to set the following environment variables (assuming an installation path of C:\boost_1.91.0):

  • BOOST_ROOT=C:\boost_1.91.0
  • BOOST_LIBRARYDIR=C:\boost_1.91.0\lib64-msvc-14.5 (or whatever version was installed)
  • BOOST_INCLUDEDIR=C:\boost_1.91.0\boost

MinGW (MSYS2)

Building

Enter the clang64 prefix of MSYS. To update and install all dependencies, run

pacman -Syu --needed --noconfirm mingw-w64-clang-x86_64-clang mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-ninja mingw-w64-clang-x86_64-git mingw-w64-clang-x86_64-qt6-base mingw-w64-clang-x86_64-boost

To build, run

mkdir build
cd build
cmake .. -GNinja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS="-pthread"

Replace CMAKE_BUILD_TYPE with desired build type:

  • Debug
  • RelWithDebugInfo
  • Release

If you installed Qt for MinGW via the Qt maintenance tool and not via pacman, you have to provide a CMAKE_PREFIX_PATH, like in the MSVC build instructions.

Then run ninja.

Deploying

You should be able to run

mkdir deploy
windeployqt6 --no-translations --dir deploy libgruppensprechen/test/test-app.exe
cp libgruppensprechen/test/test-app.exe deploy

and copy the necessary MinGW runtimes files. Which files need to be copied still needs to be determined.