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日 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM