Fix find_package logic for poselib in support of homebrew/vcpkg (#2971) #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: COLMAP (Mac) | |
on: | |
push: | |
branches: | |
- main | |
- release/* | |
pull_request: | |
types: [ assigned, opened, synchronize, reopened ] | |
release: | |
types: [ published, edited ] | |
jobs: | |
build: | |
name: ${{ matrix.config.os }} ${{ matrix.config.arch }} ${{ matrix.config.cmakeBuildType }} | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
matrix: | |
config: [ | |
{ | |
os: macos-14, | |
arch: arm64, | |
cmakeBuildType: Release, | |
}, | |
] | |
env: | |
COMPILER_CACHE_VERSION: 1 | |
COMPILER_CACHE_DIR: ${{ github.workspace }}/compiler-cache | |
CCACHE_DIR: ${{ github.workspace }}/compiler-cache/ccache | |
CCACHE_BASEDIR: ${{ github.workspace }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
id: cache-builds | |
with: | |
key: v${{ env.COMPILER_CACHE_VERSION }}-${{ matrix.config.os }}-${{ matrix.config.arch }}-${{ matrix.config.cmakeBuildType }}-${{ github.run_id }}-${{ github.run_number }} | |
restore-keys: v${{ env.COMPILER_CACHE_VERSION }}-${{ matrix.config.os }}-${{ matrix.config.arch }}-${{ matrix.config.cmakeBuildType }} | |
path: ${{ env.COMPILER_CACHE_DIR }} | |
- name: Setup Mac | |
run: | | |
# Fix `brew link` error. | |
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete | |
# Temporary fix, see: https://github.com/actions/runner-images/issues/10984 | |
brew uninstall --ignore-dependencies --force [email protected] | |
brew install \ | |
cmake \ | |
ninja \ | |
boost \ | |
eigen \ | |
flann \ | |
freeimage \ | |
metis \ | |
glog \ | |
googletest \ | |
ceres-solver \ | |
qt5 \ | |
glew \ | |
cgal \ | |
sqlite3 \ | |
ccache | |
# Temporary fix for: https://github.com/ceres-solver/ceres-solver/issues/1118 | |
sed -i '' 's/find_package(Eigen3 ${CERES_EIGEN_VERSION} QUIET)/find_package(Eigen3 ${CERES_EIGEN_VERSION} CONFIG QUIET)/' /opt/homebrew/lib/cmake/Ceres/CeresConfig.cmake | |
- name: Configure and build | |
run: | | |
export PATH="/usr/local/opt/qt@5/bin:$PATH" | |
cmake --version | |
mkdir build | |
cd build | |
cmake .. \ | |
-GNinja \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.config.cmakeBuildType }} \ | |
-DTESTS_ENABLED=ON \ | |
-DCMAKE_PREFIX_PATH="$(brew --prefix qt@5)" | |
ninja | |
- name: Run tests | |
run: | | |
cd build | |
set +e | |
ctest --output-on-failure | |
- name: Cleanup compiler cache | |
run: | | |
set -x | |
ccache --show-stats --verbose | |
ccache --evict-older-than 1d | |
ccache --show-stats --verbose |