forked from Mesocopic/branchedflowsim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·46 lines (40 loc) · 1.15 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
#!/bin/bash
#
# This is a convenience script to facilitate easy installation in the most common circumstances.
#
# remember source dir as an absolute path
SOURCE_DIR=$(cd `dirname ${BASH_SOURCE}` && pwd)
# if we are in a virtual env, install to it
if [ -z "${VIRTUAL_ENV}" ]; then
PREFIX=~/.local/
PIP_ARGS="--user"
if [ -z "${BUILD_DIRECTORY}" ]; then
BUILD_DIRECTORY=/tmp/build-bsim
fi
else
PREFIX=${VIRTUAL_ENV}
PIP_ARGS=""
if [ -z "${BUILD_DIRECTORY}" ]; then
BUILD_DIRECTORY=${VIRTUAL_ENV}/tmp/build-bsim
fi
fi
# ensure build directory exists
if [ ! -d "$BUILD_DIRECTORY" ]; then
mkdir -p ${BUILD_DIRECTORY}
fi
# if we set install prefix externally, we override
# the default install dir
if [ -z ${INSTALL_PREFIX+x} ]; then
PREFIX=${PREFIX}
else
PREFIX=${INSTALL_PREFIX}
fi
export CXXFLAGS="-pipe -Wall -Wextra -pedantic -Wfloat-equal -mtune=native"
export CFLAGS=${CXXFLAGS}
cd ${BUILD_DIRECTORY}
cmake -g "Unix Makefiles" ${SOURCE_DIR}/ \
-DCMAKE_BUILD_TYPE=Release \
-DPIP_ARGS="$PIP_ARGS" \
-DCMAKE_INSTALL_PREFIX=${PREFIX}/ "$@"
make -j$(nproc) --no-print-directory
make install