欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 健康 > 养生 > windows 使用clang编译qt-6.9.1源代码

windows 使用clang编译qt-6.9.1源代码

2025/6/18 11:04:09 来源:https://blog.csdn.net/developerof/article/details/148688883  浏览:    关键词:windows 使用clang编译qt-6.9.1源代码

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 .

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词