forked from luigifreda/slamplay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.sh
executable file
·94 lines (72 loc) · 3.19 KB
/
config.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
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
#!/usr/bin/env bash
source bash_utils.sh
CONFIG_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
CONFIG_DIR=$(readlink -f $CONFIG_DIR) # this reads the actual path if a symbolic directory is used
cd $CONFIG_DIR # this brings us in the actual folder of this config script (not the symbolic one)
#echo CONFIG_DIR: $CONFIG_DIR
# ====================================================
# OpenCV Settings
# ====================================================
# 1: ON, 0: OFF
export USE_LOCAL_OPENCV=0 # use a local installation of OpenCV
export OPENCV_VERSION="4" # default opencv version
# or you can set manullay OpenCV_DIR
# export OpenCV_DIR="path to my OpenCV folder"
export OpenCV_DIR="$CONFIG_DIR/thirdparty/opencv/install/lib/cmake/opencv4" # here not set
# ====================================================
# CUDA Settings
# ====================================================
# N.B: if you do not have opencv with CUDA support you must set above:
# USE_LOCAL_OPENCV=1
# 1: ON, 0: OFF
export USE_CUDA=0 # use CUDA in PLVS sparse SLAM
export CUDA_VERSION="cuda-11.6" # must be an installed CUDA path in "/usr/local";
# if available, you can use the simple path "/usr/local/cuda" which should be a symbolic link to the last installed cuda version
if [ ! -d /usr/local/$CUDA_VERSION ]; then
CUDA_VERSION="cuda" # use last installed CUDA path (standard path)
fi
export PATH=/usr/local/$CUDA_VERSION/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/$CUDA_VERSION/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export CUDADIR=/usr/local/$CUDA_VERSION
# ====================================================
# Check and Manage Settings
# ====================================================
# auto managed things below ...
# ====================================================
# SIMD
# check SIMD supports
export HAVE_SSE3=$(gcc -march=native -dM -E - </dev/null | grep SSE3 || :)
export HAVE_SSE4=$(gcc -march=native -dM -E - </dev/null | grep SSE4 || :)
export HAVE_AVX=$(gcc -march=native -dM -E - </dev/null | grep AVX || : )
# ====================================================
# CUDA
export CUDA_FOUND=0
if [ -f /usr/local/$CUDA_VERSION/bin/nvcc ] || [ -f /usr/bin/nvcc ]; then
CUDA_FOUND=1
echo "CUDA found: $CUDA_VERSION"
fi
# reset env var if CUDA lib is not installed
if [ $CUDA_FOUND -eq 0 ]; then
USE_CUDA=0
echo 'CUDA env var reset, check your CUDA installation'
fi
# ====================================================
# OPENCV
if [[ -n "$OpenCV_DIR" ]]; then
if [ ! -d $OpenCV_DIR ]; then
echo OpenCV_DIR does not exist: $OpenCV_DIR
exit 1
fi
fi
# install a local opencv with CUDA support and more
if [ $USE_LOCAL_OPENCV -eq 1 ] && [[ ! -n "$OpenCV_DIR" ]]; then
. install_local_opencv.sh # source it in order to run it and get the env var OPENCV_VERSION
echo OpenCV version: $OPENCV_VERSION
if [[ $OPENCV_VERSION == 4* ]]; then
OpenCV_DIR="$CONFIG_DIR/thirdparty/opencv/install/lib/cmake/opencv4"
else
OpenCV_DIR="$CONFIG_DIR/thirdparty/opencv/install/share/OpenCV"
fi
echo setting OpenCV_DIR: $OpenCV_DIR
#export LD_LIBRARY_PATH=$CONFIG_DIR/thirdparty/opencv/install/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
fi