; ============================================================================ ; Geopro — Windows 安装包脚本 (Inno Setup 6) ; ; 本脚本不直接手动编译,而是由 build_installer.ps1 调用: ; - 该脚本会先把 build/release/src/app 部署副本 stage 到 installer\staging, ; 跑 windeployqt 补齐 Qt 运行时缺件(D3Dcompiler / opengl32sw / WebEngine 等), ; 再用 /D 命令行宏把版本号与构建日期传进来。 ; 也可手动编译(用 staging 现有内容、默认版本号): ; "%LOCALAPPDATA%\Programs\Inno Setup 6\ISCC.exe" geopro.iss ; ; 产物:installer\dist\Geopro_Setup_<版本>-<日期>.exe ; ============================================================================ ; ---- 版本/日期:默认值,可被 build_installer.ps1 的 /D 宏覆盖 ---- #ifndef AppVersion #define AppVersion "3.0.0" #endif #ifndef BuildDate #define BuildDate "dev" #endif #define AppName "Geopro" #define AppPublisher "Geomative" #define AppExeName "geopro_desktop.exe" [Setup] ; AppId 必须保持稳定,升级/卸载据此识别同一程序——切勿修改此 GUID。 AppId={{B1C23792-2FFC-4326-89DA-B592D50DDF16} AppName={#AppName} AppVersion={#AppVersion} AppVerName={#AppName} {#AppVersion} ({#BuildDate}) AppPublisher={#AppPublisher} DefaultDirName={autopf}\{#AppName} DefaultGroupName={#AppName} DisableProgramGroupPage=yes UninstallDisplayName={#AppName} {#AppVersion} UninstallDisplayIcon={app}\{#AppExeName} OutputDir={#SourcePath}\dist OutputBaseFilename=Geopro_Setup_{#AppVersion}-{#BuildDate} Compression=lzma2/max SolidCompression=yes WizardStyle=modern ; 仅 64 位(Qt/VTK 均为 x64 构建) ArchitecturesAllowed=x64compatible ArchitecturesInstallIn64BitMode=x64compatible ; 装入 Program Files 并需安装 VC++ 运行时——要求管理员权限 PrivilegesRequired=admin ; 失败时在 %TEMP% 留安装日志,便于排障 SetupLogging=yes [Languages] Name: "zh"; MessagesFile: "{#SourcePath}\lang\ChineseSimplified.isl" Name: "en"; MessagesFile: "compiler:Default.isl" [Tasks] Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked [Files] ; 主载荷:staging 全量(exe + 全部 DLL + 插件目录 + WebEngine 资源),递归打包 Source: "{#SourcePath}\staging\*"; DestDir: "{app}"; Flags: recursesubdirs createallsubdirs ignoreversion ; VC++ 运行时安装器:临时落地、装完即删 Source: "{#SourcePath}\redist\vc_redist.x64.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall [Icons] Name: "{group}\{#AppName}"; Filename: "{app}\{#AppExeName}"; WorkingDir: "{app}" Name: "{group}\{cm:UninstallProgram,{#AppName}}"; Filename: "{uninstallexe}" Name: "{autodesktop}\{#AppName}"; Filename: "{app}\{#AppExeName}"; WorkingDir: "{app}"; Tasks: desktopicon [Run] ; 安装 Microsoft Visual C++ 运行时(仅在系统未安装时执行;退出码被 Inno 忽略,已装则静默跳过) Filename: "{tmp}\vc_redist.x64.exe"; Parameters: "/install /quiet /norestart"; \ StatusMsg: "正在安装 Microsoft Visual C++ 运行时..."; Check: VCRedistNeeded ; 安装结束可选立即启动 Filename: "{app}\{#AppExeName}"; Description: "{cm:LaunchProgram,{#AppName}}"; \ WorkingDir: "{app}"; Flags: nowait postinstall skipifsilent [Code] // 检测 VC++ 2015-2022 x64 运行时是否已安装(64 位 + WOW6432Node 两个视图都查) function VCRedistNeeded: Boolean; var installed: Cardinal; begin Result := True; if RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64', 'Installed', installed) and (installed = 1) then Result := False else if RegQueryDWordValue(HKLM, 'SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x64', 'Installed', installed) and (installed = 1) then Result := False; end;