Skip to content

Instantly share code, notes, and snippets.

@gianmaria
Last active April 2, 2025 22:47
Show Gist options
  • Save gianmaria/c3aa8696f28136f92e736cdfbaf5fa25 to your computer and use it in GitHub Desktop.
Save gianmaria/c3aa8696f28136f92e736cdfbaf5fa25 to your computer and use it in GitHub Desktop.
Build Qt 6 on Windows

Building Qt 6.5 on Windows

Neessary tools

  • cmake
  • ninja
  • python (>= 3.10)
  • node
  • cygwin64
  • git for windows

Build CLANG

Links:

git clone https://github.com/llvm/llvm-project.git
md build\debug
cmake -GNinja -S llvm -B build/debug -DCMAKE_BUILD_TYPE=Debug -DLLVM_ENABLE_PROJECTS=clang
cmake --build build/debug
cmake --install build/debug --prefix "C:/dev/libclang/debug"

md build\release
cmake -GNinja -S llvm -B build/release -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS=clang
cmake --build build/release # -j 3
cmake --install build/release --prefix "C:/dev/libclang/release"

Build Qt 6.5

install python lib

python -m pip install html5lib

Getting qt source

git clone git://code.qt.io/qt/qt5.git qt6
cd qt6
git checkout origin/6.5.0 -b 6.5.0
git submodule update --init --recursive

Building

We are going to build Qt in debug first and release later

md build\debug
cd build\debug
@rem save current PATH
set ORIGINAL_PATH=%PATH%
@rem NOTE: libclang must be at the end otherwise cmake will use clang insted of msvc
set PATH=%PATH%;C:\Dev\libclang\debug\bin
@rem to skip modules: -skip qtwebengine
..\..\configure.bat -no-pch -skip qtwebengine -debug -prefix C:\dev\Qt\6.5
cmake --build . --parallel
cmake --install .

cd ..\..

md build\release
cd build\release
set PATH=%ORIGINAL_PATH%
set PATH=%PATH%;C:\Dev\libclang\release\bin
..\..\configure.bat -no-pch -skip qtwebengine -release -prefix C:\dev\Qt\6.5
cmake --build . --parallel
cmake --install .

Documentation

Documentation will be build with the release version of Qt

@rem inside build\release
cmake --build . --target docs
cmake --build . --target install_docs

Build QtCreator

cd build
cmake -DCMAKE_BUILD_TYPE=Release -G Ninja ..
cmake --build . --config Release

Install QtCreator

cmake --install . --prefix D:/Qt/Creator/10.0.0
::and then, create self contained package of QtCreator
cmake --install . --prefix D:/Qt/creator/10.0.0 --component Dependencies

Useful links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment