1 Star 0 Fork 0

孟德尔斯鸠/artoolkit5

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
Configure 17.29 KB
Copy Edit Raw Blame History
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
#!/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."
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mengdeersijiu/artoolkit5.git
git@gitee.com:mengdeersijiu/artoolkit5.git
mengdeersijiu
artoolkit5
artoolkit5
master

Search