2015-11-16 13:47:29 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-09-08 17:08:57 +00:00
|
|
|
check_version(){
|
|
|
|
UBUNTU_VERSION=$(lsb_release -r)
|
|
|
|
if [[ $UBUNTU_VERSION = *"18.04"* ]]; then
|
|
|
|
echo "Ubuntu: $UBUNTU_VERSION, good!"
|
|
|
|
elif [[ $UBUNTU_VERSION = *"16.04" ]]; then
|
|
|
|
echo "ODM 2.0 has upgraded to Ubuntu 18.04, but you're on 16.04"
|
|
|
|
echo "The last version of ODM that supports Ubuntu 16.04 is v1.0.2. We recommend you upgrade to Ubuntu 18.04, or better yet, use docker."
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "You are not on Ubuntu 18.04 (detected: $UBUNTU_VERSION)"
|
|
|
|
echo "It might be possible to run ODM on a newer version of Ubuntu, however, you cannot rely on this script."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
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() {
|
2020-09-08 17:08:57 +00:00
|
|
|
cd /code
|
|
|
|
|
2017-04-06 16:22:42 +00:00
|
|
|
## Set up library paths
|
2020-09-08 17:08:57 +00:00
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
2017-04-06 16:22:42 +00:00
|
|
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$RUNPATH/SuperBuild/install/lib
|
|
|
|
|
2020-09-08 17:08:57 +00:00
|
|
|
## Before installing
|
2017-04-06 16:22:42 +00:00
|
|
|
echo "Updating the system"
|
2020-09-08 17:08:57 +00:00
|
|
|
if ! command -v sudo &> /dev/null
|
|
|
|
then
|
|
|
|
echo "Installing sudo"
|
|
|
|
apt-get update && apt-get install -y sudo
|
|
|
|
fi
|
2020-09-09 16:10:24 +00:00
|
|
|
sudo apt-get update && sudo apt-get install software-properties-common lsb-release tzdata -y --no-install-recommends
|
|
|
|
|
|
|
|
# Check version
|
|
|
|
check_version
|
|
|
|
|
2020-09-08 17:08:57 +00:00
|
|
|
sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable
|
|
|
|
sudo apt-get update
|
|
|
|
|
2017-04-06 16:22:42 +00:00
|
|
|
echo "Installing Required Requisites"
|
2020-09-08 17:08:57 +00:00
|
|
|
sudo apt-get install -y -qq --no-install-recommends \
|
|
|
|
build-essential \
|
2017-04-06 16:22:42 +00:00
|
|
|
git \
|
|
|
|
cmake \
|
2020-09-08 17:08:57 +00:00
|
|
|
python3-pip \
|
2017-04-06 16:22:42 +00:00
|
|
|
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 \
|
2020-09-08 17:08:57 +00:00
|
|
|
python3-gdal \
|
|
|
|
python3-setuptools \
|
2019-07-10 17:18:50 +00:00
|
|
|
grass-core \
|
2019-09-07 18:21:49 +00:00
|
|
|
libssl-dev \
|
2020-09-08 17:08:57 +00:00
|
|
|
swig3.0 \
|
|
|
|
python3-wheel \
|
2019-09-07 18:21:49 +00:00
|
|
|
libboost-log-dev
|
2020-09-08 17:08:57 +00:00
|
|
|
sudo pip3 install -U pip
|
2017-04-06 16:22:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
echo "Installing OpenCV Dependencies"
|
2020-09-08 17:08:57 +00:00
|
|
|
sudo apt-get install -y -qq --no-install-recommends libgtk2.0-dev \
|
2017-04-06 16:22:42 +00:00
|
|
|
libavcodec-dev \
|
|
|
|
libavformat-dev \
|
|
|
|
libswscale-dev \
|
2020-09-08 17:08:57 +00:00
|
|
|
python3-dev \
|
2017-04-06 16:22:42 +00:00
|
|
|
libtbb2 \
|
|
|
|
libtbb-dev \
|
|
|
|
libjpeg-dev \
|
|
|
|
libpng-dev \
|
|
|
|
libtiff-dev \
|
|
|
|
libflann-dev \
|
|
|
|
libproj-dev \
|
|
|
|
libxext-dev \
|
|
|
|
liblapack-dev \
|
|
|
|
libeigen3-dev \
|
2017-06-22 13:20:29 +00:00
|
|
|
libvtk6-dev
|
2020-09-08 17:08:57 +00:00
|
|
|
|
|
|
|
sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y -qq --no-install-recommends libjasper1 \
|
|
|
|
libjasper-dev
|
|
|
|
|
2017-04-06 16:22:42 +00:00
|
|
|
echo "Installing OpenSfM Dependencies"
|
2020-09-08 17:08:57 +00:00
|
|
|
sudo apt-get install -y -qq --no-install-recommends 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
|
|
|
|
2020-09-08 17:08:57 +00:00
|
|
|
pip install -r requirements.txt
|
2019-05-12 14:56:09 +00:00
|
|
|
|
2020-09-16 14:04:51 +00:00
|
|
|
if [ ! -z "$PORTABLE_INSTALL" ]; then
|
|
|
|
echo "Replacing g++ and gcc with our scripts for portability..."
|
|
|
|
if [ ! -e /usr/bin/gcc_real ]; then
|
|
|
|
sudo mv -v /usr/bin/gcc /usr/bin/gcc_real
|
|
|
|
sudo cp -v ./docker/gcc /usr/bin/gcc
|
|
|
|
fi
|
|
|
|
if [ ! -e /usr/bin/g++_real ]; then
|
|
|
|
sudo mv -v /usr/bin/g++ /usr/bin/g++_real
|
|
|
|
sudo cp -v ./docker/g++ /usr/bin/g++
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2020-09-16 15:26:43 +00:00
|
|
|
set -eo pipefail
|
|
|
|
|
2017-04-06 16:22:42 +00:00
|
|
|
echo "Compiling SuperBuild"
|
2020-09-16 14:04:51 +00:00
|
|
|
cd ${RUNPATH}/SuperBuild
|
|
|
|
mkdir -p build && cd build
|
|
|
|
cmake .. && make -j$processes
|
2017-04-06 16:22:42 +00:00
|
|
|
|
|
|
|
echo "Compiling build"
|
2020-09-16 14:04:51 +00:00
|
|
|
cd ${RUNPATH}
|
|
|
|
mkdir -p build && cd build
|
|
|
|
cmake .. && make -j$processes
|
2020-09-08 17:08:57 +00:00
|
|
|
|
2017-04-06 16:22:42 +00:00
|
|
|
echo "Configuration Finished"
|
|
|
|
}
|
|
|
|
|
|
|
|
uninstall() {
|
2020-09-09 16:10:24 +00:00
|
|
|
check_version
|
|
|
|
|
2017-04-06 16:22:42 +00:00
|
|
|
echo "Removing SuperBuild and build directories"
|
|
|
|
cd ${RUNPATH}/SuperBuild
|
|
|
|
rm -rfv build src download install
|
|
|
|
cd ../
|
|
|
|
rm -rfv build
|
|
|
|
}
|
|
|
|
|
|
|
|
reinstall() {
|
2020-09-09 16:10:24 +00:00
|
|
|
check_version
|
|
|
|
|
2017-04-06 16:22:42 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2020-09-08 17:08:57 +00:00
|
|
|
if [[ $1 =~ ^(install|reinstall|uninstall)$ ]]; then
|
2017-04-06 16:22:42 +00:00
|
|
|
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
|