本帖最后由 Qter 于 2020-3-21 11:26 编辑
https://code.qt.io/cgit/
https://doc.qt.io/qt-5/build-sources.html
General Installation InformationBuilding Qt revolves around using configure to configure Qt for a particular platform with a particular set of Qt features or modules. For more information, visit the following page:
configure 相关在源码根目录下运行 configure -h 查看相关命令,前提是在init-repository后,已经存在qtbase目录
注:windows平台configure对应是是configure.bat这个文件
mkdir qtbuild
cd qtbuild
configure -prefix "%LibrariesPath%\Qt-5.12.5
-prefix 指定编译后Qt程序和相关库的安装路径
-platform 设置编译主机平台.
常用如下:
configure.bat -platform win32-g++
configure.bat -platform win32-msvc
完整的列表查看qtbase/mkspecs 目录
- -device - a specific device or chipsets. The list of devices that configure is compatible with are found in qtbase/mkspecs/devices. For more information, visit the [url=http://wiki.qt.io/Categoryevices]Devices[/url] Wiki page.
-mp .................. Use multiple processors for compilation (MSVC only)
-opensource .......... Build the Open-Source Edition of Qt
https://doc.qt.io/qt-5/windows-building.html
https://doc.qt.io/qt-5/windows-requirements.html
编译要求
Libraries
- OpenSSL Toolkit: Qt can make use of OpenSSL to support Secure Socket Layer (SSL) communication.
- ICU: Qt 5 can make use of the ICU library for enhanced UNICODE and Globalization support (see QTextCodec, QCollator::setNumericMode()).
At compile time, the include and lib folders of the ICU installation must be appended to the INCLUDE and LIB environment variables. At run-time, the ICU DLLs need to be found by copying the DLLs to the application folder or by adding the bin folder of the ICU installation to the PATH environment variable. - ANGLE: This library converts OpenGL ES 2.0 API calls to DirectX 11 or DirectX 9 calls (depending on availability), removing the need to install graphics drivers on the target machines.
编译用到的工具
- ActivePerl - Install a recent version of ActivePerl (download page) and add the installation location to your PATH.
- Python - Install Python from the here and add the installation location to your PATH.
动手先添加下依赖的PATH路径
D:\TBuild\ThirdParty\Perl\bin;D:\TBuild\ThirdParty\Python27;D:\TBuild\ThirdParty\jom;
在桌面上创建打开的快捷方式
右键->新建->快捷方式,输入如下内容
%SystemRoot%\system32\cmd.exe /E:ON /V:ON /k F:\Qt\qt5vars.cmd
qt5vars.cmd内容如下:- REM Set up Microsoft Visual Studio 2019, where <arch> is amd64, x86, etc.
- CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars32.bat" x86
- SET _ROOT=F:\Qt\Qt-5
- SET PATH=%_ROOT%\qtbase\bin;%_ROOT%\gnuwin32\bin;%PATH%
- SET _ROOT=
复制代码 https://doc.qt.io/qt-5/windows-deployment.html
C:\Qt\Qt5.12.0\5.12.0\msvc2017\bin\windeployqt.exe 查看qt程序的依赖文件
Static Linking
configure -static
重新配置和重建Qt 要输入如下命令,对原来的配置进行清理
nmake distclean
对Qt开发的程序的静态编译和动态编译
nmake clean
qmake -config release
nmake
https://wiki.qt.io/Building_Qt_5_from_Git
This article provides hints for checking out and building the Qt 5 repositories. This is primarily for developers who want to contribute to the Qt library itself, or who want to try the latest unreleased code. If you simply want to build a specific release of Qt from source to use the libraries in your own project, you can download the source code from the Official Releases page or the Archive. Alternatively, commercial customers can download the Source Packages via the Qt Account portal.
All desktop platforms- Git (>= 1.6.x)
- Perl (>=5.14)
- Python (>=2.6.x)
- A working C++ compiler
|