forked from luigifreda/plvs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_plvs.sh
executable file
·59 lines (45 loc) · 1.73 KB
/
build_plvs.sh
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
#!/usr/bin/env bash
reset
. config.sh # source configuration file
# ====================================================
print_blue '================================================'
print_blue 'Building PLVS'
print_blue '================================================'
set -e
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) # get script dir
SCRIPT_DIR=$(readlink -f $SCRIPT_DIR) # this reads the actual path if a symbolic directory is used
cd $SCRIPT_DIR # this brings us in the actual used folder (not the symbolic one)
#echo "current dir: $SCRIPT_DIR"
# ====================================================
# check if we have external options
EXTERNAL_OPTION=$1
if [[ -n "$EXTERNAL_OPTION" ]]; then
echo "external option: $EXTERNAL_OPTION"
fi
# check if we set a C++ standard
if [[ -n "$CPP_STANDARD_VERSION" ]]; then
echo "CPP_STANDARD_VERSION: $CPP_STANDARD_VERSION"
EXTERNAL_OPTION="$EXTERNAL_OPTION -DCPP_STANDARD_VERSION=$CPP_STANDARD_VERSION"
fi
# check the use of local opencv
if [[ -n "$OpenCV_DIR" ]]; then
echo "OpenCV_DIR: $OpenCV_DIR"
EXTERNAL_OPTION="$EXTERNAL_OPTION -DOpenCV_DIR=$OpenCV_DIR"
fi
# check CUDA options
if [ $USE_CUDA -eq 1 ]; then
echo "USE_CUDA: $USE_CUDA"
EXTERNAL_OPTION="$EXTERNAL_OPTION -DWITH_CUDA=ON"
fi
if [[ $OPENCV_VERSION == 4* ]]; then
EXTERNAL_OPTION="$EXTERNAL_OPTION -DOPENCV_VERSION=4"
fi
echo "external option: $EXTERNAL_OPTION"
# ====================================================
echo "Configuring and building PLVS ..."
if [ ! -d build ]; then
mkdir build
fi
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release $EXTERNAL_OPTION
make -j4 # if you use too many threads your will loose the control of your computer for a while