安装编译工具:
1. MSVS2012:
2. WDK8
安装依赖库
1. ICU:ICU的库或者代码:http://site.icu-project.org/download/52#TOC-ICU4C-Download
如果想要自定义ICU的data,
a>到ICU网站定制数据文件:http://apps.icu-project.org/datacustom/ICUData50.html,把不需要的选项点掉后,点“Get Data Library”按钮下载定制的文件:“icudt51l.dat”
b>把“icudt51l.dat”文件复制到: icu/source/data/in 目录内,替换里面的文件。
2. OPENSSL:http://blog.csdn.net/rydiy/article/details/7710301
安装依赖的工具,安装的时候都要注意添加到系统path,会有对话框弹出的时候勾选即可:也可以参考QT源码中的ReadMe.txt来下载安装
1. Perl 5.8 or later
2. Python 2.7 or later
3. Ruby
amd64 http://rubyforge.org/frs/download.php/76806/rubyinstaller-2.0.0-p0-x64.exe
下载QT的源码:http://download.qt-project.org/official_releases/
进行编译脚本的配置:
echo off
@echo Setting Qt Build Env...
@CALL "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"
set QT5_DIR=D:\work\SDK\QT\5.1.1
set THIRDPARTY_DIR=D:\work\SDK\QT\ThirdParty
set JOM_DIR=D:\work\SDK\QT\Jom
@cd /d %QT5_DIR%\src
set INCLUDE=%THIRDPARTY_DIR%\icu\include;%THIRDPARTY_DIR%\openssl\openssl-1.0.1e\msvc2012\include;%INCLUDE%
set LIB=%THIRDPARTY_DIR%\icu\lib;%THIRDPARTY_DIR%\openssl\openssl-1.0.1e\msvc2012\lib;%LIB%
set PATH=%CD%\qtbase\bin;%CD%\gnuwin32\bin;%JOM_DIR%;C:\qttool\perl64\bin;C:\qttool\Python27;C:\qttool\Ruby200-x64\bin;%THIRDPARTY_DIR%\icu\bin;%THIRDPARTY_DIR%\openssl\openssl-1.0.1e\msvc2012\bin;C:\Program Files (x86)\Git\cmd;%PATH%
@echo Finished.
@echo Setting Qt configurate..
configure -prefix D:\work\SDK\QT\5.1.1\msvc2012 -opensource -confirm-license -platform win32-msvc2012 -developer-build -c++11 -icu -opengl desktop -openssl -nomake tests -nomake examples
@echo Setting Qt configurate Finished.
开始编译代码:
执行
jom
jom install
使用MSVS来编译开发QT程序:
1.安装qt-vs-addin.exe
2.在VS2008中设置QT
3.VS2008中多了一个QT选项 属性 点击Add添加QT的安装目录,这里是d:\Qt\qt4.5.2
4.开始QT程序
在VS2008中新建个QT Application工程,命名为HelloQT,新建完成后,在main.cpp中输入以下的内容
#include <QtGui/QApplication>
#include <QLabel>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLabel *label=new QLabel(" Hello Qt!");
label->show();
return app.exec();
}
运行一下,可以看到运行结果:
在进行configure设置,生成makefile,若没有使用ICU和openssl,则去掉-openssl -icu选项,这样生成makefile时会自动取消QtWebkit的编译
参考文献:
http://jjdoor.blog.163.com/blog/static/184780342013426104331989/