forked from luigifreda/pyslam
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_thirdparty.sh
executable file
·149 lines (130 loc) · 3.86 KB
/
install_thirdparty.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/usr/bin/env bash
# ====================================================
function print_blue(){
printf "\033[34;1m"
printf "$@ \n"
printf "\033[0m"
}
function make_dir(){
if [ ! -d $1 ]; then
mkdir $1
fi
}
function make_buid_dir(){
make_dir build
}
function check_package(){
package_name=$1
PKG_OK=$(dpkg-query -W --showformat='${Status}\n' $package_name |grep "install ok installed")
#echo "checking for $package_name: $PKG_OK"
if [ "" == "$PKG_OK" ]; then
#echo "$package_name is not installed"
echo 1
else
echo 0
fi
}
function install_package(){
do_install=$(check_package $1)
if [ $do_install -eq 1 ] ; then
sudo apt-get install -y $1
fi
}
function check_pip_package(){
package_name=$1
PKG_OK=$(pip3 list |grep $package_name)
#echo "checking for $package_name: $PKG_OK"
if [ "" == "$PKG_OK" ]; then
#echo "$package_name is not installed"
echo 1
else
echo 0
fi
}
function install_pip_package(){
do_install=$(check_pip_package $1)
if [ $do_install -eq 1 ] ; then
pip3 install --user $1
fi
}
function install_pip_packages(){
for var in "$@"
do
install_pip_package "$var"
done
}
# ====================================================
print_blue '================================================'
print_blue "Building Thirdparty"
print_blue '================================================'
set -e
STARTING_DIR=`pwd` # this should be the main folder directory of the repo
echo "=================================================================="
echo "Configuring and installing python packages ..."
# N.B.: it's required the use of python3
install_pip_packages pygame numpy matplotlib pyopengl Pillow pybind11 scikit-image pyyaml termcolor
install_pip_packages opencv-python opencv-contrib-python
install_package python3-sdl2 python3-tk
make_dir lib
echo "=================================================================="
echo "Configuring and building lib/Pangolin ..."
ISTALL_PANGOLIN_ORIGINAL=0
cd lib
if [ $ISTALL_PANGOLIN_ORIGINAL -eq 1 ] ; then
# N.B.: pay attention this will generate a module pypangolin ( it does not have the methods dcam.SetBounds(...) and pangolin.DrawPoints(points, colors) )
if [ ! -d pangolin ]; then
sudo apt-get install -y libglew-dev
git clone https://github.com/stevenlovegrove/Pangolin.git pangolin
cd pangolin
git submodule init && git submodule update
cd ..
fi
cd pangolin
make_dir build
if [ ! -f build/src/libpangolin.so ]; then
cd build
cmake ../ -DAVFORMAT_INCLUDE_DIR="" -DCPP11_NO_BOOST=ON $EXTERNAL_OPTION
make -j 8
cd build/src
ln -s pypangolin.*-linux-gnu.so pangolin.linux-gnu.so
fi
else
# N.B.: pay attention this will generate a module pangolin
if [ ! -d pangolin ]; then
sudo apt-get install -y libglew-dev
git clone https://github.com/uoip/pangolin.git
fi
cd pangolin
if [ ! -f pangolin.cpython-*-linux-gnu.so ]; then
make_dir build
cd build
cmake .. -DBUILD_PANGOLIN_LIBREALSENSE=OFF # disable realsense
make -j8
cd ..
#python setup.py install
fi
fi
cd $STARTING_DIR
echo "=================================================================="
echo "Configuring and building lib/g2o ..."
cd lib
if [ ! -d g2opy ]; then
sudo apt-get install -y libsuitesparse-dev libeigen3-dev
git clone https://github.com/uoip/g2opy.git
cd g2opy
G2OPY_REVISION=5587024
git checkout $G2OPY_REVISION
cd ..
# copy local changes
cp ./g2opy_changes/types_six_dof_expmap.h ./g2opy/python/types/sba/types_six_dof_expmap.h
fi
cd g2opy
if [ ! -f lib/g2o.cpython-*-linux-gnu.so ]; then
make_buid_dir
cd build
cmake ..
make -j8
cd ..
#python3 setup.py install --user
fi
cd $STARTING_DIR