qt 安装包生成2
使用Qt Installer Framework制作安装包
步骤
制作安装包的步骤:
- 去官网下载Qt Installer Framework的安装包并安装(已经安装的请跳过这步)
- 使用windeployqt.exe集齐所需依赖
- 使用binarycreator.exe创建安装包
具体操作流程:
安装Qt Installer Framework
下载地址:http://download.qt.io/official_releases/qt-installer-framework/

搜集依赖
- 使用Release模式构建项目

- 在release目录下删掉不必要的文件

- 运行windeployqt.exe命令
[windeployqt.exe路径] --release --qml --qmldir [qml源码路径] [exe文件路径]
- 1

如在我的环境下是
D:\Qt\Qt5.11.0\5.11.0\mingw53_32\bin\windeployqt.exe --release --qml --qmldir D:\src\qml\huorong\ huorong.exe
- 1
- 手动拷贝其他的dll
我使用的是mingw53_32,需要拷贝以下文件
libgcc_s_dw2-1.dll libstdc++-6.dll libwinpthread-1.dll

创建安装包
- 将上面搜集的依赖拷贝到
installer\packages\cn.net.pikachu.huorong\data文件夹下
- 运行binarycreator.exe命令
[binarycreator.exe路径] -c [config.xml路径] -p [packages路径] [生成的安装程序exe文件名] -v
- 1

如在我的环境下是
D:\Qt\QtIFW-3.0.4\bin\binarycreator.exe -c installer/config/config.xml -p installer/packages huorong_install.exe -v
- 1
最后的演示效果

