QT engineering installation package creation process
QT installation package creation
Preparation tools
- qt-installer-framework download address
After the installation is complete, add environment variables
Added to Qt Creator help documentation
Open Qt Creator, select [Tools] -> [Options] -> [Help] -> [Documents] -> [Add] and
select the ifw.qch file in the Qt IFW installation directory doc.
Create installation package project
Create project directory
mkdir -p AidTool_Installer
mkdir -p AidTool_Installer/config
mkdir -p AidTool_Installer/packages
mkdir -p AidTool_Installer/packages/com.man.ifw
mkdir -p AidTool_Installer/packages/data
mkdir -p AidTool_Installer/packages/meta
.
├── AidTool_Installer
├── AidTool.exe
├── config
│ └── config.xml
└── packages
└── com.man.ifw
├── data
│ ├── AidTool.exe
│ ├── D3Dcompiler_47.dll
│ ├── Qt5Core.dll
│ ├── Qt5Gui.dll
│ ├── Qt5SerialPort.dll
│ ├── Qt5Svg.dll
│ ├── Qt5Widgets.dll
│ ├── iconengines
│ │ └── qsvgicon.dll
│ ├── imageformats
│ │ ├── qgif.dll
│ │ ├── qicns.dll
│ │ ├── qico.dll
│ │ ├── qjpeg.dll
│ │ ├── qsvg.dll
│ │ ├── qtga.dll
│ │ ├── qtiff.dll
│ │ ├── qwbmp.dll
│ │ └── qwebp.dll
│ ├── libEGL.dll
│ ├── libGLESV2.dll
│ ├── libgcc_s_seh-1.dll
│ ├── libstdc++-6.dll
│ ├── libwinpthread-1.dll
│ ├── opengl32sw.dll
│ ├── platforms
│ │ └── qwindows.dll
│ ├── startmenu
│ │ ├── README
│ │ ├── config
│ │ │ └── config.xml
│ │ ├── packages
│ │ │ └── org.qtproject.ifw.example
│ │ │ ├── data
│ │ │ │ └── README.txt
│ │ │ └── meta
│ │ │ ├── installscript.qs
│ │ │ └── package.xml
│ │ ├── startmenu.pro
│ │ └── startmenu.pro.user
│ ├── styles
│ │ └── qwindowsvistastyle.dll
│ └── translations
│ ├── qt_ar.qm
│ ├── qt_bg.qm
│ ├── qt_ca.qm
│ ├── qt_cs.qm
│ ├── qt_da.qm
│ ├── qt_de.qm
│ ├── qt_en.qm
│ ├── qt_es.qm
│ ├── qt_fi.qm
│ ├── qt_fr.qm
│ ├── qt_gd.qm
│ ├── qt_he.qm
│ ├── qt_hu.qm
│ ├── qt_it.qm
│ ├── qt_ja.qm
│ ├── qt_ko.qm
│ ├── qt_lv.qm
│ ├── qt_pl.qm
│ ├── qt_ru.qm
│ ├── qt_sk.qm
│ ├── qt_uk.qm
│ └── qt_zh_TW.qm
└── meta
├── installscript.qs
└── package.xml
Create configuration file
Create a file named config.xml in the config directory. The content of the file is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<Installer>
<Name>AidTool Installer</Name>
<Version>1.0.0</Version>
<Title>AidTool Installer</Title>
<Publisher>man</Publisher>
<StartMenuDir>AidTool</StartMenuDir>
<TargetDir>@HomeDir@/AidTool</TargetDir>
</Installer>
The configuration file specifies the following information displayed on the installation interface:
- <Title> Installer name on the title bar
- <Name> The name of the application displayed on the installation page
- <Version> The version number of the application
- <Publisher> Software Publisher
- <StartMenuDir> is added to the start menu default program group name
- <TargetDir> Application installation directory
Create package information file
In packages
the com.man.ifw/meta directory, the package.xml file
<?xml version="1.0" encoding="UTF-8"?>
<Package>
<DisplayName>AidTool</DisplayName>
<Description>Aid Device Tool</Description>
<Version>1.0.0-1</Version>
<ReleaseDate>2020-12-29</ReleaseDate>
<Default>true</Default>
<Script>installscript.qs</Script>
<Licenses>
<License name="Beer Public License Agreement" file="license.txt" />
</Licenses>
</Package>
Each element has the following meaning:
- <DisplayName> specifies the name of the component
- <Description> Display the description information of the selected component
- <Version> The version number information of the component, which can be used as a later version update
- <ReleaseDate> The date the component was released
- <Default> Whether the component is selected by default during the installation process, true means it is selected by default, false is selected by default.
- <Script> JavaScript file name, perform some personalized installation operations
- <Licenses> Add a license file, if not, you can delete this section
license.txt file creation
Create script file
packages
Installscript.qs in the directory com.man.ifw/meta
/****************************************************************************
**
** 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()
{
gui.pageWidgetByObjectName("LicenseAgreementPage").entered.connect(changeLicenseLabels);
}
changeLicenseLabels = function()
{
page = gui.pageWidgetByObjectName("LicenseAgreementPage");
page.AcceptLicenseLabel.setText("Yes I do!");
page.RejectLicenseLabel.setText("No I don't!");
}
Component.prototype.createOperations = function()
{
//调用默认实现
component.createOperations();
if (systemInfo.productType === "windows") {
//添加桌面快捷方式
component.addOperation("CreateShortcut",
"@TargetDir@/AidTool.exe",
"@DesktopDir@/AidTool.lnk",
"workingDirectory=@TargetDir@");
//添加开始菜单快捷方式
component.addOperation("CreateShortcut",
"@TargetDir@/AidTool.exe",
"@StartMenuDir@/AidTool.lnk",
"workingDirectory=@TargetDir@");
}
}
Prepare library files
Open Powershell
tool
cd build生成的xxx.exe目录下
#复制xx.exe文件到data目录下
cp ./xxx.exe AidTool_Installer/packages/data
cd AidTool_Installer/packages/data
C:\Qt\Qt5.13.2\5.13.2\mingw73_64\bin\windeployqt.exe AidTool.exe
#windeployqt.exe 工具依据编译工程选择的工具链确定
Generate installation package
cd AidTool_Installer
binarycreator.exe -c .\config\config.xml -p .\packages AidTool -v