-
Notifications
You must be signed in to change notification settings - Fork 2
/
action.bat
155 lines (111 loc) · 2.84 KB
/
action.bat
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
@echo off
SET SCRIPTS_DIR=%~dp0
SET SCRIPTS_DIR=%SCRIPTS_DIR:~0,-1%
SET RUN_LOCATION=%CD%
setlocal enableDelayedExpansion
SET compile=0
SET compile_vrep=0
SET debug=0
SET run=0
SET vrep=0
SET verbose=0
FOR %%x in (%*) do (
IF "%%x" == "compile" (
IF !verbose! EQU 1 (
echo Script will compile the controller
)
SET compile=1
) ELSE IF "%%x" == "compile-vrep" (
echo Script will compile with vrep support
SET compile_vrep=1
IF NOT %compile% EQU 1 (
SET compile=1
)
) ELSE IF "%%x" == "debug" (
IF !verbose! EQU 1 (
echo Script will compile controller for debug mode
)
SET debug=1
IF NOT %compile% EQU 1 (
SET compile=1
)
) ELSE IF "%%x" == "run" (
IF !verbose! EQU 1 (
echo Script will start sim
)
SET run=1
) ELSE IF "%%x" == "sim" (
IF !verbose! EQU 1 (
echo Script will start sim
)
SET run=1
) ELSE IF "%%x" == "verbose" (
echo Script will have verbose output
SET verbose=1
) ELSE IF "%%x" == "vrep" (
IF !verbose! EQU 1 (
echo Script will start vrep
)
SET vrep=1
) ELSE (
echo ERROR: Bad argument "%%x"
echo Appropriate arguments are any combination of:
echo compile compile the custom controller
echo compile-vrep compile with vrep support
echo sim^|run run the simulation
echo vrep start vrep simulator
echo verbose verbose output during this script
echo.
GOTO END_OF_SCRIPT
)
)
IF %verbose% EQU 1 (
echo Script options are:
echo compile=%compile%
echo debug=%debug%
echo run=%run%
echo verbose=%verbose%
echo vrep=%vrep%
)
IF %compile% EQU 1 (
IF %verbose% EQU 1 (
echo.
echo Generating project
)
cd "%SCRIPTS_DIR%"
"%ACE_ROOT%\bin\mwc.pl" -type vc12 -features vrep=%compile_vrep%,tests=0 workspace.mwc
IF %debug% EQU 1 (
IF %verbose% EQU 1 (
echo Building debug-mode controller
)
msbuild "workspace.sln" /maxcpucount /t:Rebuild /clp:NoSummary;NoItemAndPropertyList;ErrorsOnly /verbosity:quiet /nologo /p:Configuration=Debug;Platform=X64
) ELSE (
IF %verbose% EQU 1 (
echo Building release-mode controller
)
msbuild "workspace.sln" /maxcpucount /t:Rebuild /clp:NoSummary;NoItemAndPropertyList;ErrorsOnly /verbosity:quiet /nologo /p:Configuration=Release;Platform=X64
)
)
IF %vrep% EQU 1 (
IF %verbose% EQU 1 (
echo.
echo Starting VREP
)
start "vrepstart" /D "%VREP_ROOT%" "vrep"
IF %verbose% EQU 1 (
echo Sleeping for 10s to allow VREP to load
)
TIMEOUT /t 10 /nobreak > NUL
)
IF %run% EQU 1 (
IF %verbose% EQU 1 (
echo.
echo Running simulation
)
cd "%SCRIPTS_DIR%\sim"
perl run.pl
)
:END_OF_SCRIPT
endlocal
cd %RUN_LOCATION%
@echo on