-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinstall.sh
executable file
·84 lines (68 loc) · 2.06 KB
/
install.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
#!/bin/bash
# File : install.sh
# Author : Émile Robitaille @ LERobot
# Description : Intall script if you don't have OpenCV. Linux version
# Automatically abort on error
set -e
# Get the directory which holds the current file
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
OUT="$DIR/out.txt"
N=`nproc`
# Parse arguments and set defaults
if [ $# -ne 1 ]; then
arg1="-nocolosse"
else
arg1=$1
fi
# Append exports to .bashrc file
if ! grep -q ulavalSFM "$HOME/.bashrc"; then
echo "# Added by ulavalSFM 4.0 installer" >> $HOME/.bashrc
echo "export LD_LIBRARY_PATH="$DIR/lib/:\$LD_LIBRARY_PATH"" >> $HOME/.bashrc
echo "export PATH="$DIR/bin/:\$PATH"" >> $HOME/.bashrc
echo "export PKG_CONFIG_PATH="$DIR/lib/pkgconfig:$PKG_CONFIG_PATH"" >> $HOME/.bashrc
source $HOME/.bashrc
echo "[ Adding library path in .bashrc file ... done ]"
fi
# Clone required dependencies
cd dependencies/
if [ $arg1 != "-colosse" ] && [ ! -d opencv ]; then
git clone --single-branch https://github.com/Itseez/opencv.git opencv
git clone https://github.com/Itseez/opencv_contrib.git
fi
if [ ! -d bundler_sfm ]; then
if [ $arg1 != "-colosse" ]; then
git clone https://github.com/LERobot/bundler_sfm
else
git clone https://github.com/lvsn/bundler_sfm
fi
fi
# Build the dependencies
if [ $arg1 != "-colosse" ]; then
cd opencv/
if [ ! -d build ]; then
mkdir build/
cd build/
cmake -DCMAKE_INSTALL_PREFIX="${DIR}" -DCMAKE_LIBRARY_PATH="${DIR}" -DCMAKE_INCLUDE_PATH="${DIR}/include/" -DOPENCV_EXTRA_MODULES_PATH=${DIR}/dependencies/opencv_contrib/modules -DBUILD_opencv_legacy=OFF ..
make -j $N
make install
fi
fi
if [ $arg1 == "-colosse" ]; then
cd bundler_sfm/
else
cd ${DIR}/dependencies/bundler_sfm/
fi
if [ ! -e bin/bundler ]; then
make -j $N
rm -f bin/bundler.py
mv bin/* ${DIR}/bin/
mv lib/* ${DIR}/lib/
fi
cd ${DIR}/src/
make -j $N
make cinstall
chmod +x ${DIR}/bin/bundler.py
chmod +x ${DIR}/bin/cext.py
chmod +x ${DIR}/bin/cleanSFM.py
cd ${DIR}
echo "[ YOU CAN RUN ULAVALSFM ]"