-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.bat
More file actions
137 lines (120 loc) · 4.44 KB
/
setup.bat
File metadata and controls
137 lines (120 loc) · 4.44 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
@REM project_starter_kit
@REM https://github.com/simongeilfus/project_starter_kit
@rem MIT License
@rem Copyright (c) 2022 Simon Geilfus
@rem Permission is hereby granted, free of charge, to any person obtaining a copy
@rem of this software and associated documentation files (the "Software"), to deal
@rem in the Software without restriction, including without limitation the rights
@rem to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@rem copies of the Software, and to permit persons to whom the Software is
@rem furnished to do so, subject to the following conditions:
@rem The above copyright notice and this permission notice shall be included in all
@rem copies or substantial portions of the Software.
@rem THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
@rem IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
@rem FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@rem AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
@rem LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
@rem OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
@rem SOFTWARE.
@rem ---------------------------------------------------------------------------
@rem GENERATES GIT COMMANDS TO SETUP PROJECT WITH REPOSITORIES AND/OR SUBMODULES
@rem ---------------------------------------------------------------------------
@echo off
setlocal EnableDelayedExpansion
echo project_starter_kit/setup.bat
@rem parse arguments
@rem -----------------------------------
set argc=0
for %%x in (%*) do (
set /A argc+=1
set "argv[!argc!]=%%~x"
)
@rem no argument message
@rem -----------------------------------
if %argc% lss 1 goto print_help
@rem build commands
@rem -----------------------------------
set needs_submodule_init=0
set commandc=0
set git_mode=submodule add
for /L %%e in (1,1,%argc%) do (
if !argv[%%e]! == clone (
@rem change mode to clone
set "git_mode=clone"
) else (
if !argv[%%e]! == submodule (
@rem change mode to submodule
set "git_mode=submodule add"
) else (
@rem check if this match the name of a git repository to setup
for /F "tokens=1,2,3,4" %%i in (%~dp0/tools/third_party.txt) do (
@rem if there's a match add the command to the list
if !argv[%%e]! == %%i (
set /A commandc+=1
set "commandv[!commandc!]=git !git_mode! %%k %%l %%j third_party/%%i"
set needs_submodule_init=1
)
)
@rem install cmake
if !argv[%%e]! == cmake (
set /A commandc+=1
set "commandv[!commandc!]=call tools\setup_cmake.bat"
)
@rem install python
if !argv[%%e]! == python (
set /A commandc+=1
set "commandv[!commandc!]=call tools\setup_python.bat"
)
@rem install vulkan
if !argv[%%e]! == vulkan (
set /A commandc+=1
set "commandv[!commandc!]=call tools\setup_vulkan.bat"
)
)
)
)
@rem no commands build warning message
@rem -----------------------------------
if %commandc% lss 1 (
echo:
echo Error: No commands were build
goto print_help
) else (
if %needs_submodule_init% == 1 (
@rem otherwise add default ending commands
set /A commandc+=1
set "commandv[!commandc!]=git submodule update --init --recursive"
)
)
@rem print commands
@rem -----------------------------------
echo This script will generate the following commands:
echo:
for /L %%i in (1,1,%commandc%) do echo !commandv[%%i]!
@rem confirm message
@rem -----------------------------------
echo:
choice /C YN /M "Do you want to execute those commands? "
echo:
goto option-%errorlevel%
:option-1
@rem execute commands
@rem -----------------------------------
for /L %%i in (1,1,%commandc%) do !commandv[%%i]!
goto end
:print_help
echo:
echo usage: setup [mode] lib0 lib1 [mode] lib2 lib3
echo mode defaults to "submodule" but can be set to "clone" or "submodule" in any order
echo available third party libraries:
for /F "tokens=1,2,3" %%i in (%~dp0/tools/third_party.txt) do echo %%i
@rem cleanup
@rem -----------------------------------
:option-2
:end
set argc=
set argv=
set commandc=
set commandv=
set needs_submodule_init=