AECSoft

专注于AEC行业软件开发15年

导航

windows下编译QT5.0.1(MinGW篇)

不解释,只罗列步骤。求解释者直接跳到最后“引用”节。

1, 需要安装的程序:
  ActivePerl -- 必须安装 且版本>=5.14   地址:http://www.activestate.com/activeperl/downloads
  DirectX SDK 9 以上-- 如果使用ANGLE
  Python -- 如果编译WebKit >=2.6.x   地址: http://www.python.org/download/releases/
  Rubby -- 如果编译 WebKit               地址: http://www.rubyinstaller.org/
  Bison, Flex, Gperf -- 如果使用ANGLE

2,使用MinGW编译QT5.0.1

下载MingGW,32位64位

下载QT5.0.1源码压缩包 http://releases.qt-project.org/qt5/5.0.1/single/qt-everywhere-opensource-src-5.0.1.zip

将压缩包解压至D:\QT5\Src

运行cmd.exe,在命令行下依次运行:

cd D:\QT5\Src
set PATH=C:\Python27;C:\Perl\bin;C:\mingw\bin;
configure.bat -debug -opensource -confirm-license -platform win32-g++ -prefix "d:\qt5\qt5-my-build" -opengl desktop -nomake tests -c++11
mingw32-make
mingw32-make install

 最后在d:\qt5\qt5-my-build目录下会生成编译好的DLL和LIB,以及头文件。

3,编译注意事项:

1), 运行configure, 出现下列errors:
   creating qmake... execute:unknown error (-f) (makefile)
   原因是找不到合适的mingw32-g++。

   解决方法:检查是否设置的正确的PATH值。或者安装的MinGW版本不对,是否32位操作系统需要安装32位的MinGW,64位需要64的。


2), 运行configure, 出现下列errors:
   cc1plus.exe: error: unrecognized command line option ?fno-keep-inline-dllexport?
   
   解决方法:是否MinGW>=4.7.

3), For windows, if don't use OpenGL or QtQuick2 then use "-opengl desktop" to avoid to use ANGLE。缺省状态下在Windows下编译时,默认使用ANGLE。

4), 如果以前编译好了,在任何时候都可以直接在cmd.exe窗口中运行mingw32-make install以生成备用的DLL(需CD进入D:\QT5\Src下)


4, 在QtDesigner中使用自己编译的QT5库

打开TOOLS\Options对话框,选择Build&Run中的Qt Versions,点击右侧的ADD按钮,在打开的对话框中选择D:\Qt\qt-my-build\bin\qmake.exe, 命名为MyBuildQT5.

在Kits页,点击右侧的ADD按钮,添加一个编译配置项,命名为MinGW with my build QT5。

  •        QT Version选择MyBuildQT5,
  •        Compiler选择MinGW(x86 32bit)或者64位操作系统中选择MinGW(x86 64bit)
  •        点击Debuger右侧的mange,选择autodetect,不出意外的话会自动找到C:\mingw\bin\gdb.exe.

这样,在新建Project时,就可以选择MinGW with my build QT5作为编译配置。

5,只编译某个模块

编译完以后,在任何时候都可以进入源码目录进行重新编译,如果只想编译其中一个模块,可以使用如下命令(以qtbase为例),

mingw32-make module-qtbase

 可选的模块为:

		module-qtbase \
		module-qtsvg \
		module-qtxmlpatterns \
		module-qtjsbackend \
		module-qtdeclarative \
		module-qtscript \
		module-qtmultimedia \
		module-qtactiveqt \
		module-qttools \
		module-qtquick1 \
		module-qtimageformats \
		module-qtgraphicaleffects \
		module-qttranslations \
		module-qtdoc

 

6, References:
   http://qt-project.org/wiki/Building_Qt_5_from_Git
   http://qt-project.org/doc/qt-5.0/qtdoc/requirements-win.html
   http://blog.qt.digia.com/blog/2012/10/24/graphics-on-windows-from-a-different-angle/  
   About MinGW: http://qt-project.org/wiki/MinGW-64-bit

   一个很好的Pre-Build版本,有动态有静态: http://files.quickmediasolutions.com/qt5/

 

GOOD LUCK!

ZUOC,2013年3月22日 

posted on 2013-03-22 23:00  zuoc  阅读(4396)  评论(0编辑  收藏  举报