下载源码:
官网:下载地址
腾讯源:下载地址
清华源:下载地址
查看源码编译环境
源码目录中的README文件
Windows:
--------Open a command prompt.
Ensure that the following tools can be found in the path:
* Supported compiler (Visual Studio 2012 or later,
MinGW-builds gcc 4.9 or later)
* Perl version 5.12 or later [http://www.activestate.com/activeperl/]
* Python version 2.7 or later [http://www.activestate.com/activepython/]
* Ruby version 1.9.3 or later [http://rubyinstaller.org/]cd <path>\<source_package>
configure -prefix %CD%\qtbase <license> -nomake tests
nmake // jom // mingw32-makeTo accelerate the bootstrap of qmake with MSVC, it may be useful to pass
"-make-tool jom" on the configure command line. If you do not use jom,
adding "/MP" to the CL environment variable is a good idea.More details follow.
Build!
======
一、安装VS2019
任意版本均可。
二、安装perl
根据自已操作系统选择32位还是64位,注意环境变量的填加。
三、安装python
四、安装Ruby
注意:版本最好与说明文件中一致,否则会导致编译出问题。
五、准备编译
解压源码后,在同目录新建一个build文件夹用于放置编译文件,避免和源码文件一起会改动源码结构。
64位编译
运行VS2019的编译窗口,cd切换至上面新建的build目录
F:\Qt\src\configure -confirm-license -opensource -release -static -static-runtime -nomake examples -nomake tests -skip qtwebengine -qt-zlib -qt-libjpeg -qt-libpng -qt-freetype -qt-pcre -qt-harfbuzz -qt-sqlite -opengl desktop -mp -prefix C:\Qt\5.15.2\msvc2019_64_static
这是我用的编译命令,编译没有报错。
32位编译同64位编译一样,只是换成vs2019 x86的编译窗口
F:\Qt\src\configure -confirm-license -opensource -release -static -static-runtime -nomake examples -nomake tests -skip qtwebengine -qt-zlib -qt-libjpeg -qt-libpng -qt-freetype -qt-pcre -qt-harfbuzz -qt-sqlite -opengl desktop -mp -prefix C:\Qt\5.15.2\msvc2019_32_static
接下来执行 nmake & nmake install
(使用jom的话用 jom -j xx &jom -j xx install
代替)
jom:下载地址 注意:要手动添加环境变量。
32位和64位我都编译过了,没有问题。
我只是编译了release版,如果要编译debug版,将命令中的-release换成-debug即可,同时编译debug版和release版,换成-debug-and-release即可。