Build a static Qt5.7.1 for Windows using MSVC2013

来源:互联网 发布:淘宝卖家电话采集软件 编辑:程序博客网 时间:2024/05/17 08:46
Build a static Qt5.7.1 for Windows using MSVC2013

1. Download and extract Qt source code to this path, or you can use the source code from the online installer (in this case you have to choose to download source code during installation):

C:\Qt\Msvc\Src-5.7.1

2. Create folder C:\Qt\Msvc\Qt5.7.1_static
3. Go to C:\Qt\Msvc\Src-5.7.1\qtbase\mkspecs\common
and change msvc-desktop.conf like this (change all MD to MT to remove dependency on msvc dlls):
Initial values:

QMAKE_CFLAGS_RELEASE = -O2 -MD
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi
QMAKE_CFLAGS_DEBUG = -Zi -MDd

Should be changed to:

QMAKE_CFLAGS_RELEASE = -O2 -MT
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MT -Zi
QMAKE_CFLAGS_DEBUG = -Zi -MTd

4. Using MSVC2013 Developer Command Line tools, running as admin, Configure using following command:
(first change directory to here using “cd” command : C:\Qt\Msvc\Src-5.7.1)
Configure:

configure.bat -static -debug-and-release -opensource -prefix "C:\Qt\Msvc\Qt5.7.1_static" -c++std c++11 -mp -qt-sql-sqlite -plugin-sql-sqlite -opengl es2 -opengl desktop -platform win32-msvc2013 -qt-zlib -qt-libjpeg -qt-libpng -qt-sql-odbc -dbus-linked -dbus-runtime -no-qml-debug -qt-style-windows -qt-style-fusion -nomake examples -make libs -make tools -qt-pcre

(Notice that the parameter -platform win32-msvc2013 should be set according to the compiler you are using)
(Also note that you can add or remove parts and pieces of the libraries you are building by adding or removing parameters above, for example I always use ODBC so I add -qt-sql-odbc parameter but you might want to remove it if you don't need it.)
5. Run nmake (or JOM if you have it -- jom -j 4
6. run nmake install (jom install -j 4)
0 0
原创粉丝点击