QT5.63+vc2017的静态编译,含openssl

1、打开文件
qt-everywhere-src-5.6.3\qtbase\mkspecs\common
中的msvc-desktop.conf

修改:

QMAKE_CFLAGS_RELEASE    = $$QMAKE_CFLAGS_OPTIMIZE -MD
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_OPTIMIZE -Zi -MD
QMAKE_CFLAGS_DEBUG      = -Zi -MDd

改为

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

74和75行:
QMAKE_LFLAGS_CONSOLE    = /SUBSYSTEM:CONSOLE\",5.01\"
QMAKE_LFLAGS_WINDOWS    = /SUBSYSTEM:WINDOWS\",5.01\"

加入:\",5.01\"

 

2、建立qt563_vc2017.bat文件

set MSVC_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community
set QMAKESPEC=win32-msvc2017
set QT5_SRC_PATH=D:\qt\qt-everywhere-opensource-src-5.6.3
set QT5_INSTALL_PATH=d:\qt\qt563_vc2017
set MSVC_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community
set QMAKESPEC=win32-msvc2017
set QT5_SRC_PATH=D:\qt\qt-everywhere-opensource-src-5.6.3
set QT5_INSTALL_PATH=d:\qt\qt563_vc2017
set PERL_PATH=C:\Perl64
set PYTHON_PATH=C:\Python27
set RUBY_PATH=C:\Ruby26-x64
set WIN_FLEX_BISION_PATH=%QT5_SRC_PATH%\gnuwin32\bin   
set OPENSSL_PATH=D:\QT\third-part\staticlib\openssl
set PATH=%QT5_SRC_PATH%\qtbase\bin;%QT5_SRC_PATH%\qtbase\lib;%QT5_SRC_PATH%\gnuwin32\bin;%RUBY_PATH%\bin;%PATH%
set PATH=%PATH%;%PERL_PATH%\bin;%PYTHON_PATH%
set LIB=%LIB%;%OPENSSL_PATH%\lib
set INCLUDE=%INCLUDE%;%OPENSSL_PATH%\include
set PATH=%PATH%;%ICU_PATH%\bin;%OPENSSL_PATH%\bin
call "%MSVC_PATH%\VC\Auxiliary\Build\vcvarsall.bat" x86 
cd /D %QT5_SRC_PATH%
call %QT5_SRC_PATH%\configure -prefix "%QT5_INSTALL_PATH%" -debug-and-release -static -opensource -confirm-license -platform win32-msvc2017 -target xp  -c++std c++1z  -opengl dynamic  -largefile -qt-zlib -mp -openssl -ssl  -qt-libpng -qt-libjpeg  -qt-sql-sqlite -qt-freetype -qmake -nomake examples -nomake tests -no-directwrite
nmake
nmake install
xcopy /y /k "%OPENSSL_PATH%\bin\libeay32.dll" "%QT5_INSTALL_PATH%\bin\"
xcopy /y /k "%OPENSSL_PATH%\bin\ssleay32.dll" "%QT5_INSTALL_PATH%\bin\"
xcopy /y /k "%OPENSSL_PATH%\lib\libeay32.lib" "%QT5_INSTALL_PATH%\lib\"
xcopy /y /k "%OPENSSL_PATH%\lib\ssleay32.lib" "%QT5_INSTALL_PATH%\lib\"
pause

 

你可能感兴趣的:(VC,C/C++,QT)