赞
踩
打开 Qt Creator,选择【工具】–>【选项】–>【帮助】–>【文档】–>【添加】
选择Qt IFW安装目录doc下的ifw.qch文件。
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
在config目录下创建名为config.xml的文件,文件内容如下:
<?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>
配置文件指定了安装界面上显示的如下信息:
在packages
目录下com.man.ifw/meta目录下,package.xml文件
<?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>
各个元素分别表示如下含义:
在packages
目录下com.man.ifw/meta目录下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() { 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@"); } }
打开Powershell
工具
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 工具依据编译工程选择的工具链确定
cd AidTool_Installer
binarycreator.exe -c .\config\config.xml -p .\packages AidTool -v
找到qt提供的设置环境变量工具
找到它
可以看到这个批处理,设置了相关地址变量,到PATH
@echo off
echo Setting up environment for Qt usage...
set PATH=C:\Qt\Qt5.12.10\5.12.10\mingw73_64\bin;C:/Qt/Qt5.12.10/Tools/mingw730_64\bin;%PATH%
cd /D C:\Qt\Qt5.12.10\5.12.10\mingw73_64
下面拷贝这两个路径添加
这时右键powershell打开即可使用windeployqt.exe
工具。
工具下载地址:https://enigmaprotector.com/cn/downloads.html
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。