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