forked from GameTechDev/UnrealCapabilityDetect
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnrealEnginePluginBuilder.bat
More file actions
154 lines (131 loc) · 4.58 KB
/
UnrealEnginePluginBuilder.bat
File metadata and controls
154 lines (131 loc) · 4.58 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
REM ========================================
REM EDITABLE PATHS - Edit these sections
REM ========================================
REM Plugin name (.uplugin file name without extension)
set "PLUGIN_NAME=CapabilityDetect"
REM Engine directory
set "ENGINE_DIR=D:\Program Files\Epic Games\UE_5.7"
REM Plugin directory path
set "PLUGIN_PATH=D:\GithubRepos\UnrealCapabilityDetectExtended\Plugins\%PLUGIN_NAME%"
REM Build output directory
set "BUILD_OUTPUT=D:\GithubRepos\UnrealCapabilityDetectExtended\UnrealEnginePluginBuilder\%PLUGIN_NAME%"
REM Build.cs file path for auto-update (in build output, not original)
set "BUILD_CS_PATH=%BUILD_OUTPUT%\Source\%PLUGIN_NAME%\%PLUGIN_NAME%.Build.cs"
@echo off
echo ========================================
echo %PLUGIN_NAME% Plugin Builder
echo ========================================
echo.
REM ========================================
REM Automatic checks
REM ========================================
echo Performing checks...
echo.
REM Engine directory check
if not exist "%ENGINE_DIR%\Engine\Build\BatchFiles\RunUAT.bat" (
echo ERROR: Engine directory not found!
echo Please check ENGINE_DIR path: %ENGINE_DIR%
echo.
pause
exit /b 1
)
REM Plugin file check
if not exist "%PLUGIN_PATH%\%PLUGIN_NAME%.uplugin" (
echo ERROR: Plugin file not found!
echo Please check PLUGIN_PATH: %PLUGIN_PATH%
echo.
pause
exit /b 1
)
REM Create build output directory
if not exist "%BUILD_OUTPUT%" (
echo Creating build output directory: %BUILD_OUTPUT%
mkdir "%BUILD_OUTPUT%"
)
echo All checks passed successfully!
echo.
REM ========================================
REM Build command
REM ========================================
echo Building plugin...
echo.
echo Engine: %ENGINE_DIR%
echo Plugin: %PLUGIN_PATH%\%PLUGIN_NAME%.uplugin
echo Output: %BUILD_OUTPUT%
echo Build.cs: %BUILD_CS_PATH%
echo.
echo Executing build command...
echo.
start "Plugin Build" cmd /k ""%ENGINE_DIR%\Engine\Build\BatchFiles\RunUAT.bat" BuildPlugin -Plugin="%PLUGIN_PATH%\%PLUGIN_NAME%.uplugin" -Package="%BUILD_OUTPUT%" -TargetPlatforms=Win64 -Rocket -precompile"
REM Wait for build to complete (check if output files exist)
echo Waiting for build to complete...
:WAIT_LOOP
timeout /t 10 /nobreak >nul
if exist "%BUILD_OUTPUT%\Source\%PLUGIN_NAME%\%PLUGIN_NAME%.Build.cs" (
echo Build completed! Starting post-build operations...
goto POST_BUILD
) else (
echo Still waiting for build to complete...
goto WAIT_LOOP
)
:POST_BUILD
REM ========================================
REM Result check and auto-update
REM ========================================
echo.
echo ========================================
echo BUILD SUCCESSFUL!
echo ========================================
echo.
echo Plugin built successfully!
echo Output directory: %BUILD_OUTPUT%
echo.
REM ========================================
REM Auto-update Build.cs file
REM ========================================
echo Updating Build.cs file...
echo.
REM Update bPrecompile to bUsePrecompiled
echo Replacing bPrecompile=true with bUsePrecompiled=true...
REM Use PowerShell to perform the replacement (fixed command)
powershell -Command "$content = Get-Content '%BUILD_CS_PATH%'; $content = $content -replace 'bPrecompile = true;', 'bUsePrecompiled = true;'; Set-Content '%BUILD_CS_PATH%' -Value $content"
if %ERRORLEVEL% EQU 0 (
echo Build.cs file updated successfully!
echo Changed: bPrecompile = true; -> bUsePrecompiled = true;
) else (
echo WARNING: Failed to update Build.cs file automatically.
echo Please manually change bPrecompile = true; to bUsePrecompiled = true;
)
echo.
echo ========================================
echo AUTO-UPDATE COMPLETED!
echo ========================================
echo.
echo Next steps:
echo 1. Build.cs file has been automatically updated
echo 2. Plugin is now ready for precompiled use
echo 3. Copy plugin to Engine directory
echo 4. Remove plugin from project directory
echo.
echo Build and update completed successfully!
echo.
echo Plugin is ready for use!
echo.
echo Press any key to close this window...
pause >nul
exit /b 0
) else (
echo.
echo ========================================
echo BUILD FAILED!
echo ========================================
echo.
echo Error code: %ERRORLEVEL%
echo Please check error messages above.
echo.
echo Build failed! No changes made to Build.cs file.
echo.
echo Press any key to close this window...
pause >nul
exit /b 1
)