QT 5.0.0-RC1已经开始进入准发布的状态,默认提供msvc2010的二进制包。以下为用msvc2012编译的步骤:
0. 准备依赖的工具
下载并安装http://origin.releases.qt-project.org/digia/5.0.0_rc1/backups/2012-12-03-362/qt-windows-opensource-5.0.0-rc1-msvc2010_32-x86-offline-2012-12-03-362.exe
下载并安装perl和python
下载并安装http://sourceforge.net/projects/winflexbison/files/latest/download
注意:
屏蔽git或mingwin等中包含的较老版本的perl、python、flex、bison,否则会出错
将winflexbison的win_bison.exe重命名为bison.exe
1. 建立编译脚本*.bat
在Src目录中建立2个*.bat文件,分别为:
make.all.bat
cd qtbase
configure.bat -opensource -confirm-license -platform win32-msvc2012 -release -nomake testsnmake
cd ..
for %%d in (qtxmlpatterns qtjsbackend qtdeclarative qtmultimedia qtsvg qtquick1 qtscript qtgraphicaleffects qtimageformats qtdoc qttools qttranslations) do make.single.bat %%d
make.single.bat
cd %1
qmake %1.pro
nmake
cd ..
2. 编译qtbase及其它模块
在 VS2012 x86 Native Tools Command Prompt 中,
cd 到 Src 目录
make.all.bat
即可依照脚本中指定的选项编译出需要的QT SDK
注:qtwebkit未包含在内:官方正准备分拆这个库,且它依赖ICU,暂不在此研究。
3. 运行qtbase\examples
将Src\qtbase\bin添加到环境变量Path中
将 Microsoft Visual Studio 11.0\vc\bin\D3Dcompiler_46.dl拷贝到 Src\qtbase\bin 中,即可运行已经编译好的qtbase\examples。
4. 从源码qt-everywhere编译QTSDK
configure -prefix %CD%\qtbase -opensource -confirm-license -platform win32-msvc2012 -release -nomake tests
nmake