-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathpid.bat
More file actions
executable file
·94 lines (83 loc) · 2.16 KB
/
pid.bat
File metadata and controls
executable file
·94 lines (83 loc) · 2.16 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
@echo off
setlocal enableDelayedExpansion
set source_dir=%~dp0
rem Set the arguments as environment variables and store CMake options
:loop_start
if [%1] == [] goto after_loop
set command=%1
set value=%2
if "!command:~0,2!"=="-D" (
set cmake_options=!cmake_options! !command!=!value!
shift
shift
goto loop_start
)
if [!target!] == [] (
if [!fake_target!] == [] (
if "!command!"=="workspace" (
set fake_target=!command!
shift
goto loop_start
)
if "!command!"=="configure" (
set fake_target=!command!
shift
goto loop_start
)
)
set target=!command!
shift
goto loop_start
) else (
rem Set the command/value pair as an environment variable
set !command!=!value!
shift
shift
goto loop_start
)
:after_loop
rem Don't ask me why this line is required
if "!fake_target!"=="workspace" (
set cmake_options_backup=!cmake_options!
set cmake_options=""
call :run !source_dir! workspace_path
set cmake_options=!cmake_options_backup!
for /f "delims=" %%a in (!source_dir!\build\ws_path.txt) do (
set ws_dir=%%a
)
if "!target!"=="configure" (
call :configure !ws_dir!
) else (
call :run !ws_dir! , !target!
)
goto :eof
)
if "!fake_target!"=="configure" (
call :configure !source_dir!
goto :eof
)
call :run !source_dir! , !target!
goto :eof
rem %~1: source dir, %~2 cmake options
:configure
cmake -S %~1 -B %~1/build !cmake_options!
exit /B %ERRORLEVEL%
rem %~1: source_dir, uses !cmake_options!
:apply_options
if not [!cmake_options!] == [] (
call :configure %~1
)
exit /B %ERRORLEVEL%
rem %~1: source_dir, %~2: target
:run
rem Configure the project a first time if necessary
if not exist %~1\build\CMakeCache.txt (
cmake -S %~1 -B %~1\build
)
call :apply_options %~1
if [%~2] == [] (
cmake --build %~1\build
) else (
cmake --build %~1\build --target %~2
)
exit /B %ERRORLEVEL%