-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuild.bat
More file actions
100 lines (72 loc) · 2.47 KB
/
Build.bat
File metadata and controls
100 lines (72 loc) · 2.47 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
@echo off
REM #-#########-#
REM #- Globals -#
REM #-#########-#
SET g_TargetName=""
SET g_IsCustomPath=0
SET g_PathToTargetSource=""
REM #-######-#
REM #- Main -#
REM #-######-#
REM --------------------------------------------------------------------------------------------------------------------
:main
setlocal enabledelayedexpansion
set result=0
for %%A in (%*) do (
call :HandleArg result %%A
if !result! == 1 (
set g_TargetName=%%A
)
)
if "!g_TargetName!" == "" (
call :ShowHelp
)
if not exist "%~dp0Samples\!g_TargetName!\" (
call :ShowHelp
)
endlocal
exit /b 0
REM #-###########-#
REM #- Functions -#
REM #-###########-#
REM --------------------------------------------------------------------------------------------------------------------
:ShowHelp
echo How to use:
echo.
echo ./Build.sh [options...] project_name
echo.
echo.
echo Options
echo --ccomands - Generate compile_commands.json
echo --sample - Compile project from 'Samples' directory
echo --debug - Compile with debug utilities
echo --force - Force to always compile
echo --forcepurge - Force to always compile, purge old intermediate files
echo --tests - Creates a test build with tests
echo --testsonly - Creates a test build only with tests
echo --customtargetpath [path] - Compile project with custom path
echo --verbose - Print more informations
echo.
exit /b 0
REM --------------------------------------------------------------------------------------------------------------------
:Panic
echo Error! Cound't finish building the project due to error (Optional message: %1)
exit /b 1
REM --------------------------------------------------------------------------------------------------------------------
:CheckIfSwitch
goto :eof
REM --------------------------------------------------------------------------------------------------------------------
:HandleArg
setlocal enabledelayedexpansion
set argument=%2
set isSwitch=0
if "%g_IsCustomPath%" == 1 (
if "%g_PathToTargetSource%" == "" (
set g_PathToTargetSource = "%argument%"
set %1=0
goto :eof
)
)
endlocal
set %1=1
goto :eof