-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmake.bat
More file actions
76 lines (63 loc) · 1.58 KB
/
make.bat
File metadata and controls
76 lines (63 loc) · 1.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
@echo off
setlocal enabledelayedexpansion
rem Default preset (matches Makefile default)
set "PRESET=linux-debug"
rem Parse arguments: action (build/configure/clean/rebuild) and KEY=VALUE pairs
set "ACTION="
:parse_loop
if "%~1"=="" goto parsed
if "%~1"=="-h" goto usage
if "%~1"=="--help" goto usage
echo "%~1" | findstr "=" >nul
if %ERRORLEVEL% EQU 0 (
for /f "tokens=1* delims==" %%A in ("%~1") do (
if /I "%%A"=="PRESET" (
set "PRESET=%%B"
) else (
set "%%A=%%B"
)
)
) else (
if not defined ACTION set "ACTION=%~1"
)
shift
goto parse_loop
:parsed
if not defined ACTION set "ACTION=build"
if /I "%ACTION%"=="all" set "ACTION=build"
if /I "%ACTION%"=="configure" (
cmake --preset=%PRESET%
exit /b %ERRORLEVEL%
)
if /I "%ACTION%"=="build" (
cmake --preset=%PRESET%
if errorlevel 1 exit /b %ERRORLEVEL%
cmake --build --preset=%PRESET%
exit /b %ERRORLEVEL%
)
if /I "%ACTION%"=="clean" (
cmake --build --preset=%PRESET% --target clean
exit /b %ERRORLEVEL%
)
if /I "%ACTION%"=="rebuild" (
cmake --build --preset=%PRESET% --target clean
if errorlevel 1 exit /b %ERRORLEVEL%
cmake --preset=%PRESET%
if errorlevel 1 exit /b %ERRORLEVEL%
cmake --build --preset=%PRESET%
exit /b %ERRORLEVEL%
)
echo Unknown action "%ACTION%".
goto usage
:usage
echo Usage: %~n0 [action] [KEY=VALUE]...
echo.
echo Actions:
echo build Configure and build (default)
echo configure Run cmake --preset=PRESET
echo clean Run cmake --build --preset=PRESET --target clean
echo rebuild Clean + configure + build
echo.
echo Examples:
echo %~n0 build PRESET=desktop-debug
exit /b 1