param( [switch]$SkipTests, [int]$Jobs = 8 ) $ErrorActionPreference = "Stop" $root = Split-Path -Parent $PSScriptRoot Push-Location $root try { Write-Host "Configuring release build..." cmake --preset windows-mingw-release Write-Host "Building..." cmake --build --preset windows-mingw-release -j $Jobs if (-not $SkipTests) { Write-Host "Running tests..." ctest --preset windows-mingw-release --output-on-failure } $buildDir = Join-Path $root "build/windows-mingw-release" Push-Location $buildDir try { $nsis = Get-Command makensis -ErrorAction SilentlyContinue if ($null -ne $nsis) { Write-Host "Building NSIS installer..." cpack -G NSIS Get-ChildItem -Filter "Schedule-*.exe" | ForEach-Object { Write-Host "Installer: $($_.FullName)" } } else { Write-Warning "makensis not found; falling back to a portable ZIP package." Write-Warning "Install NSIS and reopen PowerShell to build the .exe installer." cpack -G ZIP Get-ChildItem -Filter "Schedule-*.zip" | ForEach-Object { Write-Host "Portable package: $($_.FullName)" } } } finally { Pop-Location } } finally { Pop-Location }