思考与总结
如果Qt提供一键生成安装包就好了,何必这么麻烦呢?应该可以把这些操作用脚本写好,然后集成到QtCreator中。
附:
配置文件
config.xml
<?xml version="1.0" encoding="UTF-8"?>
<Installer>
<Name>火绒安全软件</Name>
<Version>0.1.0</Version>
<Title>火绒安全软件</Title>
<Publisher>大黄老鼠</Publisher>
<!-- Directory name is used in component.xml -->
<StartMenuDir>pikachu</StartMenuDir>
<TargetDir>@HomeDir@/pikachu/huorong</TargetDir>
</Installer>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
package.xml
<?xml version="1.0" encoding="UTF-8"?>
<Package>
<DisplayName>火绒安全软件</DisplayName>
<Description>可执行文件</Description>
<Version>0.1.0-1</Version>
<ReleaseDate>2018-07-01</ReleaseDate>
<Default>true</Default>
<Script>installscript.qs</Script>
<ForcedInstallation>true</ForcedInstallation>
</Package>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
installscript.qs
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the FOO module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
function Component()
{
// default constructor
}
Component.prototype.createOperations = function()
{
// call default implementation to actually install README.txt!
component.createOperations();
if (systemInfo.productType === "windows") {
component.addOperation("CreateShortcut", "@TargetDir@/huorong.exe", "@StartMenuDir@/火绒安全软件.lnk",
"workingDirectory=@TargetDir@", "iconPath=%SystemRoot%/system32/SHELL32.dll",
"iconId=2", "description=Open README file");
component.addOperation("CreateShortcut", "@TargetDir@/huorong.exe", "@HomeDir@/Desktop/火绒安全软件.lnk");
component.addOperation("CreateShortcut", "@TargetDir@/maintenancetool.exe", "@StartMenuDir@/更新或卸载 火绒安全软件.lnk");
}
qt 安装包生成2的更多相关文章
- qt 安装包生成
(Qt Installer Framework)程序简易打包教程 2017年06月19日 14:38:47 carman_风 阅读数:3559 标签: installerqt框架 更多 个人分类: 软 ...
- Linux安装包生成工具:checkinstall、makeself
关键词:checkinstall.dpkg.deb/rpm.makeself等等. checkinstall记录make install安装的文件,生成相应的(Slackware/RPM/Debian ...
- VS2008 Windows Form项目安装包生成详解
2008 Windows Form项目的发布对有经验的程序员来说,可能不值一提,但对很多新手来说却不知道如何操作,因为在很多关于Visual Studio的书籍中也没有相关介绍,权威如<C# 2 ...
- 下载Qt安装包
http://download.qt.io/archive/qt/ 找到下载页面,选择View All Downloads,找你需要的版本
- 基于InstallShield2013LimitedEdition的安装包制作
在VS2012之前,我们做安装包一般都是使用VS自带的安装包制作工具来创建安装包的,VS2012.VS2013以后,微软把这个去掉,集成使用了InstallShield进行安装包的制作了,虽然思路差不 ...
- 使用VS2015制作安装包( 含相关的下载链接)
补充: 在看下面的教程过程中,如果在下面的步聚1中没有 " Visual Studio Installer", 则需要通过下面的链接进行安装 Visual Studio Insta ...
- 使用Qt installer framework制作安装包
一.介绍 使用Qt库开发的应用程序,一般有两种发布方式:(1)静态编译发布.这种方式使得程序在编译的时候会将Qt核心库全部编译到一个可执行文件中.其优势是简单单一,所有的依赖库都集中在一起,其缺点也很 ...
- 使用Qt Installer Framework制作软件安装包
概述 Qt Installer Framework(缩写QIF)是Qt官方用于生成软件安装包的工具.包括Qt Creator和Qt Installer Framework自身的安装包都是由这个工具制作 ...
- Qt之程序发布以及打包成exe安装包
一.简述 Qt项目开发完成之后,需要打包发布程序,而因为用户电脑上没有Qt配置环境,所以需要将release生成的exe文件和所依赖的dll文件复制到一个文件夹中,然后再用 Inno Setup打包工 ...
随机推荐
- Protocol Buffers学习教程
最近看公司代码的过程中,看到了很多proto后缀的文件,这是个啥玩意?问了大佬,原来这是Protocol Buffers! 这玩意是干啥的?查完资料才知道,又是谷歌大佬推的开源组件,这玩意完全可以取代 ...
- ELK日志收集
目前日志的痛点 运维要经常登陆到服务器上拿日志给开发.测试 每次都是出问题后才去看日志,不能提前通过日志预判问题 如果是集群服务,日志将要从多台机器取 开发人员搞出来的日志不规范,没有标准.日志目录不 ...
- 查看spark RDD 各分区内容
mapPartitionsWithIndexdef mapPartitionsWithIndex[U](f: (Int, Iterator[T]) => Iterator[U], preserv ...
- Python学习之解决python下载第三方依赖速度慢的问题
原因:通过pip命令直接下载,一般下载的资源存放在国外的服务器上,导致下载速度慢.下载过程中报错: 解决方法:通过pip的命令参数,从国内的下载源,国外的替换为国内的镜像,进行目标包的下载: 具体参数 ...
- react 使用 lazyload 懒加载图片
文档地址 index.html <script> (function(w, d) { var b = d.getElementsByTagName("body")[0] ...
- Nestjs OpenAPI(Swagger)
官方文档 用来描述api
- 阿里云 ECS 迁移到七牛 QVM 记
操作 下载脚本 curl -O http://p70nwjoid.bkt.clouddn.com/go2qvm_client1.5_linux_x86_64.zip 解压填写配置 unzip go2q ...
- 10 windows server 2012R2 发布MVC框架网站注意事项
1:网站编译完成之后,需要发布,网站中应包括的文件有:文件夹(bin,Views,Content等其他网站中涉及到的文件夹)文件(favicon.ico.Web.config.Global.asax) ...
- 防止xss和sql注入:JS特殊字符过滤正则
function stripscript(s) { var pattern = new RegExp("[%--`~!@#$^&*()=|{}':;',\\[\\].<> ...
- java 三大框架 hibernate部分知识实现增删该查操作
1.三层架构 表现层 web层(MVC是一个表现层的设计模型) 业务层 service层 持久层 dao层2.三大框架和三层架构的关系(建议学习三大框架的顺序:先学习hibernat ...