Qt
Qt is a cross-platform C++ framework for GUI and application development. For the MSYS2 toolchain used below, see C++.
Deploy with windeployqt
windeployqt collects the Qt DLLs and plugins an executable needs so it can run
on a machine without Qt installed.
Open the Qt x.x x-bit for Desktop terminal, change into the folder with the compiled executable, and run:
windeployqt.exe .
Batch file example:
path=C:\Qt\6.5.2\mingw_64\bin
copy .\release\ForTest.exe .\ForTest
cd ForTest
windeployqt ForTest.exe
Build from source on Windows (MSYS2)
Install with pacman (MSYS2 MINGW64)
# Search for packages
pacman -Ss mingw-w64-x86_64-qt6
pacman -Ss mingw-w64-harfbuzz
pacman -S --needed mingw-w64-x86_64-qt6-static mingw-w64-x86_64-qt-creator mingw-w64-x86_64-clang mingw-w64-x86_64-gdb mingw-w64-x86_64-cmake
# If more DLLs are missing
pacman -S --needed mingw-w64-x86_64-editorconfig-qtcreator
pacman -S --needed mingw-w64-x86_64-qt-creator-devel
Configure
Qt's own configure.bat selects a static or shared build:
# GCC
configure.bat -debug -static -static-runtime -confirm-license -opensource -platform win32-g++ -nomake examples -prefix "C:\temp\qt-6.5.3-static-mingw_64-debug" -j 8
# MSVC
configure.bat -static -prefix "C:\Qt-6.5.3-static" -confirm-license -opensource -debug-and-release -platform win32-msvc -nomake examples -nomake tests -plugin-sql-sqlite -plugin-sql-odbc -qt-zlib -qt-libpng -qt-libjpeg -opengl desktop -mp
Build and install
cmake --build . --parallel
cmake --install .
Fix MinGW64 Qt6 static link problems
if(QT_FEATURE_static STREQUAL "ON" AND WIN32 AND MINGW)
set_property(TARGET harfbuzz::harfbuzz PROPERTY
IMPORTED_IMPLIB ${harfbuzz_DIR}../../../libharfbuzz.dll.a)
endif()