mirror of
https://github.com/introlab/rtabmap.git
synced 2026-10-05 01:27:46 +08:00
CI(macos): extract source deps into composite action with per-dep caches
Move the source-only dependency builds (GTSAM, libnabo+libpointmatcher, OrbbecSDK, depthai) out of cmake-macos.yml into a composite action, .github/actions/install-macos-source-deps, mirroring the existing install-windows-deps convention. Each dependency now has its own cache (keyed on its version + patch + the brew/Xcode hash), so bumping one dependency no longer rebuilds the others. Patches moved next to the action that applies them. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
75f4fa6bd5
commit
a260d7e832
@@ -26,16 +26,16 @@ jobs:
|
||||
include:
|
||||
- build_name: macos-sequoia-intel
|
||||
os: macos-15-intel
|
||||
extra_cmake_def: '-DBUILD_AS_BUNDLE=ON -DWITH_ORBBEC_SDK=ON'
|
||||
extra_cmake_def: '-DBUILD_AS_BUNDLE=ON -DWITH_ORBBEC_SDK=ON -DWITH_DEPTHAI=ON'
|
||||
- build_name: macos-sequoia-apple-silicon
|
||||
os: macos-15
|
||||
extra_cmake_def: '-DBUILD_AS_BUNDLE=ON -DWITH_ORBBEC_SDK=ON'
|
||||
extra_cmake_def: '-DBUILD_AS_BUNDLE=ON -DWITH_ORBBEC_SDK=ON -DWITH_DEPTHAI=ON'
|
||||
- build_name: macos-tahoe-intel
|
||||
os: macos-26-intel
|
||||
extra_cmake_def: '-DBUILD_AS_BUNDLE=ON -DWITH_ORBBEC_SDK=ON'
|
||||
extra_cmake_def: '-DBUILD_AS_BUNDLE=ON -DWITH_ORBBEC_SDK=ON -DWITH_DEPTHAI=ON'
|
||||
- build_name: macos-tahoe-apple-silicon
|
||||
os: macos-26
|
||||
extra_cmake_def: '-DBUILD_AS_BUNDLE=ON -DWITH_ORBBEC_SDK=ON'
|
||||
extra_cmake_def: '-DBUILD_AS_BUNDLE=ON -DWITH_ORBBEC_SDK=ON -DWITH_DEPTHAI=ON'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -43,112 +43,15 @@ jobs:
|
||||
- name: Install Brew Dependencies
|
||||
run: |
|
||||
# Update brew and install from Brewfile if present, or specific packages
|
||||
brew install pcl opencv octomap g2o pdal yaml-cpp librealsense libfreenect libusb
|
||||
|
||||
- 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" -DBUILD_EVALUATIONS=OFF -DBUILD_EXAMPLES=OFF
|
||||
cmake --build build -j$NPROC
|
||||
DESTDIR="$STAGE" cmake --install build
|
||||
|
||||
# --- orbbec SDK ---
|
||||
git clone --depth 1 --branch v2.8.7 https://github.com/orbbec/OrbbecSDK_v2.git "$SRC/OrbbecSDK_v2"
|
||||
cd "$SRC/OrbbecSDK_v2"
|
||||
git apply "$PATCHES/orbbecsdk-2.8.7-cmake-config-install.patch"
|
||||
cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_PREFIX_PATH="$STAGE/usr/local" -DOB_BUILD_DOCS=OFF -DOB_BUILD_EXAMPLES=OFF -DOB_BUILD_TOOLS=OFF -DOB_INSTALL_EXAMPLES_SOURCE=OFF
|
||||
cmake --build build -j$NPROC
|
||||
DESTDIR="$STAGE" cmake --install build
|
||||
|
||||
# --- depthai ---
|
||||
git clone --depth 1 --branch v2.32.0 https://github.com/luxonis/depthai-core.git "$SRC/depthai-core"
|
||||
cd "$SRC/depthai-core"
|
||||
git submodule update --init --recursive
|
||||
git apply "$PATCHES/depthai-2.32.0-homebrew-no-vcpkg"
|
||||
PREFIX="$(brew --prefix);$(brew --prefix libarchive);$(brew --prefix openssl@3);$(brew --prefix bzip2);$(brew --prefix zlib)"
|
||||
cmake -B build --preset minimal \
|
||||
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
|
||||
-DCMAKE_PREFIX_PATH="$STAGE/usr/local" \
|
||||
-DBUILD_SHARED_LIBS=ON \
|
||||
-DDEPTHAI_BOOTSTRAP_VCPKG=OFF \
|
||||
-DDEPTHAI_OPENCV_SUPPORT=ON \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX"
|
||||
cmake --build build -j$NPROC
|
||||
DESTDIR="$STAGE" cmake --install build
|
||||
brew install pcl opencv octomap g2o pdal yaml-cpp librealsense libfreenect libusb zlib
|
||||
|
||||
- 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/
|
||||
# Build (and per-dependency cache) the source-only deps not available from
|
||||
# Homebrew, then install them into /usr/local. See the composite action.
|
||||
uses: ./.github/actions/install-macos-source-deps
|
||||
with:
|
||||
os: ${{ matrix.os }}
|
||||
build_type: ${{ env.BUILD_TYPE }}
|
||||
|
||||
- name: Configure CMake
|
||||
run: |
|
||||
|
||||
Reference in New Issue
Block a user