MSVC 静态编译 Qt 5

 MSVC 静态编译 Qt 5

最近试了下Qt 6,不小心删了之前静态编译的Qt 5 😂,又从download.qt.io拉回源码,重新编译了一遍,一些配置参数竟然想不起来了,在博客里mark一下 ( •̀ ω •́ )✧

configure.bat -prefix D:\Qt\Qt5.15.2-static -confirm-license -opensource -release -static -static-runtime -opengl dynamic -combined-angle-lib -no-feature-d3d12 -platform win32-msvc -mp -nomake tests -nomake examples -nomake tools -skip qtwebengine -skip qtwebview

jom -j 16

jom install

-prefix D:\Qt\Qt5.15.2-static 这个指定编译完成后 ,接下来 jom install 到的路径
-confirm-license -opensource 遵从开源license约定
-release 编译 release 版本,也可以指定 -debug
-static -static-runtime  静态编译
-angle -combined-angle-lib -no-feature-d3d12 在windows系统上,Qt Quick 2的全部特性需要OpenGL 2.1或更高版本才能运行。默认Windows系统对OpenGL图像接口的支持不太理想,通过指定 -angle 使用ANGLE库将OpenGL调用转换为DirectX。
platform win32-msvc 指定用MSVC编译器编译
-mp 多核构建
-nomake tests -nomake examples -nomake tools -skip qtwebengine -skip qtwebview  不需要用到的功能 跳过编译以节省时间

具体细节可参考:https://wiki.qt.io/Building_Qt_5_from_Git

吴川斌

吴川斌

Leave a Reply