用msvc2012编译QT 5.0.0-RC1

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 为编译器启用并行编译选项。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值