-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.cmd
49 lines (40 loc) · 1.21 KB
/
build.cmd
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
@echo off
setlocal enabledelayedexpansion
@REM Check if an argument is provided and validate it
if "%~1"=="" (
@REM If no arguments are provided, set build type to Debug
set "build_type=Debug"
set "install=false"
) else (
@REM Convert the argument to lowercase
set "build_type=%~1"
set "build_type=!build_type:~0,1!!build_type:~1!"
@REM Check if the provided argument is either Release or Debug
if /I "!build_type!"=="release" (
set "build_type=Release"
) else if /I "!build_type!"=="debug" (
set "build_type=Debug"
) else if /I "!build_type!"=="install" (
set "install=true"
) else (
echo Error: Invalid build type '%~1'.
echo Please specify either 'Release' or 'Debug'.
exit /b 1
)
)
@REM Set build directory
set "build_dir=build\%build_type%"
if /I "!install!"=="true" (
@REM Build type message
echo Installation...
cmake -S . -B %build_dir% -DLIB_INSTALL=ON
cmake --install %build_dir%
) else (
@REM Build type message
echo Build type: %build_type%
@REM Run cmake with the appropriate build type
cmake -S . -B %build_dir% -G "Ninja" -DCMAKE_BUILD_TYPE=%build_type% -DDEVELOPMENT=ON
@REM Build the targets
cmake --build %build_dir% --parallel 16
)
endlocal