File indexing completed on 2022-11-29 19:42:55

0001 #!/bin/bash
0002 set -x
0003 #opencv_contrib
0004 cd /app/src/
0005 if ( test -d /app/src/opencv_contrib )
0006 then
0007         echo "opencv_contrib already cloned"
0008         cd opencv_contrib
0009         git reset --hard
0010 #        git pull --rebase
0011         git checkout 3.2.0
0012         cd ..
0013 else
0014        git clone https://github.com/opencv/opencv_contrib.git
0015 fi
0016 
0017 cd /app/src/
0018 if ( test -d /app/src/opencv )
0019 then
0020         echo "opencv already cloned"
0021         cd opencv
0022         git reset --hard
0023 #        git pull --rebase
0024         git checkout 3.2.0
0025         cd ..
0026 else
0027        git clone https://github.com/opencv/opencv.git
0028 fi
0029 
0030 #opencv
0031 EXTERNAL_CMAKE_OPTIONS="-DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules -DBUILD_opencv_aruco=OFF -DBUILD_opencv_bgsegm=OFF \
0032 -DBUILD_opencv_bioinspired=OFF -DBUILD_opencv_ccalib=OFF -DBUILD_opencv_cnn_3dobj=OFF -DBUILD_opencv_cvv=OFF -DBUILD_opencv_dnn=OFF \
0033 -DBUILD_opencv_dnns_easily_fooled=OFF -DBUILD_opencv_dpm=OFF -DBUILD_opencv_fuzzy=OFF -DBUILD_opencv_hdf=OFF -DBUILD_opencv_line_descriptor=OFF \
0034 -DBUILD_opencv_matlab=OFF -DBUILD_opencv_optflow=OFF -DBUILD_opencv_plot=OFF -DBUILD_opencv_reg=OFF -DBUILD_opencv_rgbd=OFF \
0035 -DBUILD_opencv_saliency=OFF -DBUILD_opencv_sfm=OFF -DBUILD_opencv_stereo=OFF -DBUILD_opencv_structured_light=OFF -DBUILD_opencv_surface_matching=OFF \
0036 -DBUILD_opencv_xfeatures2d=OFF -DBUILD_opencv_xobjdetect=OFF -DBUILD_opencv_xphoto=OFF -DBUILD_opencv_calib3d=OFF -DBUILD_opencv_cudaarithm=OFF \
0037 -DBUILD_opencv_cudabgsegm=OFF -DBUILD_opencv_cudacodec=OFF -DBUILD_opencv_cudafilters=OFF -DBUILD_opencv_cudalegacy=OFF -DBUILD_opencv_cudaobjdetect=OFF \
0038 -DBUILD_opencv_cudaoptflow=OFF -DBUILD_opencv_cudastereo=OFF -DBUILD_opencv_cudawarping=OFF -DBUILD_opencv_cudev=OFF -DBUILD_opencv_java=OFF \
0039 -DBUILD_opencv_shape=OFF -DBUILD_opencv_stitching=OFF -DBUILD_opencv_superres=OFF -DBUILD_opencv_ts=OFF -DBUILD_opencv_videoio=OFF \
0040 -DBUILD_opencv_videostab=OFF -DBUILD_opencv_viz=OFF"
0041 
0042 # create build dir
0043 SRC=/app/src/opencv
0044 PREFIX=/opt/usr/
0045 mkdir -p $SRC/build
0046 
0047 # go there
0048 cd $SRC/build
0049 
0050 if cmake -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX $EXTERNAL_CMAKE_OPTIONS $SRC/opencv
0051 
0052 # make
0053 make -j8
0054 
0055 # install
0056 make install
0057 
0058 else
0059         error_exit "$LINENO: An error has occurred.. Aborting."
0060 fi
0061 
0062 function error_exit
0063 {
0064         echo "$1" 1>&2
0065         exit 1
0066 }