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

@ -65,8 +65,15 @@ if exist "FreeSans.ttf" copy "FreeSans.ttf" "dist\TetrisGame\"
REM Copy SDL DLLs (if available) - SDL_image no longer needed
echo Copying dependencies...
if exist "vcpkg_installed\x64-windows\bin\SDL3.dll" copy "vcpkg_installed\x64-windows\bin\SDL3.dll" "dist\TetrisGame\"
if exist "vcpkg_installed\x64-windows\bin\SDL3_ttf.dll" copy "vcpkg_installed\x64-windows\bin\SDL3_ttf.dll" "dist\TetrisGame\"
set "PackageDir=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
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.
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