-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.bat
107 lines (98 loc) · 2.21 KB
/
build.bat
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
@echo off
setlocal
cd %~dp0
call setup_build_environment.bat
set MBT_THREADS=1
set MBT_DEBUG=0
set TARGET_PLATFORM=
set MATERIALS=
set prevArg=
:parse_args
set arg=%1
if "%arg%"=="" goto :end
if "%arg%"=="--threads" (
set prevArg=threads
goto :continue
)
if "%arg%"=="-t" (
set prevArg=threads
goto :continue
)
if "%arg%"=="--platform" (
set prevArg=platform
goto :continue
)
if "%arg%"=="-p" (
set prevArg=platform
goto :continue
)
if "%arg%"=="--material" (
set prevArg=material
goto :continue
)
if "%arg%"=="-m" (
set prevArg=material
goto :continue
)
if "%arg%"=="--debug" (
set MBT_DEBUG=1
goto :continue
)
if "%prevArg%"=="threads" (
set prevArg=
set MBT_THREADS=%arg%
goto :continue
)
if "%prevArg%"=="platform" (
set TARGET_PLATFORM=%TARGET_PLATFORM% %arg%
goto :continue
)
if "%prevArg%"=="material" (
set MATERIALS=%MATERIALS% %arg%
goto :continue
)
set TARGET_PLATFORM=%TARGET_PLATFORM% %arg%
:continue
shift
goto :parse_args
:end
set MBT_ARGS=--compile --shaderc %SHADERC% --include include --threads %MBT_THREADS%
if %MBT_DEBUG%==1 (
set MBT_ARGS=%MBT_ARGS% --debug
)
set ALL_PLATFORM=0
if "%TARGET_PLATFORM%"=="" (
set TARGET_PLATFORM=Windows Android iOS
set ALL_PLATFORM=1
)
for %%p in (%TARGET_PLATFORM%) do (
echo Building materials for %%p
if "%MATERIALS%"=="" (
for /d %%m in (materials\*) do (
echo Building %%~nxm
call :build %%p %%~nxm
)
) else (
for %%m in (%MATERIALS%) do (
echo Building %%m
call :build %%p %%m
)
)
echo.
)
goto :end
@REM %1 platform
@REM %2 material
:build
if exist materials\%2\data\%1\%2.json (
%MBT% %MBT_ARGS% --output build\%1 --data materials\%2\data\%1\%2.json materials\%2
) else (
if exist %DATA_DIR%\%1 (
%MBT% %MBT_ARGS% --output build\%1 --data %DATA_DIR%\%1\%2 materials\%2
) else (
echo No data found for material %2 on platform %1
)
)
goto :EOF
:end
endlocal