2012-10-07 11:14:33 +08:00
#
# 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
#
2012-09-28 00:43:51 +08:00
2012-10-07 11:14:33 +08:00
if [ " $BASH_VERSION " ] ; then
MITSUBA_DIR = $( dirname " $BASH_SOURCE " )
export MITSUBA_DIR = $( builtin cd " $MITSUBA_DIR " ; builtin pwd )
elif [ " $ZSH_VERSION " ] ; then
2012-10-20 10:48:21 +08:00
export MITSUBA_DIR = $( dirname " $0 :A " )
2012-10-21 05:11:14 +08:00
fi
2012-09-28 00:43:51 +08:00
2012-10-21 05:11:14 +08:00
pyver = ` python --version 2>& 1 | grep -oE '([[:digit:]].[[:digit:]])' `
if [ [ " $( uname) " = = 'Darwin' ] ] ; then
export PYTHONPATH = " $MITSUBA_DIR /Mitsuba.app/python/ $pyver : $PYTHONPATH "
mitsuba_plugin_dir = " $MITSUBA_DIR /Mitsuba.app/plugins "
else
export PYTHONPATH = " $MITSUBA_DIR /dist/python: $MITSUBA_DIR /dist/python/ $pyver : $PYTHONPATH "
mitsuba_plugin_dir = " $MITSUBA_DIR /dist/plugins "
fi
unset pyver
if [ " $ZSH_VERSION " ] ; then
2012-10-07 11:14:33 +08:00
# Zsh autocomplete for mitsuba, mtsutil, and mtssrv
2012-10-21 05:11:14 +08:00
mitsuba_plugins = $( ls -1 " $mitsuba_plugin_dir " | grep -oE '\w+(\.so|\.dylib)' | sed 's/.so$//;s/.dylib$//' )
2012-10-07 11:14:33 +08:00
compdef "_arguments '-c[connect to host(s)]:host:_hosts' '-s[connect to list of hosts in a file]:hostfile:_files' '-o[output file]:out:_files' '*:scene:_files -g \*.\(xml\|XML\)'" mitsuba
compdef " _arguments '-c[connect to host(s)]:host:_hosts' '-s[connect to list of hosts in a file]:hostfile:_files' '1:plugins:( $mitsuba_plugins )' '*:utilargs:_files' " mtsutil
compdef "_arguments '-c[connect to host(s)]:host:_hosts' '-s[connect to list of hosts in a file]:hostfile:_files'" mtssrv
unset mitsuba_plugins
fi
2012-10-21 05:11:14 +08:00
unset mitsuba_plugin_dir
2012-10-07 11:14:33 +08:00
if [ [ " $( uname) " = = 'Darwin' ] ] ; then
export PATH = " $MITSUBA_DIR /Mitsuba.app/Contents/MacOS: $PATH "
2011-11-20 12:11:37 +08:00
else
2012-10-07 11:14:33 +08:00
export LD_LIBRARY_PATH = " $MITSUBA_DIR /dist: $LD_LIBRARY_PATH "
export PATH = " $MITSUBA_DIR /dist: $PATH "
2012-09-28 00:43:51 +08:00
# Generate core dumps if something goes wrong
2011-11-20 12:11:37 +08:00
ulimit -c 1000000000
fi