1.下载qt-everywhere-6.9.1.tar.xz
2.解压到磁盘
3.打开windows vs msvc工具shell
4.安装最新版llvm 我当前版本是20.1.7
https://github.com/llvm/llvm-project/tree/llvmorg-20.1.7
5.
configure.bat -release -confirm-license -opensource -prefix "D:\software\Qt" -platform win32-clang-msvc -nomake examples -nomake tests -skip qtmqtt -skip qtopcua -skip qtquick3dphysics -skip qtquickeffectmaker -shared
+ D:\qt-everywhere-src-6.9.1/qtbase/configure.bat -top-level -release -confirm-license -opensource -prefix D:\software\Qt -platform win32-clang-msvc -nomake examples -nomake tests -skip qtmqtt -skip qtopcua -skip qtquick3dphysics -skip qtquickeffectmaker -shared
configure.bat -release -confirm-license -opensource -prefix "D:\software\Qt" -platform win32-clang-msvc -shared -nomake examples -nomake tests -skip qtmqtt -skip qtopcua -skip qtquick3dphysics -skip qtquickeffectmaker
或者
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBUILD_SHARED_LIBS=OFF -DQT_BUILD_SUBMODULES=qtbase -DQT_BUILD_EXAMPLES=OFF -DQT_BUILD_TESTS=OFF -DBUILD_WITH_PCH=OFF -DQT_BUILD_TOOLS_BY_DEFAULT=OFF -DFEATURE_precompile_header=OFF -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl
6. 运行
>cmake --build . --parallel
==========cut line here=====================================================
[198/1802] Building CXX object qtbase\src\entrypoint\CMakeFiles\EntryPointImplementation.dir\qtentrypoint_win.cpp.obj
D:\qt-everywhere-src-6.9.1\qtbase\src\entrypoint\qtentrypoint_win.cpp(21,16): warning: 'main' should not be 'extern "C"' [-Wmain]
21 | extern "C" int main(int, char **);
| ^
1 warning generated.
[501/1802] Building CXX object qtbase\src\corelib\CMakeFiles\Core.dir\global\qlibraryinfo.cpp.obj
D:\qt-everywhere-src-6.9.1\qtbase\src\corelib\global\qlibraryinfo.cpp(310,16): warning: unused function 'getWindowsModuleHandle' [-Wunused-function]
310 | static HMODULE getWindowsModuleHandle()
| ^~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
[1515/1802] Building CXX object qtbase\src\widgets\CMakeFiles\Widgets.dir\styles\qstyleoption.cpp.obj
D:\qt-everywhere-src-6.9.1\qtbase\src\widgets\styles\qstyleoption.cpp(864,32): warning: implicit truncation from 'Qt::TextElideMode' to bit-field changes value from 3 to -1 [-Wbitfield-constant-conversion]
864 | : QStyleOptionHeader(version), textElideMode(Qt::ElideNone), isSectionDragTarget(false), unused(0)
| ^ ~~~~~~~~~~~~~
1 warning generated.
[1541/1802] Building CXX object qtbase\src\plugins\platforms\direct2d\CMakeFiles\QWindowsDirect2DIntegrationPlugin.dir\__\windows\qwindowsglcontext.cpp.ob
D:\qt-everywhere-src-6.9.1\qtbase\src\plugins\platforms\windows\qwindowsglcontext.cpp(1350,128): warning: implicit conversion between pointer-to-function and pointer-to-object is a Microsoft extension [-Wmicrosoft-cast]
1350 | qCDebug(lcQpaGl) << __FUNCTION__ << procName << QOpenGLStaticContext::opengl32.wglGetCurrentContext() << "returns" << procAddress;
| ^~~~~~~~~~~
1 warning generated.
[1737/1802] Building CXX object qtbase\src\plugins\platforms\windows\CMakeFiles\QWindowsIntegrationPlugin.dir\qwindowsglcontext.cpp.obj
D:\qt-everywhere-src-6.9.1\qtbase\src\plugins\platforms\windows\qwindowsglcontext.cpp(1350,128): warning: implicit conversion between pointer-to-function and pointer-to-object is a Microsoft extension [-Wmicrosoft-cast]
1350 | qCDebug(lcQpaGl) << __FUNCTION__ << procName << QOpenGLStaticContext::opengl32.wglGetCurrentContext() << "returns" << procAddress;
| ^~~~~~~~~~~
1 warning generated.
[1802/1802] Linking CXX static library qtbase\plugins\styles\qmodernwindowsstyle.lib
========================================================================
7. cmake --install .