Qt程序各个平台打包发布及安装程序大全
来源:互联网 发布:javascript编程入门 编辑:程序博客网 时间:2024/06/11 05:06
通用:
1.准备图标
图标可以直接使用一般格式的图片制作, 比如jpg, png等
推荐使用Photoshop制作原始图
推荐使用IconWorkshop制作图标, 非常的方便
Windows和Linux的程序图标, 制作ico格式图标
MacOS制作icns格式图标
Android和IOS直接使用Png
2.准备License文件, readme说明等
程序发布:
1.Windows:
准备程序版权版本等信息
Qt中图标及版本信息的设置, 可以参考我之前的发布项目例子
QmlVersionInfo
Release编译:
选择项目
选择Release编译
生成好的目录
清除多余的中间文件
qt提供了专门的部署工具, windeployqt:
Usage: windeployqt [options] [files]Qt Deploy Tool 5.9.0The simplest way to use windeployqt is to add the bin directory of your Qtinstallation (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 PATHvariable. 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 passingthe name prepended by --no- (--no-xml). Available libraries:bluetooth concurrent core declarative designer designercomponentsenginio gui qthelp multimedia multimediawidgets multimediaquick network nfcopengl positioning printsupport qml qmltooling quick quickparticles quickwidgetsscript scripttools sensors serialport sql svg test webkit webkitwidgetswebsockets widgets winextras xml xmlpatterns webenginecore webenginewebenginewidgets 3dcore 3drenderer 3dquick 3dquickrenderer 3dinput geoserviceswebchannel texttospeech serialbusArguments: [files] Binaries or directory containing the binary.
使用非常的方便, 命令行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
加上
export PATH=/opt/Qt5.9.2/5.9.2/gcc_64/bin:$PATHexport 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 translationslinuxdeployqt takes an application as input and makes itself-contained by copying in the Qt libraries and plugins thatthe 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/QmlVersionInfoGenericName[zh_CN]=QtGenericName=QtIcon=/home/tianzuo/Programming/WorkSpace/QmlVersionInfo/logo.icoMimeType=Name[zh_CN]=QmlVersionInfoName=QmlVersionInfoPath=StartupNotify=trueTerminal=falseType=ApplicationX-DBUS-ServiceName=X-DBUS-StartupType=X-KDE-SubstituteUID=falseX-KDE-Username=owen
未完待续…..
- Qt程序各个平台打包发布及安装程序大全
- Qt程序各个平台打包发布及安装程序大全
- Qt 打包依赖 及发布安装程序
- 【Qt】打包发布安装程序
- Windows平台下QT程序打包发布
- windows平台QT程序发布打包
- QT 基础知识及程序打包发布
- 打包发布qt程序
- QT程序打包发布
- QT程序打包发布
- Qt 程序打包发布
- Qt程序打包发布
- QT程序发布打包
- Qt程序打包发布
- Qt程序打包发布
- Qt程序打包发布
- Qt程序打包发布
- QT程序打包发布
- ora-01033:oracle initialization or shutdown in progress
- Spring Boot整合Druid连接池开启数据库监控功能
- 免费:Android Studio3.0输入法输入中文卡顿情况方案
- Kafka学习笔记一:基本概念
- 分布式系统(1)
- Qt程序各个平台打包发布及安装程序大全
- 连接Redis异常:JedisMovedDataException
- Python爬虫学习---5分钟掌握正则表达式
- centos7安装网易云音乐
- 发布aar(包含源码)到Github上供别人依赖引用
- c语言:常量,变量及其存储方式小结
- SQL Server 表分区
- 【转】JavaScript从数组中删除指定值元素的方法
- 表格添加与删除