Add DLL sweep to build-production batch script
This commit is contained in:
@ -65,8 +65,15 @@ if exist "FreeSans.ttf" copy "FreeSans.ttf" "dist\TetrisGame\"
|
|||||||
|
|
||||||
REM Copy SDL DLLs (if available) - SDL_image no longer needed
|
REM Copy SDL DLLs (if available) - SDL_image no longer needed
|
||||||
echo Copying dependencies...
|
echo Copying dependencies...
|
||||||
if exist "vcpkg_installed\x64-windows\bin\SDL3.dll" copy "vcpkg_installed\x64-windows\bin\SDL3.dll" "dist\TetrisGame\"
|
set "PackageDir=dist\TetrisGame"
|
||||||
if exist "vcpkg_installed\x64-windows\bin\SDL3_ttf.dll" copy "vcpkg_installed\x64-windows\bin\SDL3_ttf.dll" "dist\TetrisGame\"
|
set "copiedDependencies=0"
|
||||||
|
|
||||||
|
call :CopyDependencyDir "build-release\vcpkg_installed\x64-windows\bin"
|
||||||
|
call :CopyDependencyDir "vcpkg_installed\x64-windows\bin"
|
||||||
|
|
||||||
|
if "%copiedDependencies%"=="0" (
|
||||||
|
echo Warning: No dependency DLLs were copied. Ensure vcpkg release binaries exist.
|
||||||
|
)
|
||||||
|
|
||||||
REM Create launcher batch file
|
REM Create launcher batch file
|
||||||
echo @echo off > "dist\TetrisGame\Launch-Tetris.bat"
|
echo @echo off > "dist\TetrisGame\Launch-Tetris.bat"
|
||||||
@ -84,3 +91,21 @@ echo The game is ready for distribution!
|
|||||||
echo Users can run tetris.exe or Launch-Tetris.bat
|
echo Users can run tetris.exe or Launch-Tetris.bat
|
||||||
echo.
|
echo.
|
||||||
pause
|
pause
|
||||||
|
goto :eof
|
||||||
|
|
||||||
|
:CopyDependencyDir
|
||||||
|
set "dllDir=%~1"
|
||||||
|
if not exist "%dllDir%" goto :eof
|
||||||
|
echo Scanning %dllDir% for DLLs...
|
||||||
|
for %%F in ("%dllDir%\*.dll") do (
|
||||||
|
if exist "%%~fF" (
|
||||||
|
if exist "%PackageDir%\%%~nxF" (
|
||||||
|
copy /Y "%%~fF" "%PackageDir%\%%~nxF" >nul
|
||||||
|
) else (
|
||||||
|
copy "%%~fF" "%PackageDir%\" >nul
|
||||||
|
)
|
||||||
|
echo Copied %%~nxF
|
||||||
|
set "copiedDependencies=1"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
goto :eof
|
||||||
|
|||||||
@ -155,32 +155,28 @@ foreach ($font in $FontFiles) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Step 7: Copy dependencies (DLLs)
|
# Step 7: Copy dependencies (DLLs)
|
||||||
Write-Info "Copying SDL3 dependencies..."
|
Write-Info "Copying runtime dependencies..."
|
||||||
$VcpkgInstalled = Join-Path "vcpkg_installed" "x64-windows"
|
$buildVcpkgBin = Join-Path (Join-Path $BuildDir "vcpkg_installed") "x64-windows/bin"
|
||||||
if (Test-Path $VcpkgInstalled) {
|
$repoVcpkgBin = "vcpkg_installed/x64-windows/bin"
|
||||||
$DllPaths = @(
|
$DependencyDirs = @($buildVcpkgBin, $repoVcpkgBin) | Where-Object { $_ } | Select-Object -Unique
|
||||||
Join-Path $VcpkgInstalled "bin\SDL3.dll",
|
|
||||||
Join-Path $VcpkgInstalled "bin\SDL3_ttf.dll"
|
$copiedNames = @{}
|
||||||
)
|
foreach ($dir in $DependencyDirs) {
|
||||||
|
if (!(Test-Path $dir)) { continue }
|
||||||
$CopiedDlls = 0
|
Write-Info "Scanning $dir for DLLs..."
|
||||||
foreach ($dll in $DllPaths) {
|
$dlls = Get-ChildItem -Path $dir -Filter "*.dll" -ErrorAction SilentlyContinue
|
||||||
if (Test-Path $dll) {
|
foreach ($dll in $dlls) {
|
||||||
Copy-Item $dll $PackageDir
|
$dest = Join-Path $PackageDir $dll.Name
|
||||||
$dllName = Split-Path $dll -Leaf
|
Copy-Item $dll.FullName $dest -Force
|
||||||
Write-Success "Copied $dllName"
|
if (-not $copiedNames.ContainsKey($dll.Name)) {
|
||||||
$CopiedDlls++
|
Write-Success "Copied $($dll.Name)"
|
||||||
} else {
|
$copiedNames[$dll.Name] = $true
|
||||||
Write-Warning "Warning: $dll not found"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if ($CopiedDlls -eq 0) {
|
|
||||||
Write-Warning "No SDL DLLs found in vcpkg installation"
|
if ($copiedNames.Count -eq 0) {
|
||||||
Write-Warning "You may need to manually copy SDL3 DLLs to the package"
|
Write-Warning "No dependency DLLs were copied. Please ensure vcpkg has been built for Release."
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Write-Warning "vcpkg installation not found. SDL DLLs must be manually copied."
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Step 8: Create README and batch file for easy launching
|
# Step 8: Create README and batch file for easy launching
|
||||||
|
|||||||
Reference in New Issue
Block a user