There comes a time in every self-respecting game developer’s life when they have to rebuild the entire engine along with the game they’re making.
This usually happens when installing the latest version of Visual Studio that came with compiler improvements to MSVC.

What you typically want to do is ensure that everything gets recompiled properly by way of cleaning + rebuilding your source code and given the time it takes along with the number of configuration targets (debug, dev, test, etc.) it’s best to automate the process, not forgetting the various UE4 programs e.g. UnrealHeaderTool, UE4Client, UE4Game etc. along the way.

There are 3 scripts here to do that, one for cleaning everything, the other for compiling and the third one just for chaining the two together.
Copy-paste these into 3 .bat files and edit the paths inside the SET THESE UP! block.
If you want to change the target build configurations, edit MY_BUILD_CONFIGS

compile_everything.bat

REM ============== SET THESE UP! ==============
set GAMENAME=Horu
set UE4DIR=d:\Work\UE4Source_422
set PROJECTDIR=c:\Work\Horu\Horu
set LOGDIR=d:\Temp
REM ===========================================

set MY_BUILD_CONFIGS=Development,Debug,DebugGame,Test
set UBTPATH=%UE4DIR%\Engine\Binaries\DotNET
set PROJECTFILE=%PROJECTDIR%\%GAMENAME%.uproject
set ALL_THE_PROGRAMS=SymbolDebugger,TestPAL,UnrealCEFSubProcess,UnrealFileServer,UnrealFrontend,UnrealLightmass,UnrealMultiUserServer,UnrealPak,UnrealVersionSelector,UnrealWatchdog,BootstrapPackagedGame,BlankProgram,UnrealHeaderTool,BuildPatchTool,CrashReportClient,LiveCodingConsole,MinidumpDiagnostics,WebRTCProxy,ShaderCompileWorker,SlateViewer,UE4Client,UnrealPak,UE4Game

echo Build log of %GAMENAME% > %LOGDIR%\ue4_build.log
echo Build configurations: %MY_BUILD_CONFIGS% >> %LOGDIR%\ue4_build.log
echo Programs: %ALL_THE_PROGRAMS% >> %LOGDIR%\ue4_build.log

echo. >> %LOGDIR%\ue4_build.log
echo Build started: >> %LOGDIR%\ue4_build.log
date /t >> %LOGDIR%\ue4_build.log
time /t >> %LOGDIR%\ue4_build.log

(for %%a in (%MY_BUILD_CONFIGS%) do (
  REM programs
  
  echo. >> %LOGDIR%\ue4_build.log
  echo Building programs / %%a: >> %LOGDIR%\ue4_build.log
  date /t >> %LOGDIR%\ue4_build.log
  time /t >> %LOGDIR%\ue4_build.log
  
  (for %%b in (%ALL_THE_PROGRAMS%) do (
    call %UBTPATH%\UnrealBuildTool.exe %%b Win64 %%a -WaitMutex -FromMsBuild
  ))
  
  echo. >> %LOGDIR%\ue4_build.log
  echo Finished building programs / %%a: >> %LOGDIR%\ue4_build.log
  date /t >> %LOGDIR%\ue4_build.log
  time /t >> %LOGDIR%\ue4_build.log
  
  REM editor
  
  echo. >> %LOGDIR%\ue4_build.log
  echo Building the editor / %%a: >> %LOGDIR%\ue4_build.log
  date /t >> %LOGDIR%\ue4_build.log
  time /t >> %LOGDIR%\ue4_build.log
  
  call %UBTPATH%\UnrealBuildTool.exe UE4Editor Win64 %%a -WaitMutex -FromMsBuild
  
  echo. >> %LOGDIR%\ue4_build.log
  echo Finished building the editor / %%a: >> %LOGDIR%\ue4_build.log
  date /t >> %LOGDIR%\ue4_build.log
  time /t >> %LOGDIR%\ue4_build.log
  
  REM game
  
  echo. >> %LOGDIR%\ue4_build.log
  echo Building %GAMENAME% / %%a: >> %LOGDIR%\ue4_build.log
  date /t >> %LOGDIR%\ue4_build.log
  time /t >> %LOGDIR%\ue4_build.log
  
  call %UBTPATH%\UnrealBuildTool.exe %GAMENAME% Win64 %%a -Project="%PROJECTFILE%" -WaitMutex -FromMsBuild
  call %UBTPATH%\UnrealBuildTool.exe %GAMENAME%Editor Win64 %%a -Project="%PROJECTFILE%" -WaitMutex -FromMsBuild
  
  echo. >> %LOGDIR%\ue4_build.log
  echo Finished building %GAMENAME% / %%a: >> %LOGDIR%\ue4_build.log
  date /t >> %LOGDIR%\ue4_build.log
  time /t >> %LOGDIR%\ue4_build.log
  
  echo ====== Configuration %%a ready! ====== >> %LOGDIR%\ue4_build.log
))

echo. >> %LOGDIR%\ue4_build.log
echo Build finished: >> %LOGDIR%\ue4_build.log
date /t >> %LOGDIR%\ue4_build.log
time /t >> %LOGDIR%\ue4_build.log

clean_everything.bat

REM ============== SET THESE UP! ==============
set GAMENAME=Horu
set UE4DIR=d:\Work\UE4Source_422
set PROJECTDIR=c:\Work\Horu\Horu
set LOGDIR=d:\Temp
REM ===========================================

set MY_BUILD_CONFIGS=Development,Debug,DebugGame,Test,Shipping
set UBTPATH=%UE4DIR%\Engine\Binaries\DotNET
set PROJECTFILE=%PROJECTDIR%\%GAMENAME%.uproject
set ALL_THE_PROGRAMS=SymbolDebugger,TestPAL,UnrealCEFSubProcess,UnrealFileServer,UnrealFrontend,UnrealLightmass,UnrealMultiUserServer,UnrealPak,UnrealVersionSelector,UnrealWatchdog,BootstrapPackagedGame,BlankProgram,UnrealHeaderTool,BuildPatchTool,CrashReportClient,LiveCodingConsole,MinidumpDiagnostics,WebRTCProxy,ShaderCompileWorker,SlateViewer,UE4Client,UnrealPak,UE4Game

(for %%a in (%MY_BUILD_CONFIGS%) do (
  (for %%b in (%ALL_THE_PROGRAMS%) do (
    call %UBTPATH%\UnrealBuildTool.exe %%b Win64 %%a -WaitMutex -FromMsBuild -clean
  ))
  
  call %UBTPATH%\UnrealBuildTool.exe UE4Editor Win64 %%a -WaitMutex -FromMsBuild -clean
  call %UBTPATH%\UnrealBuildTool.exe %GAMENAME% Win64 %%a -Project="%PROJECTFILE%" -WaitMutex -FromMsBuild -clean
  call %UBTPATH%\UnrealBuildTool.exe %GAMENAME%Editor Win64 %%a -Project="%PROJECTFILE%" -WaitMutex -FromMsBuild -clean
))

recompile_everything.bat

echo CLEANING EVERYTHING!
call clean_everything.bat
echo COMPILING EVERYTHING!
call compile_everything.bat

 

Published

Comments

No Comments

Leave a Reply