我是靠谱客的博主 精明超短裙,这篇文章主要介绍qt之InstallerFramework:程序打包,现在分享给大家,希望可以做个参考。

Qt installer framework

  • 下载framework,安装(/Qt/QtIFW-3.0.2/examples目录下有很多实例)官网使用说明
  • 使用framework(以examples中的tutorial为例)

1. 创建安装包目录树

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
tutorial ├── config │ └── config.xml └── packages └── com.vendor.product ├── data │ └── installcontent.txt └── meta ├── installscript.qs ├── license.txt ├── package.xml └── page.ui

2. 创建配置文件

(即/tutorial/config/config.xml)

复制代码
1
2
3
4
5
6
7
8
9
<?xml version="1.0" encoding="UTF-8"?> <Installer> <Name>Your application</Name> <Version>1.0.0</Version> <Title>Your application Installer</Title> <Publisher>Your vendor</Publisher> <StartMenuDir>Super App</StartMenuDir> <!--windows开始菜单中的分组--> <TargetDir>@HomeDir@/InstallationDirectory</TargetDir> <!--默认安装位置--> </Installer>

主要是修改 [1] -- <Titile> [2] -- <Name>

这里写图片描述

3. 创建安装包信息文件

(即/tutorial/packages/com.vendor.product/meta/package.xml)

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="UTF-8"?> <Package> <DisplayName>The root component</DisplayName> <Description>Install this example.</Description> <Version>0.1.0-1</Version> <ReleaseDate>2010-09-21</ReleaseDate> <Licenses> <License name="Beer Public License Agreement" file="license.txt" /> </Licenses> <Default>script</Default> <Script>installscript.qs</Script> <!--installscript.qs脚本定制安装过程--> <UserInterfaces> <UserInterface>page.ui</UserInterface> <!--界面资源文件--> </UserInterfaces> </Package>

主要修改[1] -- <DisplayName> [2] -- <Description>

这里写图片描述

[1] – 具体的文件描述在/tutorial/packages/com.vendor.product/meta/license.txt

这里写图片描述

/tutorial/packages/com.vendor.product/meta/package.xmlinstallscript.qs示例

复制代码
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
function Component() { // constructor component.loaded.connect(this, Component.prototype.loaded); if (!installer.addWizardPage(component, "Page", QInstaller.TargetDirectory)) console.log("Could not add the dynamic page."); } Component.prototype.isDefault = function() { // select the component by default return true; } Component.prototype.createOperations = function() { try { // call the base create operations function component.createOperations(); } catch (e) { console.log(e); } } Component.prototype.loaded = function () { var page = gui.pageByObjectName("DynamicPage"); if (page != null) { console.log("Connecting the dynamic page entered signal."); page.entered.connect(Component.prototype.dynamicPageEntered); } } Component.prototype.dynamicPageEntered = function () { var pageWidget = gui.pageWidgetByObjectName("DynamicPage"); if (pageWidget != null) { console.log("Setting the widgets label text.") pageWidget.m_pageLabel.text = "This is a dynamically created page."; } }

4. 创建安装内容

(即/tutorial/packages/com.vendor.product/data/installcontent.txt)

实际要打包的程序文件(.dll, .exe等)存放于该目录(data)下

5. 创建可执行文件

(当前目录在tutorial下)

复制代码
1
../../bin/binarycreator -c config/config.xml -p packages YourInstaller

6. 实际操作

  • 将要打包的工程使用 release 模式编译
  • 使用ldd命令查找相关依赖,将依赖文件也置于同一文件下
  • 将release下的依赖文件以及可执行程序文件拷贝到data目录下
  • 使用binarycreator命令行直接生成安装包

参考链接

最后

以上就是精明超短裙最近收集整理的关于qt之InstallerFramework:程序打包的全部内容,更多相关qt之InstallerFramework内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(70)

评论列表共有 0 条评论

立即
投稿
返回
顶部