2015-11-16 13:47:29 +00:00
#!/bin/bash
2018-08-24 13:19:40 +00:00
if [ [ $2 = ~ ^[ 0-9] +$ ] ] ; then
processes = $2
else
processes = $( nproc)
fi
2017-04-06 16:22:42 +00:00
install( ) {
## Set up library paths
export PYTHONPATH = $RUNPATH /SuperBuild/install/lib/python2.7/dist-packages:$RUNPATH /SuperBuild/src/opensfm:$PYTHONPATH
export LD_LIBRARY_PATH = $LD_LIBRARY_PATH :$RUNPATH /SuperBuild/install/lib
## Before installing
echo "Updating the system"
2019-04-24 22:33:12 +00:00
add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable
2018-01-11 02:21:18 +00:00
apt-get update
2017-04-06 16:22:42 +00:00
echo "Installing Required Requisites"
2018-01-11 02:21:18 +00:00
apt-get install -y -qq build-essential \
2017-04-06 16:22:42 +00:00
git \
cmake \
python-pip \
libgdal-dev \
gdal-bin \
libgeotiff-dev \
2017-06-27 16:43:36 +00:00
pkg-config \
2018-01-22 18:19:17 +00:00
libjsoncpp-dev \
2019-04-24 22:33:12 +00:00
python-gdal \
2019-07-10 17:18:50 +00:00
grass-core \
2019-09-07 18:21:49 +00:00
libssl-dev \
liblas-bin \
swig2.0 \
python-wheel \
libboost-log-dev
2017-04-06 16:22:42 +00:00
echo "Getting CMake 3.1 for MVS-Texturing"
2018-01-11 02:21:18 +00:00
apt-get install -y software-properties-common python-software-properties
add-apt-repository -y ppa:george-edison55/cmake-3.x
apt-get update -y
apt-get install -y --only-upgrade cmake
2017-04-06 16:22:42 +00:00
echo "Installing OpenCV Dependencies"
2018-01-11 02:21:18 +00:00
apt-get install -y -qq libgtk2.0-dev \
2017-04-06 16:22:42 +00:00
libavcodec-dev \
libavformat-dev \
libswscale-dev \
python-dev \
libtbb2 \
libtbb-dev \
libjpeg-dev \
libpng-dev \
libtiff-dev \
libjasper-dev \
libflann-dev \
libproj-dev \
libxext-dev \
liblapack-dev \
libeigen3-dev \
2017-06-22 13:20:29 +00:00
libvtk6-dev
2017-04-06 16:22:42 +00:00
echo "Removing libdc1394-22-dev due to python opencv issue"
2018-01-11 02:21:18 +00:00
apt-get remove libdc1394-22-dev
2017-04-06 16:22:42 +00:00
echo "Installing OpenSfM Dependencies"
2019-09-07 18:21:49 +00:00
apt-get install -y -qq libgoogle-glog-dev \
2017-04-06 16:22:42 +00:00
libsuitesparse-dev \
libboost-filesystem-dev \
libboost-iostreams-dev \
libboost-regex-dev \
libboost-python-dev \
libboost-date-time-dev \
2019-09-07 18:21:49 +00:00
libboost-thread-dev
2017-04-06 16:22:42 +00:00
2019-09-16 22:36:51 +00:00
pip install -r " ${ RUNPATH } /requirements.txt "
2017-04-06 16:22:42 +00:00
2019-05-12 14:56:09 +00:00
# Fix: /usr/local/lib/python2.7/dist-packages/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
pip install --upgrade cryptography
python -m easy_install --upgrade pyOpenSSL
2017-04-06 16:22:42 +00:00
echo "Compiling SuperBuild"
cd ${ RUNPATH } /SuperBuild
mkdir -p build && cd build
2017-09-22 17:51:12 +00:00
cmake .. && make -j$processes
2017-04-06 16:22:42 +00:00
echo "Compiling build"
cd ${ RUNPATH }
mkdir -p build && cd build
2017-09-22 17:51:12 +00:00
cmake .. && make -j$processes
2017-04-06 16:22:42 +00:00
echo "Configuration Finished"
}
uninstall( ) {
echo "Removing SuperBuild and build directories"
cd ${ RUNPATH } /SuperBuild
rm -rfv build src download install
cd ../
rm -rfv build
}
reinstall( ) {
echo "Reinstalling ODM modules"
uninstall
install
}
usage( ) {
echo "Usage:"
2017-09-22 17:51:12 +00:00
echo "bash configure.sh <install|update|uninstall|help> [nproc]"
2017-04-06 16:22:42 +00:00
echo "Subcommands:"
echo " install"
echo " Installs all dependencies and modules for running OpenDroneMap"
echo " reinstall"
echo " Removes SuperBuild and build modules, then re-installs them. Note this does not update OpenDroneMap to the latest version. "
echo " uninstall"
echo " Removes SuperBuild and build modules. Does not uninstall dependencies"
echo " help"
echo " Displays this message"
2017-09-22 17:51:12 +00:00
echo " [nproc] is an optional argument that can set the number of processes for the make -j tag. By default it uses $( nproc) "
2017-04-06 16:22:42 +00:00
}
if [ [ $1 = ~ ^( install| reinstall| uninstall| usage) $ ] ] ; then
RUNPATH = " $( cd " $( dirname " ${ BASH_SOURCE [0] } " ) " && pwd ) "
" $1 "
else
echo "Invalid instructions." >& 2
usage
exit 1
2017-06-26 04:57:57 +00:00
fi