mirror of
https://github.com/introlab/rtabmap.git
synced 2026-10-04 09:07:47 +08:00
CI(macos): build source deps from source with caching
Add a CI step to build GTSAM 4.2.1, libnabo 1.1.2 and libpointmatcher 1.4.4 from source (not available/usable from Homebrew), with patches under .github/patches fixing Eigen 5 / Boost compatibility. Installs are staged via DESTDIR into an actions/cache directory and copied into /usr/local. The cache key includes the pinned versions, the patch hashes, and the linked Homebrew (eigen/boost/yaml-cpp) + Xcode toolchain versions, so the deps rebuild only when something relevant changes. Also add yaml-cpp brew dep and drop the unused extra_deps matrix field. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
3bc13cab98
commit
febbb49523
@@ -26,19 +26,15 @@ jobs:
|
||||
include:
|
||||
- build_name: macos-sequoia-intel
|
||||
os: macos-15-intel
|
||||
extra_deps: ""
|
||||
extra_cmake_def: '-DBUILD_AS_BUNDLE=ON'
|
||||
- build_name: macos-sequoia-apple-silicon
|
||||
os: macos-15
|
||||
extra_deps: ""
|
||||
extra_cmake_def: '-DBUILD_AS_BUNDLE=ON'
|
||||
- build_name: macos-tahoe-intel
|
||||
os: macos-26-intel
|
||||
extra_deps: ""
|
||||
extra_cmake_def: '-DBUILD_AS_BUNDLE=ON'
|
||||
- build_name: macos-tahoe-apple-silicon
|
||||
os: macos-26
|
||||
extra_deps: ""
|
||||
extra_cmake_def: '-DBUILD_AS_BUNDLE=ON'
|
||||
|
||||
steps:
|
||||
@@ -47,7 +43,88 @@ jobs:
|
||||
- name: Install Brew Dependencies
|
||||
run: |
|
||||
# Update brew and install from Brewfile if present, or specific packages
|
||||
brew install pcl opencv octomap g2o pdal
|
||||
brew install pcl opencv octomap g2o pdal yaml-cpp
|
||||
|
||||
- name: Resolve dependency versions
|
||||
id: depver
|
||||
# The source dependencies link against these Homebrew libraries and are
|
||||
# compiled with Xcode's toolchain, so both are folded into the source-deps
|
||||
# cache key: a Homebrew bump (e.g. a new Eigen) or an Xcode update
|
||||
# invalidates the cache and forces a rebuild.
|
||||
run: |
|
||||
BREW=$(brew list --versions eigen boost yaml-cpp | sort)
|
||||
XCODE=$(xcodebuild -version 2>/dev/null || clang --version | head -1)
|
||||
HASH=$(printf '%s\n%s\n' "$BREW" "$XCODE" | shasum | cut -d' ' -f1)
|
||||
echo "hash=$HASH" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Cache Source Dependencies
|
||||
id: cache-src-deps
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
# Staged install tree (DESTDIR) of the source-built dependencies.
|
||||
path: ${{ runner.temp }}/deps-stage
|
||||
# Rebuild when the OS image, pinned versions, patches, the linked
|
||||
# Homebrew library versions or the Xcode toolchain change.
|
||||
key: src-deps-${{ matrix.os }}-gtsam4.2.1-libnabo1.1.2-lpm1.4.4-deps${{ steps.depver.outputs.hash }}-${{ hashFiles('.github/patches/*.patch') }}
|
||||
|
||||
- name: Build Source Dependencies
|
||||
# Dependencies not available (or not in a usable version) from Homebrew are
|
||||
# built from source and staged into the cached directory via DESTDIR.
|
||||
# Patches under .github/patches fix compatibility with the current Homebrew
|
||||
# Eigen/Boost versions. Skipped entirely on a cache hit.
|
||||
if: steps.cache-src-deps.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
set -e
|
||||
NPROC=$(sysctl -n hw.logicalcpu)
|
||||
PATCHES="${{ github.workspace }}/.github/patches"
|
||||
SRC="${{ runner.temp }}/src-deps"
|
||||
STAGE="${{ runner.temp }}/deps-stage"
|
||||
mkdir -p "$SRC" "$STAGE"
|
||||
|
||||
# --- GTSAM 4.2.1 ---
|
||||
git clone --depth 1 --branch 4.2.1 https://github.com/borglab/gtsam.git "$SRC/gtsam"
|
||||
cd "$SRC/gtsam"
|
||||
git apply "$PATCHES/gtsam-4.2.1-eigen5.patch"
|
||||
cmake -B build \
|
||||
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
|
||||
-DGTSAM_BUILD_WITH_MARCH_NATIVE=OFF \
|
||||
-DGTSAM_WITH_TBB=OFF \
|
||||
-DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF \
|
||||
-DGTSAM_BUILD_TESTS=OFF \
|
||||
-DGTSAM_BUILD_UNSTABLE=OFF \
|
||||
-DGTSAM_USE_SYSTEM_EIGEN=ON \
|
||||
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
|
||||
cmake --build build -j$NPROC
|
||||
DESTDIR="$STAGE" cmake --install build
|
||||
|
||||
# --- libnabo 1.1.2 (required by libpointmatcher) ---
|
||||
git clone --depth 1 --branch 1.1.2 https://github.com/ethz-asl/libnabo.git "$SRC/libnabo"
|
||||
cd "$SRC/libnabo"
|
||||
git apply "$PATCHES/libnabo-1.1.2.patch"
|
||||
cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
|
||||
cmake --build build -j$NPROC
|
||||
DESTDIR="$STAGE" cmake --install build
|
||||
|
||||
# --- libpointmatcher 1.4.4 (finds libnabo from the staged prefix) ---
|
||||
git clone --depth 1 --branch 1.4.4 https://github.com/ethz-asl/libpointmatcher.git "$SRC/libpointmatcher"
|
||||
cd "$SRC/libpointmatcher"
|
||||
git apply "$PATCHES/libpointmatcher-1.4.4-boost.patch"
|
||||
cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_PREFIX_PATH="$STAGE/usr/local"
|
||||
cmake --build build -j$NPROC
|
||||
DESTDIR="$STAGE" cmake --install build
|
||||
|
||||
- name: Install Source Dependencies
|
||||
# Copy the (possibly cached) staged install tree into /usr/local so
|
||||
# rtabmap's find_package() and the bundle fixup (which search /usr/local)
|
||||
# pick the dependencies up. Runs on both cache hit and miss.
|
||||
run: |
|
||||
set -e
|
||||
STAGE="${{ runner.temp }}/deps-stage"
|
||||
if [ ! -d "$STAGE/usr/local" ]; then
|
||||
echo "No staged dependencies found at $STAGE/usr/local" >&2
|
||||
exit 1
|
||||
fi
|
||||
sudo cp -a "$STAGE/usr/local/." /usr/local/
|
||||
|
||||
- name: Configure CMake
|
||||
run: |
|
||||
|
||||
Reference in New Issue
Block a user