-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathBuild.COP.bat
More file actions
126 lines (111 loc) · 3.7 KB
/
Build.COP.bat
File metadata and controls
126 lines (111 loc) · 3.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
@echo off
chcp 65001 >nul
setlocal enabledelayedexpansion
:: 0. Check Windows version
for /f "tokens=2 delims=[]" %%a in ('ver') do set "ver=%%a"
for /f "tokens=2,3,4 delims=. " %%b in ("!ver!") do set /a "maj=%%b, min=%%c, build=%%d"
:: Windows 10 20H2 has version 10.0.19042. Windows 11 starts with version 10.0.22000
if !maj! lss 10 (
echo Windows 10 or higher is required.
pause
exit /b 1
) else if !maj! equ 10 (
if !build! lss 19042 (
echo Windows 10 version 20H2 or higher is required.
pause
exit /b 1
)
)
:: 1. Check for Unreal Engine version 5.3 installation
set "UEVersion=5.3"
set "RegistryKey=HKEY_LOCAL_MACHINE\SOFTWARE\EpicGames\Unreal Engine\%UEVersion%"
reg query "%RegistryKey%" >nul 2>&1
if %errorlevel% neq 0 (
echo Unreal Engine %UEVersion% is not installed.
pause
exit /b 1
)
:: Save path to UnrealBuildTool.exe in a variable
for /f "tokens=2*" %%A in ('reg query "%RegistryKey%" /v InstalledDirectory ^| find "REG_SZ"') do (
set "UnrealBuildToolPath=%%B\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.exe"
)
echo Path to UnrealBuildTool.exe: %UnrealBuildToolPath% >nul
:: 3. Check for Visual Studio 2022 installation
set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
for /f "tokens=*" %%i in ('"%VSWHERE%" -version 17 -property installationPath') do (
set "VSPath=%%i"
)
if "!VSPath!"=="" (
echo Visual Studio 2022 not found.
pause
exit /b 1
)
echo Path to Visual Studio: !VSPath! >nul
:: 4. Check for "Game development with C++" component installation
set "FOUND=0"
for /f "tokens=*" %%i in ('"%VSWHERE%" -version 17 -products * -requires Microsoft.VisualStudio.Workload.NativeGame -format text') do (
set "line=%%i"
if "!line:installationPath=!" neq "!line!" set "FOUND=1"
)
if "!FOUND!"=="0" (
echo "Game development with C++" package not found.
pause
exit /b 1
)
:: Path to VsDevCmd.bat
call "!VSPath!\Common7\Tools\VsDevCmd.bat" >nul
:: Configuration selection
echo Choose build configuration:
echo [1] Development (Development Editor) *Recommended
echo [2] Debug (DebugGame Editor)
set /p ConfigChoice="Enter configuration number: "
if "!ConfigChoice!"=="1" (
set "EngineConfig=Release"
set "StalkerConfig=Development Editor"
) else if "!ConfigChoice!"=="2" (
set "EngineConfig=Debug"
set "StalkerConfig=DebugGame Editor"
) else (
echo Invalid choice.
pause
exit /b 1
)
:: Build execution
echo Building COP project with %EngineConfig% (%StalkerConfig%)...
echo Start Build RedImage...
call msbuild "./Source/XRayEngine/Source/External/RedImage/RedImageTool/RedImageTool.vcxproj" /p:Configuration=Release /p:Platform=x64 /maxCpuCount /nologo
if errorlevel 1 (
echo Build of RedImage failed.
pause
exit /b 1
)
echo RedImage successfully built.
echo Start Build Engine with %EngineConfig%...
call msbuild "./Source/XRayEngine/Source/Engine.sln" /p:Configuration=%EngineConfig% /p:Platform=x64 /maxCpuCount /nologo
if errorlevel 1 (
echo Build of Engine failed.
pause
exit /b 1
)
echo EngineSOC successfully built.
if exist "%~dp0Stalker.sln" (
echo Project detected, skipping project generation.
) else (
call "%UnrealBuildToolPath%" -projectfiles -project="%~dp0Stalker.uproject" -game -engine -progress || (
echo Project generation failed.
pause
exit /b 1
)
echo Project successfully generated.
)
echo Start Build Stalker with %StalkerConfig%...
call msbuild "./Stalker.sln" /t:Games\Stalker /p:Configuration="%StalkerConfig%" /p:Platform=Win64 /maxCpuCount /nologo
if errorlevel 1 (
echo Build of Stalker failed.
pause
exit /b 1
)
echo Stalker successfully built.
echo Project successfully built.
pause
endlocal