diff --git a/packaging/windows/build-installer.ps1 b/packaging/windows/build-installer.ps1 new file mode 100644 index 0000000..7aa7b12 --- /dev/null +++ b/packaging/windows/build-installer.ps1 @@ -0,0 +1,36 @@ +param( + [string]$BuildDir = "$PSScriptRoot\..\..\build", + [string]$DistDir = "$PSScriptRoot\..\..\dist\windows" +) + +$ErrorActionPreference = "Stop" + +$cacheFile = Join-Path $BuildDir "CMakeCache.txt" +if (-not (Test-Path $cacheFile)) { + throw "Build directory not configured: $BuildDir (run cmake -S . -B build first)" +} + +$versionLine = Select-String -Path $cacheFile -Pattern '^CMAKE_PROJECT_VERSION:STATIC=(.*)$' +if (-not $versionLine) { + throw "Unable to determine project version from $cacheFile" +} +$version = $versionLine.Matches[0].Groups[1].Value + +$isccCandidates = @( + "C:\Program Files (x86)\Inno Setup 6\ISCC.exe", + "C:\Program Files\Inno Setup 6\ISCC.exe", + "$env:LOCALAPPDATA\Programs\Inno Setup 6\ISCC.exe" +) +$iscc = $isccCandidates | Where-Object { Test-Path $_ } | Select-Object -First 1 +if (-not $iscc) { + throw "Inno Setup compiler (ISCC.exe) not found. Install it: winget install -e --id JRSoftware.InnoSetup" +} + +New-Item -ItemType Directory -Force -Path $DistDir | Out-Null + +& $iscc "/DMyAppVersion=$version" "$PSScriptRoot\orbithub.iss" +if ($LASTEXITCODE -ne 0) { + throw "ISCC.exe failed with exit code $LASTEXITCODE" +} + +Write-Output "Created $DistDir\OrbitHub-Setup-$version.exe" diff --git a/packaging/windows/orbithub.iss b/packaging/windows/orbithub.iss new file mode 100644 index 0000000..1b5ad71 --- /dev/null +++ b/packaging/windows/orbithub.iss @@ -0,0 +1,46 @@ +#ifndef MyAppVersion +#define MyAppVersion "0.0.0" +#endif + +#define MyAppName "OrbitHub" +#define MyAppPublisher "OrbitHub Maintainers" +#define MyAppExeName "orbithub.exe" +#define MyBuildDir "..\..\build" + +[Setup] +AppId={{6B2E0B8F-2C6D-4E7C-9C36-6C6C9C6F6C1A} +AppName={#MyAppName} +AppVersion={#MyAppVersion} +AppPublisher={#MyAppPublisher} +DefaultDirName={autopf}\{#MyAppName} +DefaultGroupName={#MyAppName} +UninstallDisplayIcon={app}\{#MyAppExeName} +OutputDir=..\..\dist\windows +OutputBaseFilename=OrbitHub-Setup-{#MyAppVersion} +Compression=lzma2 +SolidCompression=yes +ArchitecturesAllowed=x64compatible +ArchitecturesInstallIn64BitMode=x64compatible +SetupIconFile=orbithub.ico +WizardStyle=modern +DisableProgramGroupPage=yes + +[Languages] +Name: "english"; MessagesFile: "compiler:Default.isl" + +[Tasks] +Name: "desktopicon"; Description: "Create a &desktop shortcut"; GroupDescription: "Additional icons:"; Flags: unchecked + +[Files] +Source: "{#MyBuildDir}\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion +Source: "{#MyBuildDir}\*.dll"; DestDir: "{app}"; Flags: ignoreversion +Source: "{#MyBuildDir}\platforms\*"; DestDir: "{app}\platforms"; Flags: ignoreversion recursesubdirs +Source: "{#MyBuildDir}\sqldrivers\*"; DestDir: "{app}\sqldrivers"; Flags: ignoreversion recursesubdirs + +[Icons] +Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" +Name: "{group}\Uninstall {#MyAppName}"; Filename: "{uninstallexe}" +Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon + +[Run] +Filename: "{app}\{#MyAppExeName}"; Description: "Launch {#MyAppName}"; Flags: nowait postinstall skipifsilent