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打包工 ...
随机推荐
- sfc /scannow命令如何能用虚拟光驱完成修复?(xp下的办法)
我们先光盘文件或用WinRAR压缩软件将ISO文件解压缩到本地磁盘某目录下,如e:\winxp: 在ISO文件上右击,在弹出的菜单中选择“解压到”: 文件较多,久等一会解压完成后文件夹下有很多 ...
- Python中的三元运算符
Python中的三元运算符 对于如下需求: if var1>1 : goal = "执行表达式1" else: goal = "执行表达式2" 1.在其他 ...
- Android 查看蓝牙hci日志
最近在调试android连接ble设备,需要查看hci日志.记录一下方法. 1. 开发者选项->启用蓝牙HCI信息收集日志. 2. android 8版本,默认位置/data/misc/blue ...
- Glide和Govendor安装和使用
两个都是Go的包管理工具,二选一 Glide参考:golang 依赖管理 /etc/profile #Go export GOROOT=/home/lintong/software/go export ...
- 【Clojure 基本知识】 ns宏的 指令(关键字) requrie的用法
指令(:require)用在(ns)之中,下面是实践中总结的几种用法(下文中省略ns宏,只是给出:require的代码): 一.导入完整名称空间. 1,最简单的形式: (:require clojur ...
- Linux系统(本例以Ubuntu18.04为例)安装GCC编译器
Linux(本例以Ubuntu18.04为例)安装GCC编译器 一.安装 安装命令:sudo apt-get build-dep gcc 遇到 您希望继续执行吗? [Y/n] y 直接输入y回车即 ...
- python __get__ & __set__
目的: 提供类似java中的getter/setter的东西. (getter/setter的目的: 将属性方法化,使得属性的引用变得简单---尤其将来属性的读取/赋值有比较复杂的逻辑) 官方简明文 ...
- python生成组织架构图(网络拓扑图、graph.editor拓扑图编辑器)
Graph.Editor是一款基于HTML5技术的拓补图编辑器,采用jquery插件的形式,是Qunee图形组件的扩展项目,旨在提供可供扩展的拓扑图编辑工具, 拓扑图展示.编辑.导出.保存等功能,此外 ...
- Codeforces Round 504
(交互题真神奇,,,我自己瞎写了一发目测样例都没过去就AC了...) (只出了两题的竟然没掉下蓝名真是可怕) A:我的代码太不美观了,放个同学的(因为我是c++63分的蒟蒻所以根本不知道那些函数怎么用 ...
- C/C++预处理器
关于预处理器 首先时预处理器的条件指令 什么是预处理指令? 预处理指令是以#号开头的代码行.#号必须是该行除了任何空白字符外的第一个字符.#后是指令关键字,在关键字和#号之间允许存在任意个数的空白字符 ...