therecipe/qt跨平台編譯


 

 

你只需使用M交叉環境(MXE)。它消除了整個過程中的痛苦:

  • 得到它: $ git clone https://github.com/mxe/mxe.git
  • 安裝構建依賴關系
  • 為Windows構建Qt及其依賴關系和跨構建工具; 這將需要大約一個小時的快速機器與體面的互聯網接入; 下載大約500MB: $ cd mxe && make qt
  • 轉到您的應用程序目錄並將交叉構建工具添加到PATH環境變量中: $ export PATH=<mxe root>/usr/bin:$PATH
  • 運行Qt Makefile生成器工具,然后構建: $ <mxe root>/usr/i686-pc-mingw32/qt/bin/qmake && make
  • 您應該在./release目錄中找到二進制文件: $ wine release/foo.exe

 

 

------------

  % qtdeploy build windows inwhtl
ERRO[0006] failed to run command                         _func=RunCmd cmd="/usr/lib/mxe/usr/i686-w64-mingw32.shared/qt5/bin/qmake -query QT_INSTALL_PREFIX" dir= env= error="fork/exec /usr/lib/mxe/usr/i686-w64-mingw32.shared/qt5/bin/qmake: no such file or directory" name="query install prefix path for windows on darwin"

交叉編譯環境MXE

 

 

mac to windows , ok

---------------------------------

 

docker pull therecipe/qt:windows_32_shared

 qtdeploy -docker build windows_32_shared

教程,GOPATH環境變量不知道怎么配,沒有找到教程。

https://github.com/therecipe/qt/wiki/Deploying-macOS-to-Windows-32-bit-Shared

 

交叉編譯,總結如下:(過程曲折啊,建議仔細看官方文檔和wiki,浪費了好多時間。3天,Linux和Mac,Windows都測試了,windows最難搞,不建議配置,建議使用linux開發,交叉編譯到windows)

1. 安裝QtCreate生成UI文件

2. 使用gouic轉化*.ui --> *.go文件,界面文件轉化為go源代碼

3. 下載therecipe/qt docker鏡像,使用命令編譯

4. 編譯成功的文件放置在deploy目錄下

 

## 動態庫鏈接和靜態鏈接方式對比

1. 動態鏈接,百十個文件依賴,可執行程序1.9M,總文件體積  71MB

2. 靜態鏈接,只生成1個exe可執行程序19MB

 

 

Deploying macOS to Windows 32 bit Static

 
therecipe edited this page on Oct 10, 2018 · 2 revisions
 

Docker deployment

docker pull therecipe/qt:windows_32_static
  • Deploy your application
qtdeploy -docker build windows_32_static

You should find your deployed application inside the deploy subfolder.

 

https://github.com/therecipe/qt/wiki/Deploying-macOS-to-Windows-32-bit-Static

 

 

Linux to windows

-----------------------

Deploying Linux to Windows 32 bit Static

 
therecipe edited this page on Mar 23, 2019 · 7 revisions
 

Docker deployment

docker pull therecipe/qt:windows_32_static
  • Deploy your application
qtdeploy -docker build windows_32_static


https://github.com/therecipe/qt/wiki/Deploying-Linux-to-Windows-32-bit-Static


免責聲明!

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



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