编译环境配置
1,下载Qt源码,这里使用QT5.12.8的源码官网: Index of /
国内镜像网站
这里给大家推荐几个国内著名的 Qt 镜像网站,主要是各个高校的:
2,安装VS2017
3,安装python 2.7 Download Python | Python.org
4,安装ActivePerl Download & Install Perl - ActiveState
5, 安装 Ruby+Devkit Downloads
在开始菜单里进入Visual Studio 2017文件夹,打开“VS2017 x86本机工具人员命令提示符”,进入cmd窗口模式:
1.cd 下载的Qt源码目录;
2.执行
configure -prefix F:\\firefoxDownload\\qt-everywhere-src-5.12.8\\build -confirm-license -opensource -debug-and-release -platform win32-msvc -nomake examples -nomake tests -plugin-sql-sqlite -plugin-sql-odbc -qt-zlib -qt-libpng -qt-libjpeg -opengl desktop -mp
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.47
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community>F:
F:\>cd F:\firefoxDownload\qt-everywhere-src-5.12.8
F:\firefoxDownload\qt-everywhere-src-5.12.8>configure -prefix F:\\firefoxDownload\\qt-everywhere-src-5.12.8\\build -confirm-license -opensource -debug-and-release -platform win32-msvc -nomake examples -nomake tests -plugin-sql-sqlite -plugin-sql-odbc -qt-zlib -qt-libpng -qt-libjpeg -opengl desktop -mp
+ cd qtbase
+ F:\firefoxDownload\qt-everywhere-src-5.12.8\qtbase\configure.bat -top-level -prefix F:\\firefoxDownload\\qt-everywhere-src-5.12.8\\build -confirm-license -opensource -debug-and-release -platform win32-msvc -nomake examples -nomake tests -plugin-sql-sqlite -plugin-sql-odbc -qt-zlib -qt-libpng -qt-libjpeg -opengl desktop -mp
Notice: re-mapping requested qmake spec to unified 'win32-msvc'.
Bootstrapping qmake ...
Microsoft (R) 程序维护实用工具 14.16.27048.0 版
版权所有 (C) Microsoft Corporation。 保留所有权利。
Info: creating super cache file F:\firefoxDownload\qt-everywhere-src-5.12.8\.qmake.super
Info: creating cache file F:\firefoxDownload\qt-everywhere-src-5.12.8\.qmake.cache
Info: creating stash file F:\firefoxDownload\qt-everywhere-src-5.12.8\.qmake.stash
This is the Qt Open Source Edition.
You have already accepted the terms of the Open Source license.
Running configuration tests...
Checking for valid makespec... yes
Checking for target architecture... x86_64
Checking for SSE2 instructions... yes
Checking for AES new instructions... yes
Checking for alloca() in alloca.h... no
Checking for alloca() in malloc.h... yes
Checking for SSE3 instructions... yes
Checking for SSSE3 instructions... yes
Checking for SSE4.1 instructions... yes
Checking for SSE4.2 instructions... yes
Checking for AVX instructions... yes
Checking for AVX2 instructions... yes
Checking for AVX512 F instructions... yes
Checking for AVX512 BW instructions... yes
Checking for AVX512 CD instructions... yes
Checking for AVX512 DQ instructions... yes
Checking for AVX512 ER instructions... yes
Checking for AVX512 IFMA instructions... yes
Checking for AVX512 PF instructions... yes
Checking for AVX512 VBMI instructions... yes
Checking for AVX512 VL instructions... yes
Checking for C++14 support... yes
Checking for C++1z support... yes
Checking for C99 support... no
Checking for D-Bus >= 1.2... no
Checking for F16C instructions... yes
Checking for D-Bus >= 1.2 (host)... yes
Checking for IncrediBuild... no
Checking for udev... no
Checking for POSIX fallocate()... no
Checking for precompiled header support... yes
Checking for RDRAND instruction... yes
Checking for SHA new instructions... yes
Checking for STL compatibility... yes
Checking for Intrinsics without -mXXX argument... yes
Checking for C++11
Checking for eventfd... no
Checking for inotify... no
Checking for slog2... no
Checking for 64 bit atomics... yes
Checking for DoubleConversion... no
Checking for PCRE2... no
Checking for O_CLOEXEC... no
Checking for C++11
Checking for working std::atomic for function pointers... yes
Checking for OpenSSL Headers... no
Checking for getifaddrs()... no
Checking for IPv6 ifname... no
Checking for xkbcommon >= 0.5.0... no
Checking for DirectX GI... yes
Checking for Direct3D 11... yes
Checking for Direct2D 1... yes
Checking for Direct2D 1.1... yes
Checking for DirectX GI 1.2... yes
Checking for Direct3D 11.1... yes
Checking for Direct3D 9... yes
Checking for DirectWrite... yes
Checking for DirectWrite 1... yes
Checking for DirectWrite 2... yes
Checking for KMS... no
Checking for DirectX GUID... yes
Checking for EGL... no
Checking for evdev... no
Checking for GBM... no
Checking for LinuxFB... no
Checking for mtdev... no
Checking for OpenVG... no
Checking for default QPA platform... windows
Checking for tslib... no
Checking for Vulkan... no
Checking for XLib... no
Checking for uxtheme.h... yes
Checking for CUPS... no
Checking for DB2 (IBM)... no
Checking for InterBase... no
Checking for MySQL... no
Checking for OCI (Oracle)... no
Checking for ODBC... yes
Checking for PostgreSQL... no
Checking for SQLite (version 2)... no
Checking for TDS (Sybase)... no
Checking for jasper... no
Checking for mng... no
Checking for tiff... no
Checking for webp... no
Checking for Direct3D 12... yes
Checking for SDL2... no
Checking for Assimp... no
Checking for Autodesk FBX... no
Checking for Wayland EGL library... no
Checking for BlueZ... no
Checking for WinRT Bluetooth API... yes
Checking for sensorfw... no
Checking for Gypsy... no
Checking for WinRT Geolocation API... yes
Checking for DirectShow... yes
Checking for evr.h... yes
Checking for GStreamer 1.0... no
Checking for GStreamer 0.10... no
Checking for OpenAL... no
Checking for libresourceqt5... no
Checking for Windows Audio Services... yes
Checking for WMF... yes
Checking for wmsdk.h... yes
Checking for WShellItem... yes
Checking for libclang... no
Checking for bison... yes
Checking for embedded... no
Checking for flex... yes
Checking for gperf... yes
Checking for python2...
Checking for d-bus... no
Checking for fontconfig... no
Checking for libdrm... no
Checking for system ninja... yes
Checking for xcomposite... no
Checking for xcursor... no
Checking for xi... no
Checking for xtst... no
Checking for 64bit compiler... yes
Checking for winversion... yes
Done running configuration tests.
Configure summary:
Build type: win32-msvc (x86_64, CPU features: sse sse2)
Compiler: msvc 191627048
Configuration: sse2 aesni sse3 ssse3 sse4_1 sse4_2 avx avx2 avx512f avx512bw avx512cd avx512dq avx512er avx512ifma avx512pf avx512vbmi avx512vl compile_examples f16c largefile msvc_mp precompile_header rdrnd shani x86SimdAlways shared debug_and_release release debug build_all c++11 c++14 c++1z concurrent dbus no-pkg-config release_tools stl
Build options:
Mode ................................... debug and release; default link: debug; optimized tools
Optimize release build for size ........ no
Building shared libraries .............. yes
Using C standard ....................... C89
Using C++ standard ..................... C++1z
Using gold linker ...................... no
Using precompiled headers .............. yes
Using LTCG ............................. no
Target compiler supports:
SSE .................................. SSE2 SSE3 SSSE3 SSE4.1 SSE4.2
AVX .................................. AVX AVX2
AVX512 ............................... F ER CD PF DQ BW VL IFMA VBMI
Other x86 ............................ AES F16C RDRAND SHA
Build parts ............................ libs tools
App store compliance ................... no
Qt modules and options:
Qt Concurrent .......................... yes
Qt D-Bus ............................... yes
Qt D-Bus directly linked to libdbus .... no
Qt Gui ................................. yes
Qt Network ............................. yes
Qt Sql ................................. yes
Qt Testlib ............................. yes
Qt Widgets ............................. yes
Qt Xml ................................. yes
Support enabled for:
Using pkg-config ....................... no
udev ................................... no
Using system zlib ...................... no
Qt Core:
DoubleConversion ....................... yes
Using system DoubleConversion ........ no
GLib ................................... no
iconv .................................. no
ICU .................................... no
Tracing backend ........................
Logging backends:
journald ............................. no
syslog ............................... no
slog2 ................................ no
Using system PCRE2 ..................... no
Qt Network:
getifaddrs() ........................... no
IPv6 ifname ............................ no
libproxy ............................... no
OpenSSL ................................ no
Qt directly linked to OpenSSL ........ no
OpenSSL 1.1 ............................ no
DTLS ................................... no
SCTP ................................... no
Use system proxies ..................... yes
Qt Gui:
Accessibility .......................... yes
FreeType ............................... yes
Using system FreeType ................ no
HarfBuzz ............................... yes
Using system HarfBuzz ................ no
Fontconfig ............................. no
Image formats:
GIF .................................. yes
ICO .................................. yes
JPEG ................................. yes
Using system libjpeg ............... no
PNG .................................. yes
Using system libpng ................ no
EGL .................................... no
OpenVG ................................. no
OpenGL:
ANGLE ................................ no
Desktop OpenGL ....................... yes
Dynamic OpenGL ....................... no
OpenGL ES 2.0 ........................ no
OpenGL ES 3.0 ........................ no
OpenGL ES 3.1 ........................ no
OpenGL ES 3.2 ........................ no
Vulkan ................................. no
Session Management ..................... yes
Features used by QPA backends:
evdev .................................. no
libinput ............................... no
INTEGRITY HID .......................... no
mtdev .................................. no
tslib .................................. no
xkbcommon .............................. no
X11 specific:
XLib ................................. no
XCB Xlib ............................. no
EGL on X11 ........................... no
QPA backends:
DirectFB ............................... no
EGLFS .................................. no
LinuxFB ................................ no
VNC .................................... no
Mir client ............................. no
Windows:
Direct 2D ............................ yes
DirectWrite .......................... yes
DirectWrite 2 ........................ yes
Qt Sql:
SQL item models ........................ yes
Qt Widgets:
GTK+ ................................... no
Styles ................................. Fusion Windows WindowsVista
Qt PrintSupport:
CUPS ................................... no
Qt Sql Drivers:
DB2 (IBM) .............................. no
InterBase .............................. no
MySql .................................. no
OCI (Oracle) ........................... no
ODBC ................................... yes
PostgreSQL ............................. no
SQLite2 ................................ no
SQLite ................................. yes
Using system provided SQLite ......... no
TDS (Sybase) ........................... no
Qt Testlib:
Tester for item models ................. yes
Qt SerialBus:
Socket CAN ............................. no
Socket CAN FD .......................... no
Further Image Formats:
JasPer ................................. no
MNG .................................... no
TIFF ................................... yes
Using system libtiff ................. no
WEBP ................................... yes
Using system libwebp ................. no
Qt QML:
QML network support .................... yes
QML debugging and profiling support .... yes
QML sequence object .................... yes
QML list model ......................... yes
QML XML http request ................... yes
QML Locale ............................. yes
QML delegate model ..................... yes
Qt Quick:
Direct3D 12 ............................ yes
AnimatedImage item ..................... yes
Canvas item ............................ yes
Support for Qt Quick Designer .......... yes
Flipable item .......................... yes
GridView item .......................... yes
ListView item .......................... yes
TableView item ......................... yes
Path support ........................... yes
PathView item .......................... yes
Positioner items ....................... yes
Repeater item .......................... yes
ShaderEffect item ...................... yes
Sprite item ............................ yes
Qt Scxml:
ECMAScript data model for QtScxml ...... yes
Qt Gamepad:
SDL2 ................................... no
Qt 3D:
Assimp ................................. yes
System Assimp .......................... no
Output Qt3D Job traces ................. no
Output Qt3D GL traces .................. no
Use SSE2 instructions .................. yes
Use AVX2 instructions .................. no
Aspects:
Render aspect ........................ yes
Input aspect ......................... yes
Logic aspect ......................... yes
Animation aspect ..................... yes
Extras aspect ........................ yes
Qt 3D Renderers:
OpenGL Renderer ........................ yes
Qt 3D GeometryLoaders:
Autodesk FBX ........................... no
Qt Wayland Client ........................ no
Qt Wayland Compositor .................... no
Qt Bluetooth:
BlueZ .................................. no
BlueZ Low Energy ....................... no
Linux Crypto API ....................... no
WinRT Bluetooth API (desktop & UWP) .... yes
Qt Sensors:
sensorfw ............................... no
Qt Quick Controls 2:
Styles ................................. Default Fusion Imagine Material Universal
Qt Quick Templates 2:
Hover support .......................... yes
Multi-touch support .................... yes
Qt Positioning:
Gypsy GPS Daemon ....................... no
WinRT Geolocation API .................. yes
Qt Location:
Qt.labs.location experimental QML plugin . yes
Geoservice plugins:
OpenStreetMap ........................ yes
HERE ................................. yes
Esri ................................. yes
Mapbox ............................... yes
MapboxGL ............................. no
Itemsoverlay ......................... yes
QtXmlPatterns:
XML schema support ..................... yes
Qt Multimedia:
ALSA ................................... no
GStreamer 1.0 .......................... no
GStreamer 0.10 ......................... no
Video for Linux ........................ no
OpenAL ................................. no
PulseAudio ............................. no
Resource Policy (libresourceqt5) ....... no
Windows Audio Services ................. yes
DirectShow ............................. yes
Windows Media Foundation ............... yes
Media player backend ................... DirectShow
Qt Tools:
QDoc ................................... no
Qt WebEngine:
Embedded build ......................... no
Full debug information ................. no
Pepper Plugins ......................... yes
Printing and PDF ....................... yes
Proprietary Codecs ..................... no
Spellchecker ........................... yes
Native Spellchecker .................... no
WebRTC ................................. yes
Use System Ninja ....................... yes
Geolocation ............................ yes
WebChannel support ..................... yes
Use v8 snapshot ........................ yes
Kerberos Authentication ................ yes
Note: No wayland-egl support detected. Cross-toolkit compatibility disabled.
WARNING: QDoc will not be compiled, probably because libclang could not be located. This means that you cannot build the Qt documentation.
Either ensure that llvm-config is in your PATH environment variable, or set LLVM_INSTALL_DIR to the location of your llvm installation.
On Linux systems, you may be able to install libclang by installing the libclang-dev or libclang-devel package, depending on your distribution.
On macOS, you can use Homebrew's llvm package.
On Windows, you must set LLVM_INSTALL_DIR to the installation path.
WARNING: Python version 2 (2.7.5 or later) is required to build QtWebEngine.
Qt is now configured for building. Just run 'nmake'.
Once everything is built, you must run 'nmake install'.
Qt will be installed into 'F:\firefoxDownload\qt-everywhere-src-5.12.8\build'.
Prior to reconfiguration, make sure you remove any leftovers from
the previous build.
编译
F:\firefoxDownload\qt-everywhere-src-5.12.8>nmake
这个过程 比较慢长:
编译完成后生成的dll在各模块的bin目录下
如果只改动很小,可以单独模块编译
例如编译qtbase模块
F:\firefoxDownload\qt-everywhere-src-5.12.8>cd qtbase
F:\firefoxDownload\qt-everywhere-src-5.12.8\qtbase> nmake
上面可以看到qtbase模块里由很多子模块构成,我们也可以编译单独的子模块,例如编译qtbase模块里的widgets模块
F:\firefoxDownload\qt-everywhere-src-5.12.8\qtbase>cd src
F:\firefoxDownload\qt-everywhere-src-5.12.8\qtbase\src>cd widgets
F:\firefoxDownload\qt-everywhere-src-5.12.8\qtbase\src\widgets>nmake
这个时候编译的就是widgets模块