23 lines
871 B
Bash
23 lines
871 B
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
set -euo pipefail
|
||
|
|
|
||
|
|
# Headless MuJoCo only. Never initializes the physical robot.
|
||
|
|
repo_root="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
|
||
|
|
build_dir="${CMVR_BUILD_DIR:-${repo_root}/cmake-build-debug}"
|
||
|
|
cmake --build "$build_dir" --target speedl_reversal_mujoco_test -j 4
|
||
|
|
cd "$repo_root"
|
||
|
|
python3 - "$build_dir" "$@" <<'PY'
|
||
|
|
from pathlib import Path
|
||
|
|
import os
|
||
|
|
import sys
|
||
|
|
|
||
|
|
build = Path(sys.argv[1]).resolve()
|
||
|
|
# Prefer every freshly built project library over output/lib's installed copy.
|
||
|
|
paths = sorted({str(path.parent) for path in build.rglob('*.so')})
|
||
|
|
paths.append(str(Path('output/lib').resolve()))
|
||
|
|
env = os.environ.copy()
|
||
|
|
env['LD_LIBRARY_PATH'] = ':'.join(paths + [env.get('LD_LIBRARY_PATH', '')])
|
||
|
|
binary = build / 'cmvr-es/devices/arm/motor_robot_arm/speedl_reversal_mujoco_test'
|
||
|
|
os.execve(str(binary), [str(binary), *sys.argv[2:]], env)
|
||
|
|
PY
|