使用VS2019静态编译Qt5.15


准备工作提前安装VS2019,然后安装README文件中要求安装依赖工具,说明如下

Windows:
--------

Open a command prompt.
Ensure that the following tools can be found in the path:
* Supported compiler (Visual Studio 2012 or later,
MinGW-builds gcc 4.9 or later)
* Perl version 5.12 or later [http://www.activestate.com/activeperl/]
* Python version 2.7 or later [http://www.activestate.com/activepython/]
* Ruby version 1.9.3 or later [http://rubyinstaller.org/]

cd <path>\<source_package>
configure -prefix %CD%\qtbase <license> -nomake tests
nmake // jom // mingw32-make

To accelerate the bootstrap of qmake with MSVC, it may be useful to pass
"-make-tool jom" on the configure command line. If you do not use jom,
adding "/MP" to the CL environment variable is a good idea.

More details follow.

Build!

 

1、解压qt-everywhere-src-5.15.0到D盘

2、修改D:\qt-everywhere-src-5.15.0\qtbase\mkspecs\common\msvc-desktop.conf

QMAKE_CFLAGS_RELEASE = $$QMAKE_CFLAGS_OPTIMIZE -MT
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_OPTIMIZE -Zi -MT
QMAKE_CFLAGS_DEBUG = -Zi -MTd

3、打开x86 Native Tools Command Prompt for VS 2019 (建议管理员权限)

cd D:\qt-everywhere-src-5.15.0

D:

4、配置编译参数

configure.bat -static -prefix "C:\Qt\5.15.0\msvc2019_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

5、编译和安装,这里使用jom需要单独安装

D:\jom_1_1_3\jom.exe

D:\jom_1_1_3\jom.exe install

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM