Files
a7l20-cup-grasp/runtime/arm/build_totg.py
T

20 lines
948 B
Python

"""Build the offline helper against the installed MoveIt library, no downloads."""
from pathlib import Path
import subprocess
import os
root = Path(__file__).resolve().parent
ros = Path(os.environ.get('CUP_ROS_PREFIX', Path(os.environ.get('CUP_ROS_SETUP', '/opt/ros/jazzy/setup.bash')).parent)).expanduser()
output = root/'build/totg_offline'
output.parent.mkdir(exist_ok=True)
include = [str(p) for p in (ros/'include').iterdir() if p.is_dir()]
cmd = ['g++', '-O2', '-std=c++17', '-I/usr/include/eigen3']
cmd += ['-I'+p for p in include]
cmd += [str(root/'cpp/totg_offline.cpp'), '-L'+str(ros/'lib'),
'-L'+str(ros/'lib/x86_64-linux-gnu'), '-lmoveit_trajectory_processing', '-lruckig',
'-Wl,-rpath,'+str(ros/'lib'), '-Wl,-rpath,'+str(ros/'lib/x86_64-linux-gnu'),
'-Wl,-rpath-link,'+str(ros/'lib'), '-Wl,-rpath-link,'+str(ros/'lib/x86_64-linux-gnu'),
'-o', str(output)]
subprocess.run(cmd, check=True)
print(output)