2021-10-14 13:47:35 +02:00

53 lines
1.7 KiB
Bash

#!/bin/bash
## By default, paths specified by CMake install will be used to locate OpenViBE components. If defined, these ENV variables can override the CMake defines.
#export OV_PATH_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
#export OV_PATH_BIN="$OV_PATH_ROOT/bin"
#export OV_PATH_LIB="$OV_PATH_ROOT/lib"
#export OV_PATH_DATA="$OV_PATH_ROOT/share/openvibe"
if [ "$OV_PATH_ROOT" == "" ]; then
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
OV_PATH_ROOT="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$OV_PATH_ROOT/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
OV_PATH_ROOT="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
fi
export LD_LIBRARY_PATH="$OV_PATH_LIB:@CMAKE_SOURCE_DIR@/dependencies/lib:$LD_LIBRARY_PATH"
export LC_ALL=C
# The following line is there to help in cases where OpenViBE can consume excessive
# amounts of CPU or grind the swap. You can remove it if you know what you're doing.
renice 19 $$
ov_debugger=
if [ "$1" == "--debug" ]; then
ov_debugger="gdb --args"
shift
fi
if [ "$1" == "--memcheck" ]; then
ov_debugger="valkyrie "
#ov_debugger="valgrind --tool=memcheck --log-file='valgrind_@OV_CMD_EXECUTABLE@_%p.log'"
shift
fi
ov_run_bg=0
if [ "$1" == "--run-bg" ]; then
ov_run_bg=1
shift
fi
ret_code=0
if [ $ov_run_bg == 0 ]; then
eval $ov_debugger "$OV_PATH_BIN/@OV_CMD_EXECUTABLE@" @OV_CMD_ARGS@ $*
ret_code=$?
else
$ov_debugger "$OV_PATH_BIN/@OV_CMD_EXECUTABLE@" @OV_CMD_ARGS@ $* &
fi
exit $ret_code