Qt5.12 git 源码编译

1. 源码获取

git clone https://code.qt.io/qt/qt5.git
cd qt5
perl init-repository

2. 环境准备

# msvc
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars32.bat"

# openssl 支持
set INCLUDE=%INCLUDE%;E:\WorkSpace\4-Interface\standard\openssl\swssl_1.1.1pre8\sansec\Product\swssl-win32-10005\include

# 修改  QT\Qt5.3.2\5.3\Src\qtbase\mkspecs\win32-msvc2013\qmake.conf

DEFINES                += UNICODE WIN32
QMAKE_CFLAGS_RELEASE    = -O2 -MD
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi
QMAKE_CFLAGS_DEBUG      = -Zi -MDd
QMAKE_LFLAGS_CONSOLE    = /SUBSYSTEM:CONSOLE@QMAKE_SUBSYSTEM_SUFFIX@
QMAKE_LFLAGS_WINDOWS    = /SUBSYSTEM:WINDOWS@QMAKE_SUBSYSTEM_SUFFIX@

==>

DEFINES                += UNICODE WIN32 _USING_V110_SDK71_
QMAKE_CFLAGS_RELEASE    = -O2 -MT
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MT -Zi
QMAKE_CFLAGS_DEBUG      = -Zi -MTd
QMAKE_LFLAGS_CONSOLE    = /SUBSYSTEM:CONSOLE,5.01
QMAKE_LFLAGS_WINDOWS    = /SUBSYSTEM:WINDOWS,5.01

3. 编译

mkdir build
cd build

# configure
configure -confirm-license -opensource -debug-and-release -static -no-dbus -no-opengl -no-gcc-sysroot -no-evdev -no-xcb -qt-zlib -qt-libjpeg -qt-libpng -qt-freetype -qt-pcre -qt-harfbuzz -nomake examples -nomake tests -platform win32-msvc -prefix "C:\Qt\Qt5.12"

# make
nmake
nmake install