用msvc2012编译QT 5.0.0RC1 BlueEngine的专栏 博客频道 CSDN.NET

用msvc2012编译QT 5.0.0-RC1 - BlueEngine的专栏 - 博客频道 - CSDN.NET

用msvc2012编译QT 5.0.0-RC1

180人阅读 评论(2) 收藏 举报

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 tests
nmake
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

下载qt-everywhere如:http://releases.qt-project.org/qt5.0/rc1/single/qt-everywhere-opensource-src-5.0.0-rc1.tar.gz 并解压缩
参照其中的READER文件:
cd <path>\qt-everywhere-opensource-src-<version>
configure -prefix %CD%\qtbase -opensource -confirm-license -platform win32-msvc2012 -release -nomake tests
nmake
注:
a. 此处可能会出现找不到\qtbase\configure.exe的错误(比如已经正式发布的5.0RC1源码包),经查发现问题出在qtbase\configure.bat第45行
if not exist %QTSRC%\.gitignore goto sconf
注释掉该行或者创建一个名为.gitignore的文件均可(创建该.gitignore文件可使用命令行如copy .tag .gitignore);
b. 为加速编译(尤其是在多核机器上),可通过 set CL=/MP 为编译器启用并行编译选项。
原文地址:https://www.cnblogs.com/lexus/p/2828728.html