forked from artoolkit/ARToolKit5
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfigure
More file actions
executable file
·395 lines (359 loc) · 11.2 KB
/
Configure
File metadata and controls
executable file
·395 lines (359 loc) · 11.2 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
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
#!/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_camera_old-v3 \
util/calib_stereo_old-v3 \
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"
CLANGCC="n"
INPUT_IMAGE="y"
DEFAULT_CAP_DEVICE=""
INPUT_V4L2="y"
DEFAULT_CAP_DEVICE="V4L2"
INPUT_CAM1394="n"
INPUT_GSTREAMER="n"
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
else
echo "This configure command supports Linux, and macOS."
exit 0
fi
if [ "$CLANGCC" = "n" ]
then
ENABLE_OSG="y"
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."