Discussion QQ Group: 135202158
1. Why do you do this?
Under Windows, the QT official website provides a binary version that is mostly 32-bit, and currently (2015.01.24) only provides a 64-bit version of VS2013, as shown in:
In order to adapt to my current installation of the VS2010 IDE, but also in order to compile specific libraries and plugins according to their needs (such as removing webkit, etc.), need to compile QT directly from the source code.
This example compiles the Qt5.3.2 version and should also be applied to Qt5.4.0.
2. Preparation
First of all, of course need a C + + compiler, for some compatibility reasons, I need to use Visual C + + 2010, can also use MinGW. With mingw words also to debugging helpful, this is something.
In addition, compiling QT on Windows requires some libraries, see http://doc.qt.io/qt-5/windows-requirements.html.
Because I do not need 3D graphics, WebKit and other support, so do not need to OpenGL, ANGLE, ICU, such as a heap of libraries, only need the following 3 compile-time tools to use (not required at runtime):
- Activeperl-install A recent version of ActivePerl (download page) and add the installation location to your
PATH
.
- Python-install Python from the "Here" and the "add" installation location to your "PATH in order to being able to build Qt Webki T.
- Install Ruby from here and add the installation location to your PATH in order to be able to build Qt WebKit.
Download the 3 gadgets and install them.
3. Compiling
Extract the downloaded QT source to directory <qtdir>, and then create a batch file under this directory root, with the following content:
@echo offECHOSet Visual Studio Environment ...Pager"C:\Program Files (x86) \microsoft Visual Studio 10.0\vc\vcvarsall.bat"Amd64titleCommand Prompt(msvc++ 2010)x64SETQtsrc_dir=h:\qt-msvc2010-x64SETQmakespec=win32-msvc2010SET PATH=%PATH%;%qtsrc_dir%\qtbase\bin;%qtsrc_dir%\gnuwin32\binSET PATH=%PATH%; C:\Python27; C:\Perl64\bin; C:\Ruby21-x64\bin;ECHOPress any key to configure ...@PAUSE>NULPagerCONFIGURE-OPENSOURCE-MP-Debug-and-release-nomake examples-no-opengl-no-angle-skip qtquick1-skip qtquickcontrols-skip qtsensors-skip Qtwebkit ECHOPress any key to start compiling ...@PAUSE>NULPagerJom.exe-j 4REMTo reconfigure and compile, use theREMnmake Distclean or jom cleanGoto : EOF
Which set up the VC + + environment variables, source directory, the necessary tools to execute the directory and so on;
The modules that need to be compiled and the modules that do not need to be compiled are set through configure. By prohibiting unnecessary compilation modules, the compilation speed can be greatly accelerated;
Jom.exe-j 4 Specifies that 4 threads are used for parallel compilation.
Write the Save as bat file and execute it at the command line.
"Qt" VS2010 compiled Qt5.3.2 64bit