Add DLL sweep to build-production batch script

This commit is contained in:
2025-11-22 16:57:05 +01:00
parent 4e69ed9742
commit aed1cb62e7
2 changed files with 47 additions and 26 deletions

View File

@ -155,32 +155,28 @@ foreach ($font in $FontFiles) {
}
# Step 7: Copy dependencies (DLLs)
Write-Info "Copying SDL3 dependencies..."
$VcpkgInstalled = Join-Path "vcpkg_installed" "x64-windows"
if (Test-Path $VcpkgInstalled) {
$DllPaths = @(
Join-Path $VcpkgInstalled "bin\SDL3.dll",
Join-Path $VcpkgInstalled "bin\SDL3_ttf.dll"
)
$CopiedDlls = 0
foreach ($dll in $DllPaths) {
if (Test-Path $dll) {
Copy-Item $dll $PackageDir
$dllName = Split-Path $dll -Leaf
Write-Success "Copied $dllName"
$CopiedDlls++
} else {
Write-Warning "Warning: $dll not found"
Write-Info "Copying runtime dependencies..."
$buildVcpkgBin = Join-Path (Join-Path $BuildDir "vcpkg_installed") "x64-windows/bin"
$repoVcpkgBin = "vcpkg_installed/x64-windows/bin"
$DependencyDirs = @($buildVcpkgBin, $repoVcpkgBin) | Where-Object { $_ } | Select-Object -Unique
$copiedNames = @{}
foreach ($dir in $DependencyDirs) {
if (!(Test-Path $dir)) { continue }
Write-Info "Scanning $dir for DLLs..."
$dlls = Get-ChildItem -Path $dir -Filter "*.dll" -ErrorAction SilentlyContinue
foreach ($dll in $dlls) {
$dest = Join-Path $PackageDir $dll.Name
Copy-Item $dll.FullName $dest -Force
if (-not $copiedNames.ContainsKey($dll.Name)) {
Write-Success "Copied $($dll.Name)"
$copiedNames[$dll.Name] = $true
}
}
if ($CopiedDlls -eq 0) {
Write-Warning "No SDL DLLs found in vcpkg installation"
Write-Warning "You may need to manually copy SDL3 DLLs to the package"
}
} else {
Write-Warning "vcpkg installation not found. SDL DLLs must be manually copied."
}
if ($copiedNames.Count -eq 0) {
Write-Warning "No dependency DLLs were copied. Please ensure vcpkg has been built for Release."
}
# Step 8: Create README and batch file for easy launching