adding g2o gtsam to linux ci

This commit is contained in:
matlabbe
2026-08-22 11:14:51 -07:00
parent 722d9047f7
commit 2ae63cefd3
2 changed files with 49 additions and 6 deletions

19
.github/scripts/ros-deps-env.sh vendored Normal file
View File

@@ -0,0 +1,19 @@
# Puts the graph optimizers taken from the ROS 2 repo (see cmake-linux.yml) on
# the loader path, for a shell that is about to run something built against
# them. Sourced, not executed: it exports into the caller.
#
# source .github/scripts/ros-deps-env.sh /opt/ros/humble
#
# A missing or empty prefix is a build that took every dependency from the
# Ubuntu archive: nothing to add.
#
# Both directories are needed. GTSAM and g2o install their libraries in the
# multiarch subdirectory, while the prefix's own lib/ holds the rest, and
# libgtsam.so carries no RUNPATH -- so the loader finds neither it nor the
# libmetis-gtsam.so it pulls in without being told where to look.
ros_prefix="${1:-}"
if [ -n "$ros_prefix" ] && [ -d "$ros_prefix" ]; then
ros_lib="$ros_prefix/lib"
export LD_LIBRARY_PATH="${ros_lib}:${ros_lib}/$(gcc -dumpmachine)${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
fi

View File

@@ -28,22 +28,32 @@ jobs:
matrix:
build_name: [ubuntu-22.04, ubuntu-24.04, ubuntu-24.04-with-opengv, ubuntu-26.04]
include:
# GTSAM is in no Ubuntu release, and libg2o-dev only appears in the
# archive from noble on (jammy has no g2o at all).
- build_name: ubuntu-22.04
os: ubuntu-22.04
extra_deps: "libunwind-dev libceres-dev"
extra_cmake_def: "-DWITH_CERES=ON -DWITH_PYTHON=ON"
ros_deps: "ros-humble-libg2o ros-humble-gtsam"
ros_prefix: "/opt/ros/humble"
extra_cmake_def: "-DWITH_CERES=ON -DWITH_PYTHON=ON -DWITH_G2O=ON -DWITH_GTSAM=ON"
- build_name: ubuntu-24.04
os: ubuntu-24.04
extra_deps: "libg2o-dev libceres-dev"
extra_cmake_def: "-DWITH_CERES=ON -DWITH_PYTHON=ON"
ros_deps: "ros-jazzy-gtsam"
ros_prefix: "/opt/ros/jazzy"
extra_cmake_def: "-DWITH_CERES=ON -DWITH_PYTHON=ON -DWITH_G2O=ON -DWITH_GTSAM=ON"
- build_name: ubuntu-24.04-with-opengv
os: ubuntu-24.04
extra_deps: "libg2o-dev libceres-dev"
extra_cmake_def: "-DWITH_CERES=ON -DWITH_PYTHON=ON -DBUILD_OPENGV=ON"
ros_deps: "ros-jazzy-gtsam"
ros_prefix: "/opt/ros/jazzy"
extra_cmake_def: "-DWITH_CERES=ON -DWITH_PYTHON=ON -DWITH_G2O=ON -DWITH_GTSAM=ON -DBUILD_OPENGV=ON"
- build_name: ubuntu-26.04
os: ubuntu-26.04
extra_deps: "libg2o-dev libceres-dev"
extra_cmake_def: "-DWITH_CERES=ON -DWITH_PYTHON=ON -DBUILD_OPENGV=ON"
ros_deps: "ros-lyrical-gtsam"
ros_prefix: "/opt/ros/lyrical"
extra_cmake_def: "-DWITH_CERES=ON -DWITH_PYTHON=ON -DWITH_G2O=ON -DWITH_GTSAM=ON -DBUILD_OPENGV=ON"
steps:
- uses: actions/checkout@v4
@@ -67,7 +77,19 @@ jobs:
run: |
DEBIAN_FRONTEND=noninteractive
sudo apt-get update
sudo apt-get -y install libopencv-dev libpcl-dev git cmake software-properties-common libyaml-cpp-dev ${{ matrix.extra_deps }}
sudo apt-get -y install libopencv-dev libpcl-dev git cmake software-properties-common libyaml-cpp-dev curl gnupg lsb-release ${{ matrix.extra_deps }}
- name: Install Graph Optimizers From The ROS Repo
if: matrix.ros_deps != ''
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo curl -fsSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key \
-o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" \
| sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
sudo apt-get update
sudo apt-get -y install ${{ matrix.ros_deps }}
- name: Set up Python
uses: actions/setup-python@v5
@@ -81,7 +103,7 @@ jobs:
- name: Configure CMake
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DPython3_EXECUTABLE=$(which python3) -Dpybind11_DIR=$(python3 -m pybind11 --cmakedir) ${{ matrix.extra_cmake_def }}
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_PREFIX_PATH="${{ matrix.ros_prefix }}" -DPython3_EXECUTABLE=$(which python3) -Dpybind11_DIR=$(python3 -m pybind11 --cmakedir) ${{ matrix.extra_cmake_def }}
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
@@ -89,6 +111,7 @@ jobs:
- name: Info
working-directory: ${{github.workspace}}/build/bin
run: |
source ${{github.workspace}}/.github/scripts/ros-deps-env.sh "${{ matrix.ros_prefix }}"
./rtabmap-console --version
- name: Test
@@ -101,4 +124,5 @@ jobs:
env:
PYTHONNOUSERSITE: 1
run: |
source ${{github.workspace}}/.github/scripts/ros-deps-env.sh "${{ matrix.ros_prefix }}"
ctest -C ${{env.BUILD_TYPE}} -V -LE performance