使用Qt Installer Framework制作安装包

2018年07月01日 03:45:37 大黄老鼠 阅读数:878 标签: qt更多

个人分类: Qt
 
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_32768743/article/details/80871697

步骤

制作安装包的步骤:

  • 去官网下载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的更多相关文章

  1. qt 安装包生成

    (Qt Installer Framework)程序简易打包教程 2017年06月19日 14:38:47 carman_风 阅读数:3559 标签: installerqt框架 更多 个人分类: 软 ...

  2. Linux安装包生成工具:checkinstall、makeself

    关键词:checkinstall.dpkg.deb/rpm.makeself等等. checkinstall记录make install安装的文件,生成相应的(Slackware/RPM/Debian ...

  3. VS2008 Windows Form项目安装包生成详解

    2008 Windows Form项目的发布对有经验的程序员来说,可能不值一提,但对很多新手来说却不知道如何操作,因为在很多关于Visual Studio的书籍中也没有相关介绍,权威如<C# 2 ...

  4. 下载Qt安装包

    http://download.qt.io/archive/qt/ 找到下载页面,选择View All Downloads,找你需要的版本

  5. 基于InstallShield2013LimitedEdition的安装包制作

    在VS2012之前,我们做安装包一般都是使用VS自带的安装包制作工具来创建安装包的,VS2012.VS2013以后,微软把这个去掉,集成使用了InstallShield进行安装包的制作了,虽然思路差不 ...

  6. 使用VS2015制作安装包( 含相关的下载链接)

    补充: 在看下面的教程过程中,如果在下面的步聚1中没有 " Visual Studio Installer", 则需要通过下面的链接进行安装 Visual Studio Insta ...

  7. 使用Qt installer framework制作安装包

    一.介绍 使用Qt库开发的应用程序,一般有两种发布方式:(1)静态编译发布.这种方式使得程序在编译的时候会将Qt核心库全部编译到一个可执行文件中.其优势是简单单一,所有的依赖库都集中在一起,其缺点也很 ...

  8. 使用Qt Installer Framework制作软件安装包

    概述 Qt Installer Framework(缩写QIF)是Qt官方用于生成软件安装包的工具.包括Qt Creator和Qt Installer Framework自身的安装包都是由这个工具制作 ...

  9. Qt之程序发布以及打包成exe安装包

    一.简述 Qt项目开发完成之后,需要打包发布程序,而因为用户电脑上没有Qt配置环境,所以需要将release生成的exe文件和所依赖的dll文件复制到一个文件夹中,然后再用 Inno Setup打包工 ...

随机推荐

  1. centos7环境安装ElasticSearch

    操作系统: Centos7 .64位 ========================================= 查看系统版本和系统位数: [root@localhost /]# cat /e ...

  2. 匿名函数gc分析

    测试一:使用member function创建action会产生gc,不管该函数是否访问外部变量: private System.Action memberAct = null; // gc 112B ...

  3. C#作为客户端调用gsoap生成的C++服务端

    近日在学习C++,偶然遇到网友想用C#调用gsoap生成的C++服务的问题,遂决定研究一下,网上搜索了很久,大多数是C++调用C#的应用.... 经过本人的不断努力,终于找到一种解决问题的方法,总结如 ...

  4. 3.贝叶斯网络表示(The Bayesian Network Representation)

    对于一个n随机变量的联合分布,一般需要2**n-1个参数来表示这个分布.但是,我们可以通过随机变量之间的独立性,减少参数的个数. naive Beyes model: Bayesian Network ...

  5. Tensorflow r1.8安装C++接口(兼容OpenCV3)

    与之前一样,直接走medium的传送门:https://medium.com/@fanzongshaoxing/use-tensorflow-c-api-with-opencv3-bacb83ca56 ...

  6. 本人SW知识体系导航 - Programming menu

    将感悟心得记于此,重启程序员模式. js, py, c++, java, php 融汇之全栈系列 [Full-stack] 快速上手开发 - React [Full-stack] 状态管理技巧 - R ...

  7. sublime 安装ctags跳转以及跳转快捷键

    在source insight中有一个很好用的功能,就是函数的跟踪跳转,在阅读别人的代码的时候轻松的浏览原函数.我们知道,在使用vim的时候有个插件叫ctags,同理,在sublime text中也能 ...

  8. springBoot整合ftp上传图片功能

    知识点: springBoot后端项目,接收前端框架传到的图片,把图片上传到ftp图片服务器上 注意:在上传的过程中可能回出现,可以创建文件夹,但是图片上传不了的问题: 尝试了网上的很多方法,最后将f ...

  9. 字符串匹配的 KMP算法

    一般字符串匹配过程 KMP算法是字符串匹配算法的一种改进版,一般的字符串匹配算法是:从主串(目标字符串)和模式串(待匹配字符串)的第一个字符开始比较,如果相等则继续匹配下一个字符, 如果不相等则从主串 ...

  10. 在elementUI中使用 el-autocomplete 实现远程搜索的下拉框

    参考;https://blog.csdn.net/qq_37746973/article/details/78402812?utm_source=blogxgwz1 https://blog.csdn ...