-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetpath.sh
45 lines (40 loc) · 1.37 KB
/
setpath.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
#
# This script adds Mitsuba to the current path.
# It works with both Bash and Zsh.
#
# NOTE: this script must be sourced and not run, i.e.
# . setpath.sh for Bash
# source setpath.sh for Zsh or Bash
#
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
echo "The setpath.sh script must be sourced, not executed. In other words, run\n"
echo "$ source setpath.sh\n"
echo "If you wish to use the Mitsuba Python bindings, you should also specify"
echo "your Python version /before/ sourcing setpath.sh, e.g.\n"
echo "$ export PSDRPHY_VER=3.3"
echo "$ source setpath.sh"
exit 0
fi
if [ "$BASH_VERSION" ]; then
PSDR_DIR=$(dirname "$BASH_SOURCE")
export PSDR_DIR=$(builtin cd "$PSDR_DIR"; builtin pwd)
elif [ "$ZSH_VERSION" ]; then
export PSDR_DIR=$(dirname "$0:A")
fi
if [ "$PSDRPHY_VER" ]; then
pyver=$PSDRPHY_VER
else
pyver=`python --version 2>&1 | grep -oE '([[:digit:]].[[:digit:]])' | head -n1`
fi
if [[ "$(uname)" == 'Darwin' ]]; then
export PYTHONPATH="$PSDR_DIR/build/lib:$PSDR_DIR/ext/enoki/build:$PYTHONPATH"
else
export PYTHONPATH="$PSDR_DIR/build/lib:$PSDR_DIR/ext/enoki/build:$PYTHONPATH"
fi
unset pyver
if [[ "$(uname)" == 'Darwin' ]]; then
export PATH="$PSDR_DIR/build:$PSDR_DIR/ext/enoki/build:$PATH"
else
export LD_LIBRARY_PATH="$PSDR_DIR/build/lib:$PSDR_DIR/ext/enoki/build:$LD_LIBRARY_PATH"
export PATH="$PSDR_DIR/build:$PSDR_DIR/ext/enoki/build:$PATH"
fi