本文连接:https://blog.csdn.net/zhengtianzuo06/article/details/78468111
通用:
1.准备图标
图标能够直接使用通常格式的图片制做, 好比jpg, png等
推荐使用Photoshop制做原始图linux
推荐使用IconWorkshop制做图标, 很是的方便android
Windows和Linux的程序图标, 制做ico格式图标web
MacOS制做icns格式图标sql
Android和IOS直接使用Pngjson
2.准备License文件, readme说明等bash
程序发布:
1.Windows:websocket
准备程序版权版本等信息app
Qt中图标及版本信息的设置, 能够参考我以前的发布项目例子
QmlVersionInfosocket
Release编译:svg
选择项目
选择Release编译
生成好的目录
清除多余的中间文件
qt提供了专门的部署工具, windeployqt:
Usage: windeployqt [options] [files]
Qt Deploy Tool 5.9.0
The simplest way to use windeployqt is to add the bin directory of your Qt
installation (e.g. <QT_DIR\bin>) to the PATH variable and then run:
windeployqt <path-to-app-binary>
If ICU, ANGLE, etc. are not in the bin directory, they need to be in the PATH
variable. If your application uses Qt Quick, run:
windeployqt --qmldir <path-to-app-qml-files> <path-to-app-binary>
Options:
-?, -h, --help Displays this help.
-v, --version Displays version information.
--dir <directory> Use directory instead of binary directory.
--libdir <path> Copy libraries to path.
--plugindir <path> Copy plugins to path.
--debug Assume debug binaries.
--release Assume release binaries.
--pdb Deploy .pdb files (MSVC).
--force Force updating files.
--dry-run Simulation mode. Behave normally, but do not
copy/update any files.
--no-patchqt Do not patch the Qt5Core library.
--no-plugins Skip plugin deployment.
--no-libraries Skip library deployment.
--qmldir <directory> Scan for QML-imports starting from directory.
--no-quick-import Skip deployment of Qt Quick imports.
--no-translations Skip deployment of translations.
--no-system-d3d-compiler Skip deployment of the system D3D compiler.
--compiler-runtime Deploy compiler runtime (Desktop only).
--no-compiler-runtime Do not deploy compiler runtime (Desktop only).
--webkit2 Deployment of WebKit2 (web process).
--no-webkit2 Skip deployment of WebKit2.
--json Print to stdout in JSON format.
--angle Force deployment of ANGLE.
--no-angle Disable deployment of ANGLE.
--no-opengl-sw Do not deploy the software rasterizer library.
--list <option> Print only the names of the files copied.
Available options:
source: absolute path of the source files
target: absolute path of the target files
relative: paths of the target files, relative
to the target directory
mapping: outputs the source and the relative
target, suitable for use within an
Appx mapping file
--verbose <level> Verbose level.
Qt libraries can be added by passing their name (-xml) or removed by passing
the name prepended by --no- (--no-xml). Available libraries:
bluetooth concurrent core declarative designer designercomponents
enginio gui qthelp multimedia multimediawidgets multimediaquick network nfc
opengl positioning printsupport qml qmltooling quick quickparticles quickwidgets
script scripttools sensors serialport sql svg test webkit webkitwidgets
websockets widgets winextras xml xmlpatterns webenginecore webengine
webenginewidgets 3dcore 3drenderer 3dquick 3dquickrenderer 3dinput geoservices
webchannel texttospeech serialbus
Arguments:
[files] Binaries or directory containing the binary.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
使用很是的方便, 命令行cd到程序的生成目录
windeployqt.exe --qmldir C:\release\QmlVersionInfo QmlVersionInfo.exe
这里演示的是qml程序的打包, 因此带有 --qmldir 参数 内容是指向项目中qml的文件夹路径, 这样可让Qt识别运行项目里qml文件须要的QtQuick库.
生成好的目录状况就是这样, 若是程序还须要一些动态库, 插件, 须要本身加入进去.
而后基本就可使用安装程序进行打包了.
2.Android:
准备程序版权版本等信息
选择项目
首先在Build Android APK中建立模板
这里能够填写App包名, 程序版本号, SDK版本号, 程序名称等
点击下面的三个小方块按钮, 分别设置不一样分辨率的程序图标
选择Release编译
Qt提供了专门的部署工具, androiddeployqt: 编译时自动调用
在生成目录的android-build\bin下能够看到已经生成好的QtApp-debug.apk
3.IOS:
4.MacOS:
5.Linux:
Release编译:
选择项目
选择Release编译
生成好的目录
这个时候须要解决依赖库的问题, 咱们使用linuxdeployqt
GitHub地址: linuxdeployqt
下载源码 并解压使用Qt Creator编译Release版本便可, 生成的应用程序拷贝到bin目录下
sudo mv linuxdeployqt /usr/local/bin
下载安装patchelf patchelf-0.9.tar.gz
设置Qt的环境变量:
sudo gedit ~/.bashrc
1
加上
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
1
2
让其生效
source ~/.bashrc
1
而后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 it
self-contained by copying in the Qt libraries and plugins that
the application uses.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
例如:
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 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 未完待续… ———————————————— 版权声明:本文为CSDN博主「zhengtianzuo」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处连接及本声明。 原文连接:https://blog.csdn.net/zhengtianzuo06/article/details/78468111