-
Notifications
You must be signed in to change notification settings - Fork 121
/
Configure
executable file
·635 lines (592 loc) · 17.3 KB
/
Configure
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
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
#!/bin/sh
#
# Configure
# ARToolKit5
#
# This file is part of ARToolKit.
#
# ARToolKit 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.
#
# ARToolKit 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 ARToolKit. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the copyright holders of this library give you
# permission to link this library with independent modules to produce an
# executable, regardless of the license terms of these independent modules, and to
# copy and distribute the resulting executable under terms of your choice,
# provided that you also meet, for each linked independent module, the terms and
# conditions of the license of that module. An independent module is a module
# which is neither derived from nor based on this library. If you modify this
# library, you may extend this exception to your version of the library, but you
# are not obligated to do so. If you do not wish to do so, delete this exception
# statement from your version.
#
# Copyright 2015-2016 Daqri, LLC.
# Copyright 2002-2015 ARToolworks, Inc.
#
# Author(s): Hirokazu Kato, Philip Lamb
#
#####################################################
#
# ARToolKit Configure for Linux/Unix Video Devices
#
#####################################################
MDIR=". \
lib/SRC \
lib/SRC/AR \
lib/SRC/ARICP \
lib/SRC/AR2 \
lib/SRC/ARWrapper \
lib/SRC/KPM \
lib/SRC/ARUtil \
lib/SRC/ARMulti \
lib/SRC/Gl \
lib/SRC/Video \
lib/SRC/Video/Dummy \
lib/SRC/Video/Image \
lib/SRC/Video/Video4Linux2 \
lib/SRC/Video/libdc1394 \
lib/SRC/Video/GStreamer \
lib/SRC/ARosg \
lib/SRC/Eden \
util \
util/calib_camera \
util/calib_stereo \
util/mk_patt \
util/1394 \
util/1394/whiteBalance \
util/1394/listCamera \
util/1394/checkImage \
util/calib_optical \
util/calib_stereo \
util/check_id \
util/genTexData \
util/genMarkerSet \
util/dispImageSet \
util/dispFeatureSet \
util/checkResolution \
examples \
examples/simple \
examples/simpleLite \
examples/simpleMovie \
examples/multi \
examples/simpleOSG \
examples/stereo \
examples/multiCube \
examples/multiWin \
examples/optical \
examples/opticalStereo \
examples/nftSimple \
examples/nftBook "
#util/calib_distortion \
SED=/tmp/SED.$$
trap "rm -f $SED; exit 0" 0 1 2 3 15
VERSION=`grep -E 'AR_HEADER_VERSION_STRING[[:space:]]+"[0-9]+\.[0-9]+(\.[0-9]+)*"' include/AR/config.h.in | grep -Eo "[0-9]+\.[0-9]+(\.[0-9]+)*"`
E=`uname`
MACHINE=`uname -m`
if [ "$E" = "Linux" ]
then
SYSTEM="linux-$MACHINE"
echo "\nThis script configures ARToolKit libraries, utilities and examples. For details on dependencies and further information please visit http://artoolkit.org/documentation/doku.php?id=8_Advanced_Topics:build_artoolkit \n\n"
echo "Standard compiler is gcc and g++ with libstdc++. Do you want to use the Clang compiler with libc++ instead? (y or n)"
echo -n "Enter : "
read ANS
if [ "$ANS" = "y" ]
then
CLANGCC="y"
elif [ "$ANS" = "n" ]
then
CLANGCC="n"
else
echo "Please enter y or n."
exit 0
fi
INPUT_IMAGE="y"
DEFAULT_CAP_DEVICE=""
echo "Do you want to enable the Video4Linux2 capture module? (y or n)"
echo -n "Enter : "
read ANS
if [ "$ANS" = "y" ]
then
INPUT_V4L2="y"
elif [ "$ANS" = "n" ]
then
INPUT_V4L2="n"
else
echo "Please enter y or n."
exit 0
fi
if [ "$INPUT_V4L2" = "y" ]
then
echo "Do you want to use it as the default input device? (y or n)"
echo -n "Enter : "
read ANS
if [ "$ANS" = "y" ]
then
DEFAULT_CAP_DEVICE="V4L2"
elif [ "$ANS" = "n" ]
then
DEFAULT_CAP_DEVICE=""
else
echo "Please enter y or n."
exit 0
fi
fi
echo "Do you want to enable the IEEE 1394 Digital Video Camera capture module? (y or n)"
echo -n "Enter : "
read ANS
if [ "$ANS" = "y" ]
then
INPUT_CAM1394="y"
elif [ "$ANS" = "n" ]
then
INPUT_CAM1394="n"
else
echo "Please enter y or n."
exit 0
fi
if [ "$INPUT_CAM1394" = "y" ]
then
if [ "$DEFAULT_CAP_DEVICE" = "" ]
then
echo "Do you want to use it as the default input device? (y or n)"
echo -n "Enter : "
read ANS
if [ "$ANS" = "y" ]
then
DEFAULT_CAP_DEVICE="CAM1394"
elif [ "$ANS" = "n" ]
then
DEFAULT_CAP_DEVICE=""
else
echo "Please enter y or n."
exit 0
fi
fi
echo "Does your IEEE1394 camera support color image? (y or n)"
echo -n "Enter : "
read ANS
if [ "$ANS" = "y" ]
then
COLOR_1394="y"
elif [ "$ANS" = "n" ]
then
COLOR_1394="n"
else
echo "Please enter y or n."
exit 0
fi
echo "Do you use a DragonFly as a IEEE 1394 camera? (y or n)"
echo -n "Enter : "
read ANS
if [ "$ANS" = "y" ]
then
DRAGON="y"
elif [ "$ANS" = "n" ]
then
DRAGON="n"
else
echo "Please enter y or n."
exit 0
fi
fi
echo "Do you want to enable the GStreamer capture module? (y or n)"
echo -n "Enter : "
read ANS
if [ "$ANS" = "y" ]
then
INPUT_GSTREAMER="y"
elif [ "$ANS" = "n" ]
then
INPUT_GSTREAMER="n"
else
echo "Please enter y or n."
exit 0
fi
if [ "$INPUT_GSTREAMER" = "y" ]
then
echo "Experimental: Do you want to use gstreamer-1.0 instead of gstreamer-0.10? (y or n)"
echo -n "Enter : "
read ANS
if [ "$ANS" = "y" ]
then
USE_GSTREAMER_1="y"
elif [ "$ANS" = "n" ]
then
USE_GSTREAMER_1="n"
else
echo "Please enter y or n."
exit 0
fi
if [ "$DEFAULT_CAP_DEVICE" = "" ]
then
echo "Do you want to use it as the default input device? (y or n)"
echo -n "Enter : "
read ANS
if [ "$ANS" = "y" ]
then
DEFAULT_CAP_DEVICE="GSTREAMER"
elif [ "$ANS" = "n" ]
then
DEFAULT_CAP_DEVICE=""
else
echo "Please enter y or n."
exit 0
fi
fi
fi
if [ "$CLANGCC" = "y" ]
then
CC="clang"
CXX="clang++ -std=c++11 -stdlib=libc++"
CFLAG="-O3 -fPIC -march=core2 -DHAVE_NFT=1"
STDCXXLIB="-lc++"
else
CC="gcc"
CXX="g++ -std=c++11 "
CFLAG="-O3 -fPIC -march=core2 -DHAVE_NFT=1"
STDCXXLIB="-lstdc++"
fi
case "$MACHINE" in
armv7l)
# NOTE: raspberry pi 3 workarounds
if [ "$CLANGCC" = "y" ]; then
# NOTE: libc++ doesn't seem to work yet on Raspberry Pi
CXX="clang++ -std=c++11"
STDCXXLIB="-lstdc++"
CFLAG="-O3 -fPIC -march=native -DHAVE_NFT=1"
else
# NOTE: Some versions of gcc are buggy in their hardware detection code,
# so just hardcode the architecture here.
# See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70132
CFLAG="-O3 -fPIC -mcpu=cortex-a53 -mfpu=neon-vfpv4 -DHAVE_NFT=1"
fi
LDFLAG="-L/usr/lib"
;;
x86_64)
CFLAG="-O3 -fPIC -march=core2 -DHAVE_NFT=1"
LDFLAG="-L/usr/lib/x86_64-linux-gnu -L/usr/lib64"
;;
*)
CFLAG="$CFLAG -I/usr/include/i386-linux-gnu"
LDFLAG="-L/usr/lib/i386-linux-gnu -L/usr/lib"
;;
esac
AR="ar"
ARFLAGS="rsU"
RANLIB="true"
LIBS="-lglut -lGLU -lGL -lX11 -lm -lpthread -ljpeg -lz"
if [ "$INPUT_V4L2" = "y" ]
then
LIBS="$LIBS `pkg-config libudev --libs`"
CFLAG="$CFLAG `pkg-config libudev --cflags`"
fi
if [ "$INPUT_GSTREAMER" = "y" ]
then
if [ "$USE_GSTREAMER_1" = "y" ]
then
GST_CFLAGS="-DUSE_GSTREAMER_1 `pkg-config --cflags gstreamer-1.0`"
GST_LIBS="-DUSE_GSTREAMER_1 `pkg-config --libs gstreamer-1.0`"
else
GST_CFLAGS=`pkg-config --cflags gstreamer-0.10`
GST_LIBS=`pkg-config --libs gstreamer-0.10`
fi
CFLAG="$CFLAG $GST_CFLAGS"
LIBS="$LIBS $GST_LIBS"
fi
if [ "$INPUT_CAM1394" = "y" ]
then
LIBS="$LIBS `pkg-config libdc1394-2 --libs` `pkg-config libraw1394 --libs`"
CFLAG="$CFLAG `pkg-config libdc1394-2 --cflags` `pkg-config libraw1394 --cflags`"
fi
# When linking against libc++, use supplied opencv rather than system opencv.
if [ "$STDCXXLIB" = "-lc++" ]
then
CV_CFLAG="-I\$(INC_DIR)/$SYSTEM"
CV_LIBS="-L\$(LIB_DIR)/$SYSTEM -lopencv_calib3d -lopencv_features2d -lopencv_imgproc -lopencv_flann -lopencv_core -lz"
else
CV_CFLAG=`pkg-config opencv --cflags`
CV_LIBS=`pkg-config opencv --libs`
#CV_CFLAG=""
#CV_LIBS="-lopencv_calib3d -lopencv_features2d -lopencv_imgproc -lopencv_flann -opencv_core -lz"
fi
elif [ "$E" = "Darwin" ]
then
SYSTEM="macosx-universal"
echo "Do you want to use IEEE 1394 Digital Video Camera? (y or n)"
echo -n "Enter : "
read ANS
if [ "$ANS" = "y" ]
then
INPUT_CAM1394_MAC="y"
elif [ "$ANS" = "n" ]
then
INPUT_CAM1394_MAC="n"
else
echo "Please enter y or n."
exit 0
fi
if [ "$INPUT_CAM1394_MAC" = "y" ]
then
if [ "$DEFAULT_CAP_DEVICE" = "" ]
then
echo "Do you want to use it as the default input device? (y or n)"
echo -n "Enter : "
read ANS
if [ "$ANS" = "y" ]
then
DEFAULT_CAP_DEVICE="CAM1394"
elif [ "$ANS" = "n" ]
then
DEFAULT_CAP_DEVICE=""
else
echo "Please enter y or n."
exit 0
fi
fi
echo "Does your IEEE1394 camera support color image? (y or n)"
echo -n "Enter : "
read ANS
if [ "$ANS" = "y" ]
then
COLOR_1394="y"
elif [ "$ANS" = "n" ]
then
COLOR_1394="n"
else
echo "Please enter y or n."
exit 0
fi
echo "Do you use a DragonFly as a IEEE 1394 camera? (y or n)"
echo -n "Enter : "
read ANS
if [ "$ANS" = "y" ]
then
DRAGON="y"
elif [ "$ANS" = "n" ]
then
DRAGON="n"
else
echo "Please enter y or n."
exit 0
fi
fi
#CC="cc -arch i386 -arch x86_64"
CC="cc"
CXX="c++"
CFLAG="-O -DHAVE_NFT=1"
LDFLAG=""
#AR="libtool"
#ARFLAGS="-static -o"
#RANLIB="true"
AR="ar"
ARFLAGS="-r -u"
RANLIB="true"
LIBS="-framework Accelerate -framework CoreVideo -framework Carbon -framework GLUT -framework OpenGL -framework Cocoa -ljpeg"
if [ "$INPUT_CAM1394_MAC" = "y" ]
then
LIBS="$LIBS -ldc1394"
fi
#CV_CFLAG="-framework OpenCV"
#CV_LIBS="-framework OpenCV"
CV_CFLAG=""
CV_LIBS="-lopencv_flann -lopencv_core -lopencv_calib3d -lopencv_imgproc -lopencv_highgui"
else
echo "This configure command supports Linux, and macOS."
exit 0
fi
if [ "$CLANGCC" = "n" ]
then
echo "Enable the OpenSceneGraph renderer and examples? (y or n)"
echo -n "Enter : "
read ANS
if [ "$ANS" = "y" ]
then
ENABLE_OSG="y"
elif [ "$ANS" = "n" ]
then
ENABLE_OSG="n"
else
echo "Please enter y or n."
exit 0
fi
else
ENABLE_OSG="n"
fi #[ "$CLANGCC" = "n" ]
#
# Output step 1.
# Create Makefiles, setting symbols, and selecting directories for compilation.
#
# Prefix any slashes with '\' for sed.
echo $CC | sed -e 's/\//\\\//g' >$SED
CC=`cat $SED`
echo $CXX | sed -e 's/\//\\\//g' >$SED
CXX=`cat $SED`
echo $CFLAG | sed -e 's/\//\\\//g' >$SED
CFLAG=`cat $SED`
echo $LDFLAG | sed -e 's/\//\\\//g' >$SED
LDFLAG=`cat $SED`
echo $AR | sed -e 's/\//\\\//g' >$SED
AR=`cat $SED`
echo $ARFLAGS | sed -e 's/\//\\\//g' >$SED
ARFLAGS=`cat $SED`
echo $RANLIB | sed -e 's/\//\\\//g' >$SED
RANLIB=`cat $SED`
echo $LIBS | sed -e 's/\//\\\//g' >$SED
LIBS=`cat $SED`
echo $CV_CFLAG | sed -e 's/\//\\\//g' >$SED
CV_CFLAG=`cat $SED`
echo $CV_LIBS | sed -e 's/\//\\\//g' >$SED
CV_LIBS=`cat $SED`
echo $VERSION | sed -e 's/\//\\\//g' >$SED
VERSION=`cat $SED`
echo $SYSTEM | sed -e 's/\//\\\//g' >$SED
SYSTEM=`cat $SED`
cat > $SED <<EOF
s/@CC@/$CC/
s/@CXX@/$CXX/
s/@CFLAG@/$CFLAG/
s/@LDFLAG@/$LDFLAG/
s/@AR@/$AR/
s/@ARFLAGS@/$ARFLAGS/
s/@RANLIB@/$RANLIB/
s/@LIBS@/$LIBS/
s/@CV_CFLAG@/$CV_CFLAG/
s/@CV_LIBS@/$CV_LIBS/
s/@VERSION@/$VERSION/
s/@SYSTEM@/$SYSTEM/
s/@STDCXXLIB@/$STDCXXLIB/
EOF
if [ "$INPUT_IMAGE" = "y" ]
then
cat >> $SED <<EOF
s/#(cd Image; make -f Makefile)/(cd Image; make -f Makefile)/
EOF
fi
if [ "$INPUT_V4L2" = "y" ]
then
cat >> $SED <<EOF
s/#(cd Video4Linux2; make -f Makefile)/(cd Video4Linux2; make -f Makefile)/
EOF
fi
if [ "$INPUT_CAM1394" = "y" ]
then
cat >> $SED <<EOF
s/#(cd libdc1394; make -f Makefile)/(cd libdc1394; make -f Makefile)/
EOF
fi
if [ "$INPUT_CAM1394_MAC" = "y" ]
then
cat >> $SED <<EOF
s/#(cd libdc1394; make -f Makefile)/(cd libdc1394; make -f Makefile)/
EOF
fi
if [ "$INPUT_GSTREAMER" = "y" ]
then
cat >> $SED <<EOF
s/#(cd GStreamer; make -f Makefile)/(cd GStreamer; make -f Makefile)/
EOF
fi
if [ "$ENABLE_OSG" = "y" ]
then
cat >> $SED <<EOF
s/#(cd ARosg; make -f Makefile)/(cd ARosg; make -f Makefile)/
s/#(cd simpleOSG; make -f Makefile)/(cd simpleOSG; make -f Makefile)/
s/#(cd nftBook; make -f Makefile)/(cd nftBook; make -f Makefile)/
s/#(cd stereo; make -f Makefile)/(cd stereo; make -f Makefile)/
s/#(cd optical; make -f Makefile)/(cd optical; make -f Makefile)/
s/#(cd opticalStereo; make -f Makefile)/(cd opticalStereo; make -f Makefile)/
EOF
fi
for i in $MDIR
do
echo " create $i/Makefile"
sed -f $SED <$i/Makefile.in > $i/Makefile
done
echo " create share/artoolkit5-config"
sed -f $SED <share/artoolkit5-config.in > share/artoolkit5-config
chmod ugo+rx share/artoolkit5-config
#
# Output step 2.
# Record configuration in config.h.
#
if [ "$DRAGON" = "y" ]
then
cat >> $SED <<EOF
s/#undef ARVIDEO_INPUT_1394CAM_USE_DRAGONFLY/#define ARVIDEO_INPUT_1394CAM_USE_DRAGONFLY/
EOF
fi
if [ "$COLOR_1394" = "y" ]
then
cat >> $SED <<EOF
s/#define ARVIDEO_INPUT_1394CAM_DEFAULT_PIXEL_FORMAT AR_PIXEL_FORMAT_MONO/#define ARVIDEO_INPUT_1394CAM_DEFAULT_PIXEL_FORMAT AR_PIXEL_FORMAT_RGB/
EOF
fi
if [ "$INPUT_V4L2" = "y" ]
then
cat >> $SED <<EOF
s/#undef ARVIDEO_INPUT_V4L2/#define ARVIDEO_INPUT_V4L2/
EOF
fi
if [ "$INPUT_CAM1394" = "y" ]
then
cat >> $SED <<EOF
s/#undef ARVIDEO_INPUT_1394CAM/#define ARVIDEO_INPUT_1394CAM/
EOF
fi
if [ "$INPUT_CAM1394_MAC" = "y" ]
then
cat >> $SED <<EOF
s/#undef ARVIDEO_INPUT_1394CAM/#define ARVIDEO_INPUT_1394CAM/
EOF
fi
if [ "$INPUT_GSTREAMER" = "y" ]
then
cat >> $SED <<EOF
s/#undef ARVIDEO_INPUT_GSTREAMER/#define ARVIDEO_INPUT_GSTREAMER/
EOF
fi
if [ "$INPUT_IMAGE" = "y" ]
then
cat >> $SED <<EOF
s/#undef ARVIDEO_INPUT_IMAGE/#define ARVIDEO_INPUT_IMAGE/
EOF
fi
if [ "$DEFAULT_CAP_DEVICE" = "V4L2" ]
then
cat >> $SED <<EOF
s/#undef ARVIDEO_INPUT_DEFAULT_V4L2/#define ARVIDEO_INPUT_DEFAULT_V4L2/
EOF
elif [ "$DEFAULT_CAP_DEVICE" = "CAM1394" ]
then
cat >> $SED <<EOF
s/#undef ARVIDEO_INPUT_DEFAULT_1394/#define ARVIDEO_INPUT_DEFAULT_1394/
EOF
elif [ "$DEFAULT_CAP_DEVICE" = "GSTREAMER" ]
then
cat >> $SED <<EOF
s/#undef ARVIDEO_INPUT_DEFAULT_GSTREAMER/#define ARVIDEO_INPUT_DEFAULT_GSTREAMER/
EOF
elif [ "$E" = "Linux" ]
then
echo "You have to choose default input device!!"
exit 0
fi
case "$MACHINE" in
arm*)
cat >> $SED <<EOF
s/#define HAVE_INTEL_SIMD.*/#undef HAVE_INTEL_SIMD/
EOF
;;
esac
echo " create include/AR/config.h"
sed -f $SED <include/AR/config.h.in > include/AR/config.h
echo "Done."