转自: http://blog.csdn.net/zhengtianzuo06/article/details/78468111
通用:
1.准备图标
图标可以直接使用一般格式的图片制作, 比如jpg, png等
推荐使用Photoshop制作原始图
![这里写图片描述](https://img-blog.csdn.net/20171107144107658?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhlbmd0aWFuenVvMDY=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
推荐使用IconWorkshop制作图标, 非常的方便
![这里写图片描述](https://img-blog.csdn.net/20171107144232425?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhlbmd0aWFuenVvMDY=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
Windows和Linux的程序图标, 制作ico格式图标
![这里写图片描述](https://img-blog.csdn.net/20171107145929499?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhlbmd0aWFuenVvMDY=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
MacOS制作icns格式图标
![这里写图片描述](https://img-blog.csdn.net/20171107150015074?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhlbmd0aWFuenVvMDY=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
Android和IOS直接使用Png
2.准备License文件, readme说明等
程序发布:
1.Windows:
准备程序版权版本等信息
![这里写图片描述](https://img-blog.csdn.net/20171107150748343?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhlbmd0aWFuenVvMDY=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
Qt中图标及版本信息的设置, 可以参考我之前的发布项目例子
QmlVersionInfo
Release编译:
选择项目
选择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
Options:
-?, -h,
-v,
copy/update any files.
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
Qt libraries can be added by passing their name (-xml) or removed by passing
the name prepended by
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库.
![这里写图片描述](https://img-blog.csdn.net/20171107153640037?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhlbmd0aWFuenVvMDY=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
![这里写图片描述](https://img-blog.csdn.net/20171107154108743?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhlbmd0aWFuenVvMDY=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
生成好的目录情况就是这样, 如果程序还需要一些动态库, 插件, 需要自己加入进去.
然后基本就可以使用安装程序进行打包了.
2.Android:
准备程序版权版本等信息
选择项目
![这里写图片描述](https://img-blog.csdn.net/20171110152008408?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhlbmd0aWFuenVvMDY=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
首先在Build Android APK中创建模板
![这里写图片描述](https://img-blog.csdn.net/20171110152231531?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhlbmd0aWFuenVvMDY=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
这里可以填写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
加上
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 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
![这里写图片描述](https://img-blog.csdn.net/20171110163817264?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhlbmd0aWFuenVvMDY=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
生成好的目录情况就是这样, 如果程序还需要一些动态库, 插件, 需要自己加入进去.
然后基本就可以使用安装程序进行打包了.
安装程序制作:
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