forked from occamLab/invisible-map-generation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_g2opy.sh
executable file
·40 lines (33 loc) · 1.18 KB
/
setup_g2opy.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
#!/bin/bash
# Installs g2opy. Adapted from the setup script in the g2opy repository. It may be run from any directory.
VENV_DIR_REL_PATH="./venv"
VENV_ACTIVATE_PATH="${VENV_DIR_REL_PATH}/bin/activate"
# To handle this script being run from any directory, cd into the repository's root directory
SCRIPT_PATH=$(relpath "$0")
REPODIR=$(dirname "$(dirname "$SCRIPT_PATH")")
cd "$REPODIR" || exit
if [ ! -d ${VENV_DIR_REL_PATH} ]
then
echo "Could not find a directory at ${VENV_DIR_REL_PATH} to be used as the venv directory; will proceed with Python at: $(which python3)"
else
echo "Activating the virtual environment with activate script at ${VENV_ACTIVATE_PATH}"
# shellcheck disable=SC1090
source "${VENV_ACTIVATE_PATH}" || exit
which python3
fi
if [ ! -d "./g2opy/" ] # Ignore cloning the repository if it already exists
then
git clone https://github.com/occamLab/g2opy || exit
fi
cd g2opy || exit
if [ ! -d "./build/" ] # Make a new build directory if one doesn't already exist
then
mkdir build || exit
fi
cd build || exit
cmake .. || exit
make "-j$(nproc --all)" || exit
cd ..
echo "Using python version: $(python3 --version)"
python3 setup.py install || exit
cd "${REPODIR}" || exit