QT 原始碼編譯 (zz)

2021-06-01 09:35:19 字數 3760 閱讀 7620

from: 

c/c++ code

一、編譯動態發布版

修改編譯選項(mkspecs\win32

-msvc2010\qmake.conf):

qmake_cflags_release =-

o2 -

os -

gl -

mdqmake_cflags_release_with_debuginfo +=-

o2 -

os -

gl -

md -

ziqmake_lflags_release =/

incremental:no

/opt:ref

/opt:icf

qmake_lflags_release_with_debuginfo =/

incremental:no

/debug

/opt:ref

/opt:icf

修改完成後,備份qmake.conf,然後:

1. 替換所有「

-zi」和「

/debug」為空,目的是編譯qt庫時不生成pdb檔案

2. 替換所有「

-ehsc」為空,目的是編譯qt自身時禁用異常

配置:configure

-confirm

-license

-opensource

-prefix d:\qpsoft\devx86\qt

-debug

-and

-release

-shared

-platform win32

-msvc2010

-fast -no

-stl -no

-qt3support

-nomake demos

-nomake examples

-nomake translations

編譯安裝:

1. 拷貝目錄mkspecs至d:\qpsoft\devx86\qt

2. nmake

&&nmake install

3. 編譯qdoc3的release版本

cd tools

&&cd qdoc3

&&nmake release

-all

&© /b

/y ..\..\bin\qdoc3.exe d:\qpsoft\devx86\qt\bin

&&cd ..\..

私有標頭檔案:

xcopy /s

/i include\qtcore\

*_p.h ..\include\qtcore

xcopy /s

/i include\qtgui\

*_p.h ..\include\qtgui

xcopy /s

/i include\qtscript\

*_p.h ..\include\qtscript

xcopy /s

/i include\qtdeclarative\

*_p.h ..\include\qtdeclarative

xcopy /s

/i src\corelib\

*_p.h ..\src\corelib

xcopy /s

/i src\gui\

*_p.h ..\src\gui

xcopy /s

/i src\script\

*_p.h ..\src\script

xcopy /s

/i src\declarative\

*_p.h ..\src\declarative

在qt原始碼目錄中執行上述命令,之後將..\include和..\src目錄拷貝到d:\qpsoft\devx86\qt中!

推薦通過乙個批處理(

private

.bat)來完成這個工作。

演示與示例:

1. 重新配置

configure

-confirm

-license

-opensource

-prefix d:\qpsoft\devx86\qt

-debug

-shared

-platform win32

-msvc2010

-fast -no

-stl -no

-qt3support

-nomake translations

2. 編譯安裝

cd demos

&&nmake

&&nmake install

&&cd ..

&&cd examples

&&nmake

&&nmake install

&&cd ..

3. 編譯qtdemo的release版本

cd demos

&&cd qtdemo

&&nmake release

-all

&© /b

/y ..\..\bin\qtdemo.exe d:\qpsoft\devx86\qt\bin

&&cd ..\..

後期處理:

1. 清除重複的dll(將qt\lib目錄中的dll全部刪除)

2. 清除多餘的幫助文件(先執行qt\bin\assistant.exe,以便更新qt\doc\pch;然後刪除qt\doc\src和qt\doc\html)

3. 恢復qmake.conf,恢復「

-zi」、「

/debug」選項以及「

-ehsc」選項

4. 刪除demos目錄下

*.exe

5. 刪除examples目錄下所有

*debug*、

*release*及

*.exe

6. 為demos和examples目錄下所有檔案新增唯讀屬性

二、編譯靜態正式版

修改編譯選項(mkspecs\win32

-msvc2010\qmake.conf):

qmake_cflags_release =-

o2 -

os -

gl -

mtqmake_cflags_release_with_debuginfo +=-

o2 -

os -

gl -

mt -

ziqmake_lflags_release =/

incremental:no

/opt:ref

/opt:icf

qmake_lflags_release_with_debuginfo =/

incremental:no

/debug

/opt:ref

/opt:icf

配置及編譯:

1. 備份qmake.conf,之後替換所有「

-ehsc」為空,目的是編譯qt自身時禁用異常

2. configure

-confirm

-license

-opensource

-release

-platform win32

-msvc2010

-fast

-static-no

-stl -no

-qt3support

3. nmake

4. 恢復qmake.conf

QT原始碼編譯

cd 到原始碼資料夾 先用qt自帶的msvc2015進行qmake生成makefile 在使用vs2015的x86本機命令提示符進行nmake,若安裝了jom則使用jom j8 最後進行nmake install或者jom install cd 到原始碼資料夾 執行qmake生成makefile 執...

編譯Qt4 8 5原始碼

1.解壓 tar zxvf qt everywhere opensource src 4.8.5.tar.gz 2.進入目錄 3.配置,configure 此步一般會檢測原始碼編譯所需的依賴。見錯誤1 4.make 5.make install 錯誤1.basic xlib functionalit...

海思hisi 編譯QT原始碼

tar zxvf qt everywhere opensource src 4.8.5.tar.gz 我用4.8.5 進入目錄下 cd qt everywhere opensource src 4.8.5 mkspecs qws linux arm g 編輯 qmake.conf vi qmake....