Files
spacetris/build-production.bat

87 lines
2.4 KiB
Batchfile

@echo off
REM Simple Production Build Script for Tetris SDL3
REM This batch file builds and packages the game for distribution
setlocal EnableDelayedExpansion
echo ======================================
echo Tetris SDL3 Production Builder
echo ======================================
echo.
REM Check if we're in the right directory
if not exist "CMakeLists.txt" (
echo Error: CMakeLists.txt not found. Please run this script from the project root directory.
pause
exit /b 1
)
REM Clean previous builds
echo Cleaning previous builds...
if exist "build-release" rmdir /s /q "build-release"
if exist "dist" rmdir /s /q "dist"
REM Create and configure build directory
echo Configuring CMake for Release build...
mkdir "build-release"
cd "build-release"
cmake .. -DCMAKE_BUILD_TYPE=Release
if !errorlevel! neq 0 (
echo CMake configuration failed!
pause
exit /b 1
)
REM Build the project
echo Building Release version...
cmake --build . --config Release
if !errorlevel! neq 0 (
echo Build failed!
pause
exit /b 1
)
cd ..
REM Create distribution directory
echo Creating distribution package...
mkdir "dist\TetrisGame"
REM Copy executable
if exist "build-release\Release\tetris.exe" (
copy "build-release\Release\tetris.exe" "dist\TetrisGame\"
) else if exist "build-release\tetris.exe" (
copy "build-release\tetris.exe" "dist\TetrisGame\"
) else (
echo Error: Executable not found!
pause
exit /b 1
)
REM Copy assets
echo Copying game assets...
if exist "assets" xcopy "assets" "dist\TetrisGame\assets\" /E /I /Y
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\"
REM Create launcher batch file
echo @echo off > "dist\TetrisGame\Launch-Tetris.bat"
echo cd /d "%%~dp0" >> "dist\TetrisGame\Launch-Tetris.bat"
echo tetris.exe >> "dist\TetrisGame\Launch-Tetris.bat"
echo pause >> "dist\TetrisGame\Launch-Tetris.bat"
echo.
echo ======================================
echo Build Completed Successfully!
echo ======================================
echo Package location: dist\TetrisGame
echo.
echo The game is ready for distribution!
echo Users can run tetris.exe or Launch-Tetris.bat
echo.
pause