Qt 5.6 5.8 vs2015 编译静态库版本(有全部的截图)good


安装Qt

Qt官网下载Qt安装包 
 
安装Qt和源码,一定要勾选source选项 
 
添加bin到系统变量 

工具

需要python3和 perl、 vs2015 第三方工具,到官方下载安装 

在命令行测试工具是否安装成功 

configue

首先修改文件C:\Qt\Qt5.6.2\5.6\Src\qtbase\mkspecs\common\msvc-desktop.conf 把MD替换为MT静态编译 

然后上面打开的终端cd命令跳到Qt源码目录 ,输入下面命令

5.6

configure -confirm-license -opensource -platform win32-msvc2015 -debug-and-release -static -prefix "C:\qt\static-vs2015-qt" -qt-sql-sqlite -qt-sql-odbc -plugin-sql-sqlite -plugin-sql-odbc -qt-zlib -qt-libpng -qt-libjpeg -opengl desktop -target xp -qt-freetype -qml-debug -no-angle -nomake tests -nomake examples

5.8

configure -confirm-license -opensource -platform win32-msvc2015 -debug-and-release -static -prefix "C:\qt\static-vs2015-qt" -qt-sql-sqlite -qt-zlib -qt-libpng -qt-libjpeg -opengl desktop -target xp -qt-freetype -qml-debug -no-angle -nomake tests -nomake examples 

5.8需要把-qt-sql-sqlite 改为-qt-sqlite ,从5.7.0开始源码里configure已经去掉了-target xp这个选项的支持了

nmake


有时候生成的pri文件有问题(获取cl版本时截取的字符串有问题),需要手动修改下 

修改如下,如果pri文件没有报错,就不用修改

CONFIG+= debug static rtti no_plugin_manifest directwrite qpa host_build { QT_ARCH = i386 QT_TARGET_ARCH = i386 } else { QT_ARCH = i386 } QT_CONFIG += minimal-config small-config medium-config large-config full-config debug_and_release build_all release debug static zlib gif jpeg png freetype harfbuzz build_all accessibility opengl dbus audio-backend directwrite native-gestures qpa concurrent #versioning QT_VERSION = 5.6.2 QT_MAJOR_VERSION = 5 QT_MINOR_VERSION = 6 QT_PATCH_VERSION = 2 QT_EDITION = OpenSource QMAKE_TARGET_OS = xp QT_DEFAULT_QPA_PLUGIN = qwindows QT_CL_MAJOR_VERSION = 19 QT_CL_MINOR_VERSION = 00 QT_CL_PATCH_VERSION = 24210 

编译

nmake编译


编译5.7和5.8时可能会遇到这个问题,把qtuiohandler.cpp文件改为带BOM的utf-8编码就可以了

安装

nmake install

配置Qt Creator

添加Qt版本,提示qmlscene未安装警告,把以前的qmlscene.exe拷贝到静态库中的bin文件夹即可 

添加构建套件 

 
 
http://blog.csdn.net/x356982611/article/details/62042318


免责声明!

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



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