You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
75 lines
2.2 KiB
Batchfile
Executable File
75 lines
2.2 KiB
Batchfile
Executable File
@echo off
|
|
|
|
rem ## Unreal Engine 5 utility script
|
|
rem ## Copyright Epic Games, Inc. All Rights Reserved.
|
|
rem ##
|
|
rem ## This script verifies that dotnet sdk is installed and a new enough SDK is present, alternatively setups up the submitted SDK for use.
|
|
|
|
rem if UE_USE_SYSTEM_DOTNET we assume a installed dotnet is present
|
|
if "%UE_USE_SYSTEM_DOTNET%" == "1" goto verify_dotnet
|
|
|
|
rem add the dotnet sdk in the repo as the current dotnet sdk
|
|
set UE_DOTNET_DIR=%~dp0..\..\Binaries\ThirdParty\DotNet\Windows
|
|
set PATH=%UE_DOTNET_DIR%;%PATH%
|
|
set DOTNET_ROOT=%UE_DOTNET_DIR%
|
|
|
|
rem Disables use of any installed version of dotnet
|
|
set DOTNET_MULTILEVEL_LOOKUP=0
|
|
|
|
rem skip dotnet verification when using our submitted sdk as we know it is up to date
|
|
ECHO Using bundled DotNet SDK
|
|
goto Succeeded
|
|
|
|
:verify_dotnet
|
|
|
|
for /f "delims=" %%i in ('where dotnet') do (
|
|
REM Dotnet exists
|
|
goto find_sdks
|
|
)
|
|
|
|
REM Dotnet command did not exist
|
|
exit /B 1
|
|
|
|
:find_sdks
|
|
|
|
set REQUIRED_MAJOR_VERSION=3
|
|
set REQUIRED_MINOR_VERSION=1
|
|
|
|
set FOUND_MAJOR=
|
|
set FOUND_MINOR=
|
|
REM Unfortunately dotnet lists the sdks in oldest version first, thus we will pick the oldest version that matches our criteria as valid.
|
|
REM This does not really matter as we are just trying to verify that a new enough SDK is actually present
|
|
for /f "tokens=1,* delims= " %%I in ('dotnet --list-sdks') do (
|
|
|
|
for /f "tokens=1,2,3 delims=." %%X in ("%%I") do (
|
|
REM We can check the patch version for preview versions and ignore those, but it slowed down this batch to much so accepting those for now.
|
|
REM We do not actually use the determined version for anything so usually the newest SDK installed is used anyway
|
|
if %%X EQU %REQUIRED_MAJOR_VERSION% (
|
|
REM If the major version is the same as we require we check the minor version
|
|
if %%Y GEQ %REQUIRED_MINOR_VERSION% (
|
|
|
|
set FOUND_MAJOR=%%X
|
|
set FOUND_MINOR=%%Y
|
|
ECHO Found Dotnet SDK version: %%X.%%Y
|
|
goto Succeeded
|
|
)
|
|
)
|
|
|
|
if %%X GTR %REQUIRED_MAJOR_VERSION% (
|
|
REM If the major version is greater then what we require then this sdk is good enough
|
|
set FOUND_MAJOR=%%X
|
|
set FOUND_MINOR=%%Y
|
|
ECHO Found Dotnet SDK version: %%X.%%Y
|
|
goto Succeeded
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
REM Dotnet is installed but the sdk present is to old
|
|
exit /B 1
|
|
|
|
:Succeeded
|
|
exit /B 0
|
|
|