IFW (Installation framework) 是Qt提供的软件打包工具,可以将软件和依赖库打包成一个独立EXE文件,可以移至任意平台进行安装。
安装
到官网下载软件,安装正常流程安装。
示例
基本目录
IFW基本目录如下,每个模块有独立文件夹和配置文件。
1 2 3 4 5 6 7 8 9 10 11 12
| ├─config └─packages ├─flexlmCRO │ └─meta | └─data ├─vxt_aeroauto │ └─meta | └─data |... └─vxt_vapsxt └─meta └─data
|
config
此目录中包含一个config.xml文件,用于表示打包后软件的信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| <?xml version="1.0"?> <Installer> <Name>Presagis VAPS XT 4.2.1 破解版</Name> <Version>1.0.0</Version> <Title>Presagis VAPS XT 4.2.1 破解版</Title> <Publisher>Jackey Lea</Publisher> <ProductUrl>https://blog.jackeylea.com</ProductUrl> <InstallerWindowIcon>licensetool.png</InstallerWindowIcon> <InstallerApplicationIcon>licensetool</InstallerApplicationIcon> <Logo>logo.png</Logo> <StartMenuDir>Presagis VAPS XT 4.2.1 破解版</StartMenuDir> <MaintenanceToolName>MaintenanceTool</MaintenanceToolName> <AllowNonAsciiCharacters>true</AllowNonAsciiCharacters> <WizardDefaultWidth>200ex</WizardDefaultWidth> <WizardDefaultHeight>120ex</WizardDefaultHeight> <TargetDir>C:\Presagis</TargetDir> <AdminTargetDir>@TargetDir@</AdminTargetDir> </Installer>
|
软件名称,版本号,安装包显示的标题,作者,图标,起始菜单栏目录,安装目录
其中InstallerApplicationIcon不能加扩展名,图片资源放在此目录中。
packages
此目录中包含多个子目录,每个子目录对应一个模块。每个子目录中都包含meta/data两个目录。
用于标识此模块的信息。
此目录中一般包含package.xml LICENSE.txt installscript.qs
LICENSE.txt很简单,就是授权声明,可以把LGPL的授权声明直接放里面,也可以自己写。
package.xml
此文件包含模块信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| <?xml version="1.0"?> <Package> <DisplayName>License Tool 4.4</DisplayName> <Description>Presagis License Tool 4.4</Description> <Description xml:lang="zh_cn">Presagis 授权工具 4.4</Description> <Version>1.0.0</Version> <ReleaseDate>2023-01-22</ReleaseDate> <Name>License Tool 4.4</Name> <Licenses> <License name="License Agreement" file="LICENSE.txt" ></img> </Licenses> <Default>true</Default> <Script>installscript.qs</Script> <SortingPriority>20</SortingPriority> </Package>
|
模块名称,模块描述,模块版本,发布日期等等
License字段就是授权声明
Default字段就是此模块是否选中
Script就是此模块安装时执行的脚本
如果有多个模块,SortingPriority用于排序,值大的在上方。
installscript.qs
使用js编写
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| function Component() { }
Component.prototype.createOperationsForArchive = function(archive) {
component.addOperation("Extract", archive, "@TargetDir@/flexlmCRO"); }
Component.prototype.createOperations = function() { component.createOperations();
if (systemInfo.productType === "windows") { component.addOperation("Mkdir","@StartMenuDir@"); component.addOperation("CreateShortcut", "@TargetDir@/flexlmCRO/License_Borrowing_Utility_User_Guide.chm", "@StartMenuDir@/Presagis VAPS XT 4.2.1 破解版/Borrow Utility User Guide.lnk", "workingDirectory=@TargetDir@"); component.addOperation("CreateShortcut", "@TargetDir@/flexlmCRO/License_Tool_User_Guide.chm", "@StartMenuDir@/Presagis VAPS XT 4.2.1 破解版/License Tool User Guide.lnk", "workingDirectory=@TargetDir@"); component.addOperation("CreateShortcut", "@TargetDir@/flexlmCRO/LicenseTool.exe", "@StartMenuDir@/Presagis VAPS XT 4.2.1 破解版/License Tool 4.4.lnk", "workingDirectory=@TargetDir@"); } }
|
createOperationsForArchive函数用于把当前模块解压至指定目录
createOperations用于创建起始菜单快捷方式。
data
模块数据。
它支持7z等压缩格式,如果没有压缩,在打包时,ifw会自动压缩,如果数据很多,打包压缩会非常耗时,推荐自己先压缩一下。
打包
所有文件配置好后,在config/packages目录打开终端,执行命令
1
| binarycreator -c config\config.xml -p packages Installer.exe -v
|
-c指定配置文件
-p指定模块安装包
-v输出详细信息
安装测试
准备打包的软件包

双击打开软件

选择安装目录

选择安装组件,我合并了部分组件

不平等条约

快捷方式

准备安装

安装中

安装完成

安装目录

接下来需要使用授权工具加载假证书
然后就可以正常使用了
缺点