2026-07-07 09:48:01 +00:00
|
|
|
param(
|
|
|
|
|
[Parameter(Mandatory=$true)]
|
|
|
|
|
[string]$SdkRoot,
|
|
|
|
|
|
|
|
|
|
[string]$ReleaseDir = (Get-Location).Path,
|
|
|
|
|
|
2026-07-09 09:00:51 +00:00
|
|
|
[switch]$OverwriteConfig,
|
|
|
|
|
|
|
|
|
|
[switch]$IncludeQtRuntime
|
2026-07-07 09:48:01 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
|
|
|
|
|
|
$sdk = (Resolve-Path $SdkRoot).Path
|
|
|
|
|
$release = (Resolve-Path $ReleaseDir).Path
|
|
|
|
|
|
|
|
|
|
$binDir = Join-Path $sdk "bin"
|
|
|
|
|
$configDir = Join-Path $sdk "config"
|
|
|
|
|
$appConfig = Join-Path $configDir "app_config.json"
|
|
|
|
|
$publicKey = Join-Path $configDir "manifest_public_key.pem"
|
|
|
|
|
|
|
|
|
|
foreach ($path in @($binDir, $appConfig, $publicKey)) {
|
|
|
|
|
if (-not (Test-Path $path)) {
|
|
|
|
|
throw "SDK file is missing: $path"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-09 09:00:51 +00:00
|
|
|
function Test-IsQtRuntimeItem {
|
|
|
|
|
param([System.IO.FileSystemInfo]$Item)
|
|
|
|
|
|
|
|
|
|
if ($IncludeQtRuntime) {
|
|
|
|
|
return $false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($Item.PSIsContainer) {
|
|
|
|
|
return $Item.Name -in @(
|
|
|
|
|
"bearer",
|
|
|
|
|
"iconengines",
|
|
|
|
|
"imageformats",
|
|
|
|
|
"platforms",
|
|
|
|
|
"styles",
|
|
|
|
|
"translations"
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
$Item.Name -match '^Qt5.*\.dll$' -or
|
|
|
|
|
$Item.Name -in @(
|
|
|
|
|
"libEGL.dll",
|
|
|
|
|
"libGLESv2.dll",
|
|
|
|
|
"opengl32sw.dll",
|
|
|
|
|
"d3dcompiler_47.dll"
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Get-ChildItem $binDir -Force | Where-Object {
|
|
|
|
|
-not (Test-IsQtRuntimeItem $_)
|
|
|
|
|
} | Copy-Item -Destination $release -Recurse -Force
|
2026-07-07 09:48:01 +00:00
|
|
|
|
|
|
|
|
$targetConfigDir = Join-Path $release "config"
|
|
|
|
|
New-Item $targetConfigDir -ItemType Directory -Force | Out-Null
|
|
|
|
|
|
|
|
|
|
$targetAppConfig = Join-Path $targetConfigDir "app_config.json"
|
|
|
|
|
if ((-not (Test-Path $targetAppConfig)) -or $OverwriteConfig) {
|
|
|
|
|
Copy-Item $appConfig $targetAppConfig -Force
|
|
|
|
|
} else {
|
|
|
|
|
Write-Host "Keep existing config/app_config.json. Use -OverwriteConfig to replace it."
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Copy-Item $publicKey (Join-Path $targetConfigDir "manifest_public_key.pem") -Force
|
|
|
|
|
|
|
|
|
|
Write-Host "SDK files installed to: $release"
|
|
|
|
|
Write-Host "Next: edit config/app_config.json, then start Launcher.exe."
|