forked from epfl-lasa/control-libraries
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
executable file
·86 lines (68 loc) · 3.51 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
85
86
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
INSTALL_DESTINATION="/usr/local"
AUTO_INSTALL=""
PINOCCHIO_TAG=v2.9.0
HPP_FCL_TAG=v1.8.1
FAIL_MESSAGE="The provided input arguments are not valid.
Run the script with the '--help' argument."
HELP_MESSAGE="Usage: [sudo] ./install.sh [OPTIONS]
An install script for the control libraries.
Options:
-y, --auto Suppress any input prompts and
automatically approve install steps.
-d, --dir [path] Configure the installation directory
(default: ${INSTALL_DESTINATION}).
--clean Delete any previously installed header
files from /usr/local/include and any
shared library files from /usr/local/lib.
--cleandir [path] Delete any previously installed header
and library files from the specified path.
-h, --help Show this help message."
function uninstall {
function delete_components {
rm -r "${INSTALL_DESTINATION}"/include/controllers
rm -r "${INSTALL_DESTINATION}"/include/dynamical_systems
rm -r "${INSTALL_DESTINATION}"/include/robot_model
rm -r "${INSTALL_DESTINATION}"/include/state_representation
rm -r "${INSTALL_DESTINATION}"/lib/libcontrollers*.so
rm -r "${INSTALL_DESTINATION}"/lib/libdynamical_systems*.so
rm -r "${INSTALL_DESTINATION}"/lib/librobot_model*.so
rm -r "${INSTALL_DESTINATION}"/lib/libstate_representation*.so
rm -r "${INSTALL_DESTINATION}"/include/clproto
rm -r "${INSTALL_DESTINATION}"/lib/libclproto*.so
}
delete_components >/dev/null 2>&1
echo "Deleted any control library artefacts from ${INSTALL_DESTINATION}."
}
while [ "$#" -gt 0 ]; do
case "$1" in
-y|--auto) AUTO_INSTALL="-y"; shift 1;;
--clean) uninstall; exit 0;;
--cleandir) INSTALL_DESTINATION=$2; uninstall; exit 0;;
-d|--dir) INSTALL_DESTINATION=$2; shift 2;;
-h|--help) echo "$HELP_MESSAGE"; exit 0;;
-*) echo "Unknown option: $1" >&2; echo "$FAIL_MESSAGE"; exit 1;;
esac
done
mkdir -p "${SCRIPT_DIR}"/tmp || exit 1
echo ">>> INSTALLING DEPENDENCIES"
apt update
xargs -a <(awk '! /^ *(#|$)/' "${SCRIPT_DIR}/apt-packages.txt") -r -- apt install "${AUTO_INSTALL}"
cd "${SCRIPT_DIR}"/tmp
cp "${SCRIPT_DIR}"/dependencies/base_dependencies.cmake CMakeLists.txt || exit 1
cmake -B build -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release && cmake --build build && cmake --install build || exit 1
rm -rf build
git clone --depth 1 -b ${HPP_FCL_TAG} --recursive https://github.com/humanoid-path-planner/hpp-fcl || exit 1
cmake -B build -S hpp-fcl -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_PYTHON_INTERFACE=OFF && cmake --build build --target all install || exit 1
rm -rf build
git clone --depth 1 -b ${PINOCCHIO_TAG} --recursive https://github.com/stack-of-tasks/pinocchio
cmake -B build -S pinocchio -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_PYTHON_INTERFACE=OFF -DBUILD_WITH_COLLISION_SUPPORT=ON && cmake --build build --target all install || exit 1
rm -rf build
cp "${SCRIPT_DIR}"/dependencies/dependencies.cmake CMakeLists.txt || exit 1
cmake -B build -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release && cmake --build build && cmake --install build || exit 1
rm -rf build
echo ">>> INSTALLING CONTROL LIBRARIES"
cd "${SCRIPT_DIR}" && rm -rf "${SCRIPT_DIR}"/tmp
cmake -B build -DCMAKE_BUILD_TYPE=Release && cmake --build build && cmake --install build --prefix "${INSTALL_DESTINATION}" || exit 1
rm -rf build