-
Notifications
You must be signed in to change notification settings - Fork 12
/
BuildVSGravity.bat
304 lines (257 loc) · 8.27 KB
/
BuildVSGravity.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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
::** (C) Copyright 2013, Applied Physical Sciences Corp., A General Dynamics Company
::**
::** Gravity is free software; you can redistribute it and/or modify
::** it under the terms of the GNU Lesser General Public License as published by
::** the Free Software Foundation; either version 3 of the License, or
::** (at your option) any later version.
::**
::** This program is distributed in the hope that it will be useful,
::** but WITHOUT ANY WARRANTY; without even the implied warranty of
::** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
::** GNU Lesser General Public License for more details.
::**
::** You should have received a copy of the GNU Lesser General Public
::** License along with this program;
::** If not, see <http://www.gnu.org/licenses/>.
::**
@echo off
setlocal
set Clean=1
if not defined GRAVITY_HOME (
echo You must define GRAVITY_HOME
goto build_fail
end
)
if not defined BOOST_HOME (
echo You must define BOOST_HOME
goto build_fail
end
)
if not defined PROTOBUF_HOME (
echo You must define PROTOBUF_HOME
goto build_fail
end
)
if not defined ZMQ_HOME (
echo You must define ZMQ_HOME
goto build_fail
end
)
if not defined PTHREADS_HOME (
echo You must define PTHREADS_HOME
goto build_fail
end
)
if not defined GRAVITY_THIRD_PARTY_LIBS (
echo You must define GRAVITY_THIRD_PARTY_LIBS
goto build_fail
end
)
if not defined LEX_CMD (
set LEX_CMD=win_flex.exe
)
if not defined YACC_CMD (
set YACC_CMD=win_bison.exe
)
:menu
echo.
echo ===========================
echo ===== BUILD OPTIONS =======
echo.
echo 1 - Release VS2010 32-bit
echo 2 - Debug VS2010 32-bit
echo 3 - Gravity Components (VS2010 32-bit executables)
echo 4 - Debug VS2010 64-bit
echo 5 - Release VS2010 64-bit
echo 6 - Gravity Components (VS2010 64-bit executables)
echo 7 - Debug VS2012 64-bit
echo 8 - Release VS2012 64-bit
echo 9 - Gravity Components (VS2012 64-bit executables)
echo Q - Quit
echo Build Selection:
::choice /c:123456789Q>nul
choice /c:123456789Q>nul
::if errorlevel 0 goto done
if errorlevel 9 goto GravityComponents_2012_64
if errorlevel 8 goto VS201264R
if errorlevel 7 goto VS201264D
if errorlevel 6 goto GravityComponents64
if errorlevel 5 goto VS201064R
if errorlevel 4 goto VS201064D
if errorlevel 3 goto GravityComponents
if errorlevel 2 goto VS201032D
if errorlevel 1 goto VS201032R
echo NO SELECTION
goto done
:VS201232R
echo ========== BUILDING VS2012 32-bit Release ==========
call setenv /x86 /release
set CONFIGURATION= /p:Configuration=Release /p:Platform=Win32 /p:PlatformToolset=v110
goto build
:VS201232D
echo ========== BUILDING VS2012 32-bit Debug ==========
call setenv /x86 /debug
set CONFIGURATION= /p:Configuration=Debug /p:Platform=Win32 /p:PlatformToolset=v110
goto build
:VS201264R
echo ========== BUILDING VS2012 64-bit Release ==========
call setenv /x64 /release
set CONFIGURATION= /p:Configuration=Release2012 /p:Platform=x64 /p:VisualStudioVersion=11.0
set PROTOC_DIR=x64\Release2012\bin
set GRAVITY_LIB_PATH=..\..\..\x64\Release2012\lib
set GRAVITY_CONFIG=RELEASE2012
goto build
:VS201264D
echo ========== BUILDING VS2012 64-bit Debug ==========
call setenv /x64 /debug
set CONFIGURATION= /p:Configuration=Debug /p:Platform=x64 /p:PlatformToolset=v110
goto build
:VS201032R
echo ========== BUILDING VS2010 32-bit Release ==========
call setenv /x86 /release
set CONFIGURATION= /p:Configuration=Release2010 /p:Platform=Win32 /p:PlatformToolset=Windows7.1SDK
set PROTOC_DIR=Win32\Release2010\bin
set GRAVITY_LIB_PATH=..\..\..\Win32\Release2010\lib
set GRAVITY_CONFIG=RELEASE
goto build
:VS201032D
echo ========== BUILDING VS2010 32-bit Debug ==========
call setenv /x86 /debug
set CONFIGURATION= /p:Configuration=Debug2010 /p:Platform=Win32 /p:PlatformToolset=Windows7.1SDK
set PROTOC_DIR=Win32\Debug2010\bin
set GRAVITY_LIB_PATH=..\..\..\Win32\Debug2010\lib
set GRAVITY_CONFIG=DEBUG
goto build
:VS201064R
echo ========== BUILDING VS2010 64-bit Release ==========
call setenv /x64 /release
set CONFIGURATION= /p:Configuration=Release2010 /p:Platform=x64 /p:PlatformToolset=Windows7.1SDK
set PROTOC_DIR=x64\Release2010\bin
set GRAVITY_LIB_PATH=..\..\..\x64\Release2010\lib
set GRAVITY_CONFIG=RELEASE
goto build
:VS201064D
echo ========== BUILDING VS2010 64-bit Debug ==========
call setenv /x64 /debug
set CONFIGURATION= /p:Configuration=Debug2010 /p:Platform=x64 /p:PlatformToolset=Windows7.1SDK
set PROTOC_DIR=x64\Debug2010\bin
set GRAVITY_LIB_PATH=..\..\..\x64\Debug2010\lib
set GRAVITY_CONFIG=DEBUG
goto build
:GravityComponents64
:: 64-bit release for all the components
call setenv /x64 /release
set CONFIGURATION= /p:Configuration=Release2010 /p:Platform=x64 /p:PlatformToolset=Windows7.1SDK
goto BuildGravityComponents
:GravityComponents
:: 32-bit release for all the components
call setenv /x86 /release
set CONFIGURATION= /p:Configuration=Release2010 /p:Platform=Win32 /p:PlatformToolset=Windows7.1SDK
:BuildGravityComponents
echo ========== BUILDING ServiceDirectory ==========
pushd build\msvs\components\ServiceDirectory
if %Clean% EQU 1 (
msbuild /target:Clean %CONFIGURATION% ServiceDirectory.sln || goto build_fail
)
msbuild /target:ServiceDirectory %CONFIGURATION% ServiceDirectory.sln || goto build_fail
popd
::goto SkipArchiverAndPlayback
echo ========== BUILDING Archiver ==========
pushd build\msvs\components\Archiver
if %Clean% EQU 1 (
msbuild /target:Clean %CONFIGURATION% Archiver.sln || goto build_fail
)
msbuild /target:Archiver %CONFIGURATION% Archiver.sln || goto build_fail
popd
echo ========== BUILDING Playback ==========
pushd build\msvs\components\Playback
if %Clean% EQU 1 (
msbuild /target:Clean %CONFIGURATION% Playback.sln || goto build_fail
)
msbuild /target:Playback %CONFIGURATION% Playback.sln || goto build_fail
popd
:SkipArchiverAndPlayback
echo ========== BUILDING ConfigServer ==========
pushd build\msvs\components\ConfigServer
if %Clean% EQU 1 (
msbuild /target:Clean %CONFIGURATION% ConfigServer.sln || goto build_fail
)
msbuild /target:ConfigServer %CONFIGURATION% ConfigServer.sln || goto build_fail
popd
echo ========== BUILDING LogRecorder ==========
pushd build\msvs\components\LogRecorder
if %Clean% EQU 1 (
msbuild /target:Clean %CONFIGURATION% LogRecorder.sln || goto build_fail
)
msbuild /target:LogRecorder %CONFIGURATION% LogRecorder.sln || goto build_fail
popd
goto menu
:build
:: Build keyvalue parser
echo ========== BUILDING keyvalue_parser ==========
pushd build\msvs\keyvalue_parser
if %Clean% EQU 1 (
msbuild /target:Clean %CONFIGURATION% keyvalue_parser.sln || goto build_fail
)
msbuild %CONFIGURATION% keyvalue_parser.sln || goto build_fail
popd
:: Build Gravity
echo ========== BUILDING gravity ==========
pushd build\msvs\gravity
if %Clean% EQU 1 (
msbuild /target:Clean %CONFIGURATION% gravity.sln || goto build_fail
)
msbuild /target:gravity %CONFIGURATION% gravity.sln || goto build_fail
popd
:: Populate the include directory
echo ========== Populating include directory ==========
md include
copy src\api\cpp\*.h include
md include\protobuf
copy src\api\cpp\protobuf\GravityDataProductPB.pb.h include\protobuf
copy src\api\cpp\protobuf\GravityMetricsDataPB.pb.h include\protobuf
xcopy /s /y %PROTOBUF_HOME%\src\*.h include
xcopy /s /y %PTHREADS_HOME%\include\*.h include
md include\MATLAB
copy src\api\MATLAB\*.m include\MATLAB
::md lib\MATLAB
::copy src\api\MATLAB\*.jar lib\MATLAB
echo.
echo ================================
echo ======= BUILD SUCCESSFUL =======
echo ================================
echo.
echo.
echo ================================
echo ======== BUILDING JAVA =========
echo ================================
echo.
:java
:: Build libgravity_wrap
pushd build\msvs\libgravity_wrap
if %Clean% EQU 1 (
msbuild /target:Clean %CONFIGURATION% libgravity_wrap.sln || goto build_fail
)
msbuild %CONFIGURATION% libgravity_wrap.sln || goto build_fail
popd
pushd src\api\java
move gravity.jar %GRAVITY_LIB_PATH%
popd
echo.
echo ================================
echo ======= BUILDING MATLAB ========
echo ================================
echo.
pushd src\api\MATLAB
md build
javac -d build -cp %GRAVITY_LIB_PATH%/gravity.jar;guava-13.0.1.jar MATLABGravitySubscriber.java
jar cf MATLABGravitySubscriber.jar -C build .
md %GRAVITY_LIB_PATH%\MATLAB
copy MATLABGravitySubscriber.jar %GRAVITY_LIB_PATH%\MATLAB
copy guava-13.0.1.jar %GRAVITY_LIB_PATH%
popd
goto menu
:build_fail
popd
echo Build Failed
:done