# SaiCore Windows Deployment Script # Builds the complete distributable package param( [string]$QtDir = "C:\Qt\6.7.3\msvc2019_64", [string]$VcVars = "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat", [string]$ThirdPartyPath = "..\ruboard-ThirdParty", [string]$Config = "release" ) $ErrorActionPreference = "Stop" $ProjectRoot = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path) Write-Host "=== SaiCore Build & Deploy ===" -ForegroundColor Cyan Write-Host "Project: $ProjectRoot" Write-Host "Qt: $QtDir" Write-Host "Config: $Config" Write-Host "" # Step 1: Build QuaZip Write-Host "[1/6] Building QuaZip..." -ForegroundColor Yellow $quazipDir = Join-Path $ProjectRoot $ThirdPartyPath | Join-Path -ChildPath "quazip" Push-Location $quazipDir cmd /c "set PATH=$QtDir\bin;%PATH% && call `"$VcVars`" x64 && qmake quazip.pro -spec win32-msvc CONFIG+=$Config && nmake /f Makefile.Release 2>&1" if ($LASTEXITCODE -ne 0) { Write-Host "QuaZip build FAILED" -ForegroundColor Red; exit 1 } Pop-Location Write-Host "QuaZip built OK" -ForegroundColor Green # Step 2: Build SaiCore Write-Host "[2/6] Building SaiCore..." -ForegroundColor Yellow Push-Location $ProjectRoot cmd /c "set PATH=$QtDir\bin;%PATH% && call `"$VcVars`" x64 && qmake SaiCore.pro -spec win32-msvc CONFIG+=$Config && nmake /f Makefile.Release 2>&1" if ($LASTEXITCODE -ne 0) { Write-Host "SaiCore build FAILED" -ForegroundColor Red; exit 1 } Pop-Location Write-Host "SaiCore built OK" -ForegroundColor Green $productDir = Join-Path $ProjectRoot "build\win32\release\product" # Step 3: Compile translations Write-Host "[3/6] Compiling translations..." -ForegroundColor Yellow $i18nDir = Join-Path $productDir "i18n" New-Item -ItemType Directory -Path $i18nDir -Force | Out-Null $tsFiles = Get-ChildItem (Join-Path $ProjectRoot "resources\i18n\SaiCore_*.ts") foreach ($ts in $tsFiles) { $qmName = $ts.BaseName + ".qm" & "$QtDir\bin\lrelease.exe" $ts.FullName -qm (Join-Path $i18nDir $qmName) 2>&1 | Out-Null } Write-Host "$($tsFiles.Count) translations compiled" -ForegroundColor Green # Step 4: Run windeployqt Write-Host "[4/6] Running windeployqt..." -ForegroundColor Yellow & "$QtDir\bin\windeployqt.exe" --release --no-translations --no-system-d3d-compiler --no-opengl-sw (Join-Path $productDir "SaiCore.exe") 2>&1 | Out-Null Write-Host "Qt dependencies deployed" -ForegroundColor Green # Step 5: Copy resources Write-Host "[5/6] Copying resources..." -ForegroundColor Yellow Copy-Item (Join-Path $ProjectRoot "resources\etc") (Join-Path $productDir "etc") -Recurse -Force Copy-Item (Join-Path $ProjectRoot "resources\library") (Join-Path $productDir "library") -Recurse -Force Copy-Item (Join-Path $ProjectRoot "resources\fonts") (Join-Path $productDir "fonts") -Recurse -Force # Copy ThirdParty DLLs $tpFull = Join-Path $ProjectRoot $ThirdPartyPath Copy-Item (Join-Path $tpFull "openssl\openssl-3.0.15-win64\bin\libssl-3-x64.dll") $productDir -Force -ErrorAction SilentlyContinue Copy-Item (Join-Path $tpFull "openssl\openssl-3.0.15-win64\bin\libcrypto-3-x64.dll") $productDir -Force -ErrorAction SilentlyContinue Get-ChildItem (Join-Path $tpFull "poppler\*.dll") -ErrorAction SilentlyContinue | Copy-Item -Destination $productDir -Force Get-ChildItem (Join-Path $tpFull "poppler\bin\*.dll") -ErrorAction SilentlyContinue | Copy-Item -Destination $productDir -Force if (Test-Path (Join-Path $tpFull "interactive")) { New-Item -ItemType Directory -Path (Join-Path $productDir "library\interactive") -Force | Out-Null Copy-Item (Join-Path $tpFull "interactive\*") (Join-Path $productDir "library\interactive") -Recurse -Force } # Copy MS DLLs Copy-Item (Join-Path $QtDir "bin\d3dcompiler_47.dll") $productDir -Force -ErrorAction SilentlyContinue Copy-Item (Join-Path $QtDir "bin\opengl32sw.dll") $productDir -Force -ErrorAction SilentlyContinue # Copy zlib.dll (required by poppler) Copy-Item (Join-Path $tpFull "zlib\1.2.11\bin\zlib.dll") $productDir -Force -ErrorAction SilentlyContinue Write-Host "Resources copied" -ForegroundColor Green # Step 6: Summary Write-Host "[6/6] Deployment summary:" -ForegroundColor Yellow $exe = Join-Path $productDir "SaiCore.exe" $dlls = (Get-ChildItem $productDir -Filter "*.dll").Count $totalSize = (Get-ChildItem $productDir -Recurse | Measure-Object -Property Length -Sum).Sum / 1MB Write-Host " Executable: $exe" Write-Host " DLLs: $dlls" Write-Host " Total size: $([math]::Round($totalSize, 1)) MB" Write-Host "" Write-Host "=== BUILD COMPLETE ===" -ForegroundColor Cyan Write-Host "Product directory: $productDir"