made build system more agnostic to the projet it builds
This commit is contained in:
+18
-17
@@ -1,37 +1,35 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
:: --- 1. Handle Compiler Choice ---
|
||||
:: Default to Clang, but allow override via "build_game.bat msvc"
|
||||
set "COMPILER_TYPE=%~1"
|
||||
if "%COMPILER_TYPE%"=="" set "COMPILER_TYPE=clang"
|
||||
:: --- 1. Handle Config Choice ---
|
||||
:: Default to debug config, but allow override
|
||||
set "CONFIG_ARG=%~1"
|
||||
if /I "%CONFIG_ARG%"=="" set "CONFIG_ARG=debug"
|
||||
if /I "%CONFIG_ARG%"=="clang" set "CONFIG_ARG=debug"
|
||||
if /I "%CONFIG_ARG%"=="msvc" set "CONFIG_ARG=debug"
|
||||
|
||||
if /I "%COMPILER_TYPE%"=="clang" (
|
||||
set "PLATFORM=x64Clang"
|
||||
) else (
|
||||
set "PLATFORM=x64"
|
||||
)
|
||||
set "CONFIG=Debug"
|
||||
if /I "%CONFIG_ARG%"=="profile" set "CONFIG=Profile"
|
||||
if /I "%CONFIG_ARG%"=="release" set "CONFIG=Release"
|
||||
|
||||
:: --- 2. Generate Random ID & Setup Paths ---
|
||||
set "CONFIG=Debug"
|
||||
set "GAME_BUILD_ID=%RANDOM%"
|
||||
set "TARGET=Game-%PLATFORM%-%CONFIG%"
|
||||
set "OUT_DIR=%~dp0..\bin\%PLATFORM%-%CONFIG%"
|
||||
set "OUT_DIR=%~dp0..\bin\x64-%CONFIG%"
|
||||
|
||||
echo --- Building %TARGET% (ID: %GAME_BUILD_ID%) ---
|
||||
echo --- Building Game (ID: %GAME_BUILD_ID%) [%CONFIG%] ---
|
||||
|
||||
:: --- 3. Manage Lock File ---
|
||||
if not exist "%OUT_DIR%" mkdir "%OUT_DIR%"
|
||||
pushd "%OUT_DIR%"
|
||||
:: Clean up old DLLs/PDBs in this folder to prevent clutter
|
||||
del Game-*.dll Game-*.pdb > NUL 2> NUL
|
||||
del Game-*.dll Game-*.pdb Game-*.ilk Game-*.exp Game-*.lib > NUL 2> NUL
|
||||
echo %GAME_BUILD_ID% > lock.tmp
|
||||
popd
|
||||
|
||||
:: --- 4. Run FASTBuild ---
|
||||
:: We pass the ID via an Environment Variable so the .bff can read it
|
||||
:: --- 4. Run Build System ---
|
||||
:: Pass GAME_BUILD_ID environment variable so build.bat can use it
|
||||
set "GAME_BUILD_ID=%GAME_BUILD_ID%"
|
||||
fbuild %TARGET% -cache
|
||||
call "%~dp0build.bat" %CONFIG_ARG% game
|
||||
|
||||
if %ERRORLEVEL% NEQ 0 (
|
||||
echo.
|
||||
@@ -39,6 +37,9 @@ if %ERRORLEVEL% NEQ 0 (
|
||||
goto :cleanup
|
||||
)
|
||||
|
||||
:: Copy output to Game.dll for the engine to load
|
||||
copy /y "%OUT_DIR%\Game-%GAME_BUILD_ID%.dll" "%OUT_DIR%\Game.dll" > NUL
|
||||
|
||||
echo.
|
||||
echo SUCCESS: Generated %OUT_DIR%\Game-%GAME_BUILD_ID%.dll
|
||||
|
||||
|
||||
Reference in New Issue
Block a user