Skip to content

Commit

Permalink
[debian] Correctly setup environment to find ROS2
Browse files Browse the repository at this point in the history
  • Loading branch information
gergondet committed Oct 12, 2023
1 parent ef10c08 commit 209e0f5
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,20 @@
# -*- makefile -*-

export ROS_DISTRO:=@ROS_DISTRO@
export CMAKE_PREFIX_PATH:=/opt/ros/${ROS_DISTRO}:${CMAKE_PREFIX_PATH}
export LD_LIBRARY_PATH:=/opt/ros/${ROS_DISTRO}/lib:${LD_LIBRARY_PATH}
export ROS_VERSION:=$(shell . /opt/ros/${ROS_DISTRO}/setup.sh && echo $$ROS_VERSION)
export ROS_PYTHON_VERSION:=$(shell . /opt/ros/${ROS_DISTRO}/setup.sh && echo $$ROS_PYTHON_VERSION)
ifeq (${ROS_PYTHON_VERSION}, 3)
export PYTHONPATH:=/opt/ros/${ROS_DISTRO}/lib/python3/dist-packages:${PYTHONPATH}
export PYTHONPATH:=/opt/ros/${ROS_DISTRO}/lib/python$(shell python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}');")/site-packages:${PYTHONPATH}
else
export PYTHONPATH:=/opt/ros/${ROS_DISTRO}/lib/python2.7/dist-packages:${PYTHONPATH}
endif
ifeq (${ROS_VERSION}, 2)
export AMENT_PREFIX_PATH:=/opt/ros/${ROS_DISTRO}
else
export CMAKE_PREFIX_PATH:=/opt/ros/${ROS_DISTRO}:$CMAKE_PREFIX_PATH
endif
export LD_LIBRARY_PATH:=/opt/ros/${ROS_DISTRO}/lib/x86_64-linux-gnu:/opt/ros/${ROS_DISTRO}/lib:${LD_LIBRARY_PATH}

%:
dh $@ --parallel

0 comments on commit 209e0f5

Please sign in to comment.