2014-03-14 14:13:41 -04:00
|
|
|
@echo off
|
2022-10-06 19:45:24 -04:00
|
|
|
|
|
|
|
|
rem ## Unreal Engine code build script
|
|
|
|
|
rem ## Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
rem ##
|
|
|
|
|
rem ## This script is expecting to exist in the /Engine/Build/BatchFiles directory. It will not work correctly
|
|
|
|
|
rem ## if you copy it to a different location and run it.
|
|
|
|
|
rem ##
|
|
|
|
|
rem ## %1 is the game name
|
|
|
|
|
rem ## %2 is the platform name
|
|
|
|
|
rem ## %3 is the configuration name
|
|
|
|
|
rem ## additional args are passed directly to UnrealBuildTool
|
|
|
|
|
|
2015-07-17 16:35:40 -04:00
|
|
|
setlocal enabledelayedexpansion
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2022-10-06 19:45:24 -04:00
|
|
|
rem ## First, make sure the batch file exists in the folder we expect it to. This is necessary in order to
|
|
|
|
|
rem ## verify that our relative path to the /Engine/Source directory is correct
|
|
|
|
|
if not exist "%~dp0..\..\Source" goto Error_BatchFileInWrongLocation
|
|
|
|
|
|
|
|
|
|
rem ## Change the CWD to /Engine/Source. We always need to run UnrealBuildTool from /Engine/Source!
|
2014-03-14 14:13:41 -04:00
|
|
|
pushd "%~dp0\..\..\Source"
|
2022-10-26 17:31:21 -04:00
|
|
|
if not exist ..\Build\BatchFiles\Build.bat goto Error_BatchFileInWrongLocation
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2021-03-17 21:12:07 -04:00
|
|
|
set UBTPath="..\..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll"
|
2020-10-05 08:13:04 -04:00
|
|
|
|
2022-10-06 19:45:24 -04:00
|
|
|
rem ## Verify that dotnet is present
|
|
|
|
|
call "%~dp0GetDotnetPath.bat"
|
|
|
|
|
if errorlevel 1 goto Error_NoDotnetSDK
|
|
|
|
|
REM ## Skip msbuild detection if using dotnet as this is done for us by dotnet-cli
|
|
|
|
|
|
2023-01-24 20:57:06 -05:00
|
|
|
rem ## If this is an installed build, we don't need to rebuild UBT. Go straight to building.
|
|
|
|
|
if exist ..\Build\InstalledBuild.txt goto ReadyToBuild
|
|
|
|
|
|
2022-10-06 19:45:24 -04:00
|
|
|
rem ## Compile UBT if the project file exists
|
|
|
|
|
:ReadyToBuildUBT
|
|
|
|
|
set ProjectFile="Programs\UnrealBuildTool\UnrealBuildTool.csproj"
|
|
|
|
|
if not exist %ProjectFile% goto NoProjectFile
|
|
|
|
|
|
2022-10-26 17:31:21 -04:00
|
|
|
rem ## Only build if UnrealBuildTool.dll is missing, as Visual Studio or GenerateProjectFiles should be building UnrealBuildTool
|
|
|
|
|
rem ## Note: It is possible UnrealBuildTool will be out of date if the solution was generated with -NoDotNet or is VS2019
|
|
|
|
|
rem ## Historically this batch file did not compile UnrealBuildTool
|
|
|
|
|
if not exist %UBTPath% (
|
|
|
|
|
rem ## If this script was called from Visual Studio 2022, build UBT with Visual Studio to prevent unnecessary rebuilds.
|
|
|
|
|
if "%VisualStudioVersion%" GEQ "17.0" (
|
|
|
|
|
echo Building UnrealBuildTool with %VisualStudioEdition%...
|
|
|
|
|
"%VSAPPIDDIR%..\..\MSBuild\Current\Bin\MSBuild.exe" %ProjectFile% -t:Build -p:Configuration=Development -verbosity:quiet -noLogo
|
|
|
|
|
if errorlevel 1 goto Error_UBTCompileFailed
|
|
|
|
|
) else (
|
|
|
|
|
echo Building UnrealBuildTool with dotnet...
|
2022-11-09 21:04:55 -05:00
|
|
|
dotnet build %ProjectFile% -c Development -v quiet
|
2022-10-26 17:31:21 -04:00
|
|
|
if errorlevel 1 goto Error_UBTCompileFailed
|
|
|
|
|
)
|
2014-03-14 14:13:41 -04:00
|
|
|
)
|
2022-10-06 19:45:24 -04:00
|
|
|
:NoProjectFile
|
|
|
|
|
|
|
|
|
|
rem ## Run UBT
|
|
|
|
|
:ReadyToBuild
|
|
|
|
|
if not exist %UBTPath% goto Error_UBTMissing
|
|
|
|
|
echo Running UnrealBuildTool: dotnet %UBTPath% %*
|
|
|
|
|
dotnet %UBTPath% %*
|
2022-10-18 01:22:18 -04:00
|
|
|
EXIT /B !ERRORLEVEL!
|
2022-10-06 19:45:24 -04:00
|
|
|
|
|
|
|
|
:Error_BatchFileInWrongLocation
|
|
|
|
|
echo ERROR: The batch file does not appear to be located in the Engine/Build/BatchFiles directory. This script must be run from within that directory.
|
2022-10-18 01:22:18 -04:00
|
|
|
EXIT /B 999
|
2022-10-06 19:45:24 -04:00
|
|
|
|
|
|
|
|
:Error_NoDotnetSDK
|
2022-10-18 01:22:18 -04:00
|
|
|
echo ERROR: Unable to find an install of Dotnet SDK. Please make sure you have it installed and that `dotnet` is a globally available command.
|
|
|
|
|
EXIT /B 999
|
2022-10-06 19:45:24 -04:00
|
|
|
|
|
|
|
|
:Error_UBTCompileFailed
|
|
|
|
|
echo ERROR: Failed to build UnrealBuildTool.
|
2022-10-18 01:22:18 -04:00
|
|
|
EXIT /B 999
|
2022-10-06 19:45:24 -04:00
|
|
|
|
|
|
|
|
:Error_UBTMissing
|
|
|
|
|
echo ERROR: UnrealBuildTool.dll not found in %UBTPath%
|
2022-10-18 01:22:18 -04:00
|
|
|
EXIT /B 999
|