-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.xml
437 lines (395 loc) · 17.2 KB
/
build.xml
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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
<project name="v4l4j" default="usage"
xmlns:if="ant:if"
xmlns:unless="ant:unless">
<property file="build.properties"/>
<!--
destdir property is used when installing v4l4j.jar, JNIlib and javadoc
It is a prefix that will be added before install paths
-->
<condition property="destdir" value="${DESTDIR}" else="">
<isset property="DESTDIR"/>
</condition>
<path id="build.classpath">
<pathelement location="${project.src}"/>
<fileset dir="${project.lib}">
<include name="*.jar"/>
</fileset>
</path>
<path id="test.classpath">
<pathelement location="${project.classes}"/>
<pathelement location="${project.rsrc}"/>
<fileset dir="${project.lib}">
<include name="*.jar"/>
</fileset>
</path>
<script language="javascript"> <![CDATA[
project.setProperty("project.jnilib.dst", project.getProperty("project.rsrc")
+ "/libv4l4j-" + (project.getProperty("os.name").toLowerCase() || "")
+ "-" + (project.getProperty("os.arch").toLowerCase() || "")
+ "-" + (project.getProperty("sun.arch.abi") || "").toLowerCase()
+ ".so");
]]> </script>
<macrodef name="make">
<attribute name="dir"/>
<attribute name="debug" default="0"/>
<attribute name="failonerror" default="false"/>
<sequential>
<exec executable="make" failonerror="@{failonerror}">
<env if:set="debug" key="DEBUG" value="@{debug}"/>
<arg line="-j ${make.jobs}" />
<arg if:set="dir" line="-C @{dir}" />
</exec>
</sequential>
</macrodef>
<!-- default target that displays usage -->
<target name="usage">
<echo message=""/>
<echo message="Video4Linux4Java"/>
<echo message=""/>
<echo message="Available targets :"/>
<echo message=""/>
<echo message=" all : Build the JAR file and JNI library"/>
<echo message=" all-debug : Build the JAR file and JNI library with debug statments"/>
<echo message=" jar : Build a JAR file with the v4l4j classes"/>
<echo message=" jar-debug : Build a JAR file with the v4l4j classes (compiled with debug information)"/>
<echo message=" javadoc: Build the v4l4j Java documentation"/>
<echo message=" jar-src : Build a JAR file with the v4l4j classes and sources"/>
<echo message=" jnilib : Build the JNI library (libv4l4j.so)"/>
<echo message=" jnilib-debug : Build the JNI library with debug output(libv4l4j.so)"/>
<echo message=" install: Install v4l4j.jar, the JNI lib (must be root)"/>
<echo message=" uninstall: Uninstall v4l4j.jar, the JNI lib (must be root)"/>
<echo message=" install-doc: Build and install JavaDoc (must be root)"/>
<echo message=" uninstall-doc: Uninstall JavaDoc (must be root)"/>
<echo message=" clean: Remove all build generated files"/>
<echo message=" usage: Print this message"/>
<echo message=" ********************************************************" />
<echo message="" />
<echo message=" The following targets will work ONLY if v4l4j has been" />
<echo message=" installed using the 'install' target." />
<echo message=" test-fps : Check the FPS of a video source"/>
<echo message=" test-gui : Display video stream in a window"/>
<echo message=" test-server : Runs a TCP server to and MJPEG video stream to a web browser"/>
<echo message=" test-dual : Display video streams from two webcams in a windows"/>
<echo message=" test-getsnapshot: Get snapshots from a camera"/>
<echo message=" test-encoder: Test experimental encoder features"/>
<echo message=" deviceInfo: Display information about a video source"/>
<echo message=" asciiCam: Display video stream in the terminal as ASCII art"/>
<echo message=""/>
<echo message=""/>
<echo message="The 'install' target will copy v4l4j.jar in ${platform.standard.jar.location}, "/>
<echo message="the JNI library in ${platform.standard.jni.location} and the JavaDoc in ${platform.standard.javadoc.location}"/>
<echo message="By default, '${test.device}' is used as the video source. Capture resolution is set to " />
<echo message="${test.width}x${test.height}, using input ${test.channel} and video standard ${test.standard}."/>
<echo message="See the README file to change these default values." />
</target>
<target name="init">
<mkdir dir="${project.classes}"/>
</target>
<target name="all" depends="jnilib,jar"/>
<target name="all-debug" depends="jnilib-debug,jar-debug"/>
<target name="jnilib-debug" depends="init">
<exec executable="make">
<env key="DEBUG" value="1"/>
<arg line="-j ${make.jobs}" />
<arg line="-C ${libvideo.dir}" />
</exec>
<exec executable="make" failonerror="true">
<env key="DEBUG" value="1"/>
<arg line="-j ${make.jobs}" />
<arg line="-C ${project.src}" />
</exec>
<move file="${project.src}/libv4l4j.so" tofile="${project.dir}/libv4l4j.so" />
</target>
<target name="jnilib" depends="init">
<exec executable="make" failonerror="true">
<arg line="-C ${libvideo.dir}" />
<arg line="-j ${make.jobs}" />
</exec>
<exec executable="make" failonerror="true">
<arg line="-C ${project.src}" />
<arg line="-j ${make.jobs}" />
</exec>
<copy file="${project.src}/libv4l4j.so" tofile="${project.dir}/libv4l4j.so" />
</target>
<target name="install-libvideo">
<exec executable="make" failonerror="true">
<arg line="-C ${libvideo.dir} install"/>
<env key="DESTDIR" value="${destdir}"/>
<arg line="-j ${make.jobs}" />
</exec>
</target>
<target name="uninstall-libvideo">
<exec executable="make" failonerror="true">
<arg line="-C ${libvideo.dir} uninstall"/>
<env key="DESTDIR" value="${destdir}"/>
<arg line="-j ${make.jobs}" />
</exec>
</target>
<target name="install-v4l4j" depends="install-libvideo">
<mkdir dir="${destdir}${platform.standard.jar.location}"/>
<mkdir dir="${destdir}${platform.standard.jni.location}"/>
<copy file="${project.dir}/${project.jni.file}" tofile="${destdir}${platform.standard.jni.location}/${project.jni.file}" />
<copy file="${project.dir}/${project.jar.file}" tofile="${destdir}${platform.standard.jar.location}/${project.jar.file}" />
<copy file="${project.dir}/${project.rsrc}/v4l4j.png" tofile="${destdir}${platform.standard.icons.location}/v4l4j.png" />
<copy file="${project.dir}/${project.rsrc}/v4l4j-48x48.png" tofile="${destdir}${platform.standard.icons.location}/v4l4j-48x48.png" />
</target>
<target name="uninstall-v4l4j" depends="uninstall-libvideo">
<delete file="${destdir}${platform.standard.jar.location}/${project.jar.file}" />
<delete file="${destdir}${platform.standard.jni.location}/${project.jni.file}" />
<delete file="${destdir}${platform.standard.icons.location}/v4l4j.png" />
<delete file="${destdir}${platform.standard.icons.location}/v4l4j-48x48.png" />
<delete dir="${destdir}${platform.standard.javadoc.location}"/>
</target>
<target name="install-doc" depends="javadoc">
<copy todir="${destdir}${platform.standard.javadoc.location}">
<fileset dir="${project.javadoc.dir}"/>
</copy>
</target>
<target name="uninstall-doc">
<delete dir="${destdir}${platform.standard.javadoc.location}" />
</target>
<target name="install" depends="install-libvideo, install-v4l4j" />
<target name="uninstall" depends="uninstall-libvideo, uninstall-v4l4j" />
<target name="compile" depends="init">
<javac srcdir="${project.src}" destdir="${project.classes}" deprecation="on" source="${source}" debug="off">
<classpath refid="build.classpath"/>
<include name="**/*.java" />
<exclude name="**/test/*.java" />
<exclude name="**/package-info.java" />
</javac>
<javac srcdir="${project.src}" destdir="${project.classes}" deprecation="on" source="${source}" debug="on">
<classpath refid="build.classpath"/>
<include name="**/test/*.java"/>
<exclude name="**/package-info.java"/>
</javac>
</target>
<target name="compile-debug" depends="init">
<javac srcdir="${project.src}" destdir="${project.classes}" deprecation="on" source="${source}" debug="on">
<classpath refid="build.classpath"/>
<include name="**/*.java"/>
<exclude name="**/package-info.java" />
</javac>
</target>
<target name="jar" depends="compile">
<jar jarfile="${project.dir}/${project.jar.file}">
<manifest>
<attribute name="Main-Class" value="au.edu.jcu.v4l4j.examples.videoViewer.DeviceChooser"/>
</manifest>
<fileset dir="${project.classes}">
<include name="**"/>
<exclude name="au/edu/jcu/v4l4j/test/"/>
</fileset>
<fileset dir="${project.dir}">
<include name="resources/**" />
</fileset>
<fileset dir="${project.rsrc}">
<include name="**"/>
</fileset>
</jar>
</target>
<target name="jar-debug" depends="compile-debug">
<jar jarfile="${project.dir}/${project.jar.file}">
<manifest>
<attribute name="Main-Class" value="au.edu.jcu.v4l4j.examples.videoViewer.DeviceChooser"/>
</manifest>
<fileset dir="${project.classes}">
<include name="**"/>
<exclude name="au/edu/jcu/v4l4j/test/"/>
</fileset>
<fileset dir="${project.dir}">
<include name="resources/**" />
</fileset>
<fileset dir="${project.rsrc}">
<include name="**"/>
</fileset>
</jar>
</target>
<target name="jar-src" depends="compile">
<jar jarfile="${project.dir}/${project.jar.file}">
<manifest>
<attribute name="Main-Class" value="au.edu.jcu.v4l4j.examples.videoViewer.DeviceChooser"/>
</manifest>
<fileset dir="${project.classes}">
<include name="**"/>
<exclude name="au/edu/jcu/v4l4j/test/"/>
</fileset>
<fileset dir="${project.src}">
<include name="**"/>
<exclude name="au/edu/jcu/v4l4j/test/"/>
<exclude name="**/package-info.java" />
</fileset>
<fileset dir="${project.dir}">
<include name="resources/**" />
</fileset>
<fileset dir="${project.rsrc}">
<include name="**"/>
</fileset>
</jar>
</target>
<target name="include-jni" depends="jnilib">
<copy file="${project.src}/libv4l4j.so" tofile="${project.jnilib.dst}" />
</target>
<target name="javadoc">
<javadoc sourcepath="${project.src}" packagenames="au.edu.jcu.v4l4j.*" destdir="${project.javadoc.dir}" public="true" use="true" nodeprecated="true">
<excludepackage name="au.edu.jcu.v4l4j.test" />
<excludepackage name="au.edu.jcu.v4l4j.examples.*" />
</javadoc>
</target>
<target name="jar-test" depends="compile">
<jar jarfile="${project.dir}/${project.jar.file}">
<fileset dir="${project.classes}">
<include name="**"/>
</fileset>
<fileset dir="${project.src}">
<include name="**"/>
</fileset>
<fileset dir="${project.rsrc}">
<include name="**"/>
</fileset>
</jar>
</target>
<target name="test-fps">
<java classname="au.edu.jcu.v4l4j.examples.GetFrameRate" fork="true" failonerror="true">
<classpath>
<pathelement location="${platform.standard.jar.location}/${project.jar.file}"/>
</classpath>
<jvmarg value="-Djava.library.path=${platform.standard.jni.location}"/>
<jvmarg value="-Dtest.device=${test.device}" /> <!-- device file -->
<jvmarg value="-Dtest.width=${test.width}" /> <!-- width -->
<jvmarg value="-Dtest.height=${test.height}" /> <!-- height -->
<jvmarg value="-Dtest.standard=${test.standard}" /> <!-- standard -->
<jvmarg value="-Dtest.channel=${test.channel}" /> <!-- channel -->
<jvmarg value="-Dtest.inFormat=${test.inFormat}" /> <!-- capture image format -->
<jvmarg value="-Dtest.outFormat=${test.outFormat}" /> <!-- output image format -->
<jvmarg value="-Dtest.fps=${test.fps}" /> <!-- FPS -->
</java>
</target>
<target name="test-gui">
<java jar="${platform.standard.jar.location}/${project.jar.file}" fork="true" failonerror="true">
<jvmarg value="-Djava.library.path=${platform.standard.jni.location}"/>
<jvmarg value="-Dtest.width=${test.width}" /> <!-- width -->
<jvmarg value="-Dtest.height=${test.height}" /> <!-- height -->
</java>
</target>
<target name="test-server">
<java classname="au.edu.jcu.v4l4j.examples.server.CamHttpServer" fork="true" failonerror="true">
<classpath>
<pathelement location="${platform.standard.jar.location}/${project.jar.file}"/>
</classpath>
<jvmarg value="-Djava.library.path=${platform.standard.jni.location}"/>
<jvmarg value="-Dtest.device=${test.device}" /> <!-- device file -->
<jvmarg value="-Dtest.width=${test.width}" /> <!-- height -->
<jvmarg value="-Dtest.height=${test.height}" /> <!-- height -->
<jvmarg value="-Dtest.standard=${test.standard}" /> <!-- standard -->
<jvmarg value="-Dtest.channel=${test.channel}" /> <!-- channel -->
</java>
</target>
<target name="test-getsnapshot">
<java classname="au.edu.jcu.v4l4j.examples.GetSnapshotApp" fork="true" failonerror="true">
<classpath>
<pathelement location="${platform.standard.jar.location}/${project.jar.file}"/>
</classpath>
<jvmarg value="-Djava.library.path=${platform.standard.jni.location}"/>
<jvmarg value="-Dtest.device=${test.device}" /> <!-- device file -->
<jvmarg value="-Dtest.width=${test.width}" /> <!-- height -->
<jvmarg value="-Dtest.height=${test.height}" /> <!-- height -->
<jvmarg value="-Dtest.standard=${test.standard}" /> <!-- standard -->
<jvmarg value="-Dtest.channel=${test.channel}" /> <!-- channel -->
</java>
</target>
<target name="test-simpleViewer">
<java classname="au.edu.jcu.v4l4j.examples.SimpleViewer" fork="true" failonerror="true">
<classpath>
<pathelement location="${platform.standard.jar.location}/${project.jar.file}"/>
</classpath>
<jvmarg value="-Djava.library.path=${platform.standard.jni.location}"/>
<jvmarg value="-Dtest.device=${test.device}" /> <!-- device file -->
<jvmarg value="-Dtest.width=${test.width}" /> <!-- height -->
<jvmarg value="-Dtest.height=${test.height}" /> <!-- height -->
<jvmarg value="-Dtest.standard=${test.standard}" /> <!-- standard -->
<jvmarg value="-Dtest.channel=${test.channel}" /> <!-- channel -->
</java>
</target>
<target name="test-dual">
<java classname="au.edu.jcu.v4l4j.examples.DualViewer" fork="true" failonerror="true">
<classpath>
<pathelement location="${platform.standard.jar.location}/${project.jar.file}"/>
</classpath>
<jvmarg value="-Djava.library.path=${platform.standard.jni.location}"/>
</java>
</target>
<target name="deviceInfo">
<java classname="au.edu.jcu.v4l4j.examples.DumpInfo" fork="true" failonerror="true">
<classpath>
<pathelement location="${platform.standard.jar.location}/${project.jar.file}"/>
</classpath>
<jvmarg value="-Djava.library.path=${platform.standard.jni.location}"/>
<jvmarg value="-Dtest.device=${test.device}" /> <!-- device file -->
</java>
</target>
<target name="asciiCam">
<java classname="au.edu.jcu.v4l4j.examples.AsciiCam" fork="true" failonerror="true">
<classpath>
<pathelement location="${platform.standard.jar.location}/${project.jar.file}"/>
</classpath>
<jvmarg value="-Djava.library.path=${platform.standard.jni.location}"/>
<jvmarg value="-Dtest.device=${test.device}" /> <!-- device file -->
</java>
</target>
<target name="test-junit" depends="jar-test">
<junit fork="yes" haltonfailure="yes" showoutput="yes">
<jvmarg value="-Djava.library.path=${platform.standard.jni.location}"/>
<jvmarg value="-Dtest.device=${test.device}" />
<jvmarg value="-Dtest.width=${test.width}" />
<jvmarg value="-Dtest.height=${test.height}" />
<jvmarg value="-Dtest.standard=${test.standard}" />
<jvmarg value="-Dtest.channel=${test.channel}" />
<test name="au.edu.jcu.v4l4j.test.FrameGrabberTest" />
<test name="au.edu.jcu.v4l4j.test.PushSourceTest" />
<formatter type="plain" usefile="false" />
<classpath refid="test.classpath" />
</junit>
</target>
<target name="test-encoders" depends="jar-test">
<junit fork="yes" haltonfailure="yes" showoutput="yes">
<jvmarg value="-Djava.library.path=${platform.standard.jni.location}"/>
<jvmarg value="-Dtest.device=${test.device}" />
<jvmarg value="-Dtest.width=${test.width}" />
<jvmarg value="-Dtest.height=${test.height}" />
<jvmarg value="-Dtest.standard=${test.standard}" />
<jvmarg value="-Dtest.channel=${test.channel}" />
<test name="au.edu.jcu.v4l4j.encoder.AbstractVideoFrameEncoderTest" />
<formatter type="plain" usefile="false" />
<classpath refid="test.classpath" />
</junit>
</target>
<target name="clean">
<exec executable="make">
<arg line="-j ${make.jobs} -C ${libvideo.dir} clean" />
</exec>
<exec executable="make">
<arg line="-j ${make.jobs} -C ${project.src} clean" />
</exec>
<delete file="${project.dir}/${project.jar.file}" />
<delete file="${project.dir}/${project.jni.file}" />
<delete file="${project.jnilib.dst}" />
<delete dir="${project.classes}"/>
<delete dir="${project.javadoc.dir}"/>
</target>
<target name="clean-java">
<exec executable="make">
<arg line="-j ${make.jobs} -C ${project.src} clean" />
</exec>
<delete file="${project.dir}/${project.jar.file}" />
<delete dir="${project.classes}"/>
<delete dir="${project.javadoc.dir}"/>
</target>
<target name="test-h264">
<junit fork="yes" haltonfailure="yes" showoutput="yes">
<jvmarg value="-Djava.library.path=${platform.standard.jni.location}"/>
<test name="au.edu.jcu.v4l4j.encoder.h264.H264Test"/>
<formatter type="plain" usefile="false"/>
<classpath refid="test.classpath"/>
</junit>
</target>
</project>