1. 程式人生 > 其它 >編譯Qt原始碼

編譯Qt原始碼

一、

1.安裝mMingW-w64

2.安裝ActivePerl

3.安裝python

4.下載Qt原始碼

 參考:https://zhuanlan.zhihu.com/p/40271922

二、

以下指令碼編譯5.12.0版本成功了,在高的版本沒有成功。

QtSrcDir : qt的原始碼路徑

QtPrefixDir : 目標資料夾及路徑

MingwDir : MinGW-w64的安裝路徑

BuildType : 構建Qt的型別

@echo off
rem ====================CONFIGURE BEFORE RUN SCRIPT!!======================
set
QtSrcDir=%CD% set QtPrefixDir=D:\ProgramFiles\Qt\qt5.12.0 set MingwDir=D:\ProgramFiles\mingw64\ set BuildType=-debug-and-release set QtSPEC=win32-g++ set LANG = en rem ======================================================================= PATH = %MingwDir%\bin;%MingwDir%\opt\bin;%SystemRoot%\system32;%SystemRoot% set
QT_INSTALL_PREFIX = %QtStaticDir% set OldDir=%CD% cd %QtSrcDir% cmd /C "configure.bat -shared %BuildType% -platform %QtSPEC% -prefix %QtPrefixDir% -opensource -confirm-license -c++std c++14 -nomake examples -skip wayland -skip purchasing -skip serialbus -skip qtserialport -skip script -skip scxml -skip speech -skip location -no-opengl -qt-zlib -qt-pcre -qt-libpng -no-libjpeg -qt-freetype -no-openssl
" if ERRORLEVEL 1 goto :error mingw32-make -r -k -s -j4 if ERRORLEVEL 1 goto :error mingw32-make -k install if ERRORLEVEL 1 goto :error set FILE_TO_PATCH=%QtPrefixDir%\mkspecs\win32-g++\qmake.conf echo.>>%FILE_TO_PATCH% echo CONFIG += static>>%FILE_TO_PATCH% echo ============BUILT!============ goto exitX :error echo ============ERROR!============ :exitX pause cd %OldDir%