Qt程式各個平臺打包釋出及安裝程式大全
Linux:需要解決依賴庫的問題, 我們使用linuxdeployqt
GitHub地址: linuxdeployqt
下載原始碼 並解壓使用Qt Creator編譯Release版本即可, 生成的應用程式拷貝到bin目錄下
sudo mv linuxdeployqt /usr/local/bin
下載安裝patchelf patchelf-0.9.tar.gz
設定Qt的環境變數:
sudo gedit ~/.bashrc 加上
export PATH=/opt/Qt5.9.2/5.9.2/gcc_64/bin:$PATH
export LD_LIBRARY_PATH=/opt/Qt5.9.2/5.9.2/gcc_64/lib:$LD_LIBRARY_PATH
讓其生效
source ~/.bashrc
然後cd到專案生成位置使用linuxdeployqt生成依賴庫, 命令格式:Usage: linuxdeployqt app-binary [options]
Options:
-verbose=<0-3> : 0 = no output, 1 = error/warning (default), 2 = normal, 3 = debug
-no-plugins : Skip plugin deployment
-appimage : Create an AppImage
-no-strip : Don't run 'strip' on the binaries
-bundle-non-qt-libs : Also bundle non-core, non-Qt libraries
-executable=<path> : Let the given executable use the deployed libraries too
-qmldir=<path> : Scan for QML imports to bundle from the given directory, determined by Qt's qmlimportscanner
-always-overwrite : Copy files even if the target file exists
-qmake=<path> : The qmake executable to use
-no-translations : Skip deployment of translations
linuxdeployqt takes an application as input and makes itself-contained by copying in the Qt libraries and plugins that the application uses.例如:
linuxdeployqt QmlVersionInfo -qmldir=/home/tianzuo/Programming/WorkSpace/QmlVersionInfo
這裡寫圖片描述
生成好的目錄情況就是這樣, 如果程式還需要一些動態庫, 外掛, 需要自己加入進去.
然後基本就可以使用安裝程式進行打包了.
安裝程式製作:
1.Windows:
建立桌面和開始選單快捷方式:
參考我之前寫的博文: Qt建立桌面和開始選單快捷方式
2.Android:
3.IOS:
4.MacOS:
5.Linux:
建立桌面快捷方式:
這裡以Ubuntu為背景介紹下,
新建一個*.desktop檔案, 內容如下:
[Desktop Entry]
Categories=Development;
Comment[zh_CN]=
Comment=
Exec=/home/tianzuo/Programming/WorkSpace/QmlVersionInfo/QmlVersionInfo
GenericName[zh_CN]=Qt
GenericName=Qt
Icon=/home/tianzuo/Programming/WorkSpace/QmlVersionInfo/logo.ico
MimeType=
Name[zh_CN]=QmlVersionInfo
Name=QmlVersionInfo
Path=
StartupNotify=true
Terminal=false
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=owen
---------------------
作者:zhengtianzuo
來源:CSDN
原文:https://blog.csdn.net/zhengtianzuo06/article/details/78468111