使用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. 代理_正向代理_反向代理_nginx_转

    转自:Nginx 相关介绍(Nginx是什么?能干嘛?)   蔷薇Nina 关于代理 说到代理,首先我们要明确一个概念,所谓代理就是一个代表.一个渠道: 此时就设计到两个角色,一个是被代理角色,一个是 ...

  2. 火车头采集器如何采集QQ群成员中的QQ号

    如何采集QQ群群员QQ号,采集QQ号,批量采集QQ号 众所周知,QQ群群员QQ号无法导出,即使会员也不可以,那我们只能通过三方工具来实现我们的要求,那今天我们讲讲如何通过火车采集器来采集QQ群群员QQ ...

  3. Houdini技术体系大纲

    Houdini for UE4 Pipeline的系列教程,前言等想好再写吧

  4. Android利用Mediapalyer播放本地资源文件声音

    首先在res下创建raw,然后将mp3音乐拷贝到raw下 直接贴代码吧 //开始播放声音 public class PlayVoice { private static MediaPlayer med ...

  5. node常见操作命令

    进入REPL环境(READ  EVAL  PRINT  LOOP) 接收用户输入 执行用户输入 打印执行结果到控制台 循环到下一次 打开终端,键入node进入命令交互模式,可以输入一条代码语句后立即执 ...

  6. 9. Oracle DataGuard的介绍

    一. Oracle DataGuard简介 Oracle DataGuard:简称DG.是由一个Primary Database(主库)和一个或者多个Standby Database(备库)组成.对O ...

  7. Excel数据与DateTable数据的转换

    public class ExcelHelper : IDisposable { private string fileName = null; //文件名 private IWorkbook wor ...

  8. cdh 安装调研

    解决:No module named site http://blog.csdn.net/amgang/article/details/7030642 因为安装greenplum导致yum报如下错误: ...

  9. 10.27 rest_framework(1)

    2018-10-27 16:48:04 前几天在整理django博客! 新学的rest_framework框架是源于Django的 使用的时候得 pip install djangorestframe ...

  10. jquery和ajax和springmvc

    <script type="text/javascript" src="js/jquery-1.11.1.js"></script> $ ...