Last active
May 18, 2017 13:33
-
-
Save bergercookie/a41df61c0030a586922254bdb87680af to your computer and use it in GitHub Desktop.
Script for setting up MRPT from sources
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Mon Sep 19 12:51:30 EEST 2016, Nikos Koukis | |
# Setup MRPT in the current host | |
# | |
# Script sets up the dependencies for MRPT, clones the MRPT repository from | |
# github and setup the MRPT build directory in the USER's home directory | |
###################################################################### | |
# make sure we have the necessary set of tools | |
if ! [ -x "$(which git)" ]; then | |
printf "[*] Git is not in %s's path.\nExiting...\n" "${USER}" | |
exit 1 | |
fi | |
if ! [ -x "$(which cmake)" ]; then | |
printf "[*] CMake is not in %s's path.\nExiting...\n" "${USER}" | |
exit 1 | |
fi | |
# http://www.mrpt.org/Building_and_Installing_Instructions#13_Ubuntu_Debian | |
echo "[*] Installing dependencies for MRPT..." | |
dependencies="build-essential pkg-config cmake \ | |
libwxgtk3.0-dev libftdi-dev freeglut3-dev \ | |
zlib1g-dev libusb-1.0-0-dev libudev-dev libfreenect-dev \ | |
libdc1394-22-dev libavformat-dev libswscale-dev \ | |
libassimp-dev libjpeg-dev libopencv-dev libgtest-dev \ | |
libeigen3-dev libsuitesparse-dev libpcap-dev" | |
sudo apt-get install $dependencies | |
# remote repo to clone from | |
mrpt_github_url="https://github.com/bergercookie/mrpt" | |
mrpt_github_branch="graphslam-devel2" | |
# local paths configuration | |
mrpt_src="${HOME}/mrpt" | |
mrpt_build="${HOME}/mrpt_build" | |
# parameters for make | |
make_threads=2 | |
old_pwd="${PWD}" | |
# clone mrpt repo and install it | |
echo "[*] Cloning MRPT repository..." | |
git clone "$mrpt_github_url" "$mrpt_src" | |
cd "$mrpt_src" | |
printf "[*] Checking out \"%s\" branch...\n" "$mrpt_github_branch" | |
git checkout "$mrpt_github_branch" | |
if [ -d $mrpt_build ]; then | |
printf "\n\n[*] mrpt build directory \"%s\" already exists! Writing on top of it... \n" "$mrpt_build" | |
fi | |
mkdir -p "$mrpt_build" | |
cd "$mrpt_build" | |
# cmake from source | |
printf "[*] Running cmake with src path: %s\n" "$mrpt_src" | |
cmake "$mrpt_src" | |
echo "[*] Running make" | |
make -j"$make_threads" -l"$make_threads" | |
# cd back to the starting dir | |
cd "$old_pwd" | |
# write to .bashrc | |
echo "[*] Writing corresponding lines in ${HOME}/.bashrc" | |
bashrc_pth="${HOME}/.bashrc" | |
printf "\n#MRPT Environment setting lines\n" | tee -a ${bashrc_pth} | |
printf "export MRPT_DIR=${mrpt_build}\n" | tee -a ${bashrc_pth} | |
printf "export mrpt=${mrpt_src}\n" | tee -a ${bashrc_pth} | |
echo "[*] MRPT setup completed successfully." | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment