mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 08:34:37 +08:00
0b03102b09
Use CMake's standard package discovery output and FeatureSummary instead of custom status messages, so configuration reports package availability, versions, and failure reasons consistently. Rename Ceres feature controls to use the WITH_ prefix to group them consistently and eliminate inconcistent naming. Remove retrospective cache updates so package discovery preserves caller-provided values and avoids unnecessary side effects. Fixes #876 Change-Id: Ib6e40d56a0ea89b292fe34554777593ffda95f42
148 lines
4.8 KiB
YAML
148 lines
4.8 KiB
YAML
name: Linux
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
build:
|
|
name: ${{matrix.os}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.gpu}}
|
|
runs-on: ubuntu-latest
|
|
container: ${{matrix.os}}
|
|
defaults:
|
|
run:
|
|
shell: bash -e -o pipefail {0}
|
|
env:
|
|
CCACHE_DIR: ${{github.workspace}}/ccache
|
|
CMAKE_GENERATOR: Ninja
|
|
DEBIAN_FRONTEND: noninteractive
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
os:
|
|
- ubuntu:22.04
|
|
- ubuntu:24.04
|
|
build_type:
|
|
- Release
|
|
lib:
|
|
- shared
|
|
- static
|
|
gpu:
|
|
- cuda
|
|
- no-cuda
|
|
|
|
steps:
|
|
- name: Setup Dependencies
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y \
|
|
build-essential \
|
|
ccache \
|
|
cmake \
|
|
git \
|
|
libbenchmark-dev \
|
|
libblas-dev \
|
|
libeigen3-dev \
|
|
liblapack-dev \
|
|
libmetis-dev \
|
|
libsuitesparse-dev \
|
|
ninja-build \
|
|
wget
|
|
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
# nvidia cuda toolkit + gcc combo shipped with 22.04LTS is broken
|
|
# and is not able to compile code that uses thrust
|
|
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1006962
|
|
- name: Setup CUDA Toolkit Repositories (22.04)
|
|
if: matrix.gpu == 'cuda' && matrix.os == 'ubuntu:22.04'
|
|
run: |
|
|
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb
|
|
dpkg -i cuda-keyring_1.0-1_all.deb
|
|
|
|
- name: Setup CUDA Toolkit Repositories (24.04)
|
|
if: matrix.gpu == 'cuda' && matrix.os == 'ubuntu:24.04'
|
|
run: |
|
|
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb
|
|
dpkg -i cuda-keyring_1.1-1_all.deb
|
|
|
|
- name: Setup CUDA Toolkit (<24.04)
|
|
if: matrix.gpu == 'cuda' && matrix.os != 'ubuntu:24.04'
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y cuda
|
|
echo "CUDACXX=/usr/local/cuda/bin/nvcc" >> $GITHUB_ENV
|
|
|
|
- name: Setup CUDA Toolkit (>=24.04)
|
|
if: matrix.gpu == 'cuda' && matrix.os == 'ubuntu:24.04'
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y nvidia-cuda-toolkit
|
|
echo "CUDACXX=/usr/lib/nvidia-cuda-toolkit/bin/nvcc" >> $GITHUB_ENV
|
|
|
|
- name: Setup cuDSS
|
|
if: matrix.gpu == 'cuda'
|
|
run: |
|
|
wget https://developer.download.nvidia.com/compute/cudss/redist/libcudss/linux-x86_64/libcudss-linux-x86_64-0.3.0.9_cuda12-archive.tar.xz
|
|
tar -xf libcudss-linux-x86_64-0.3.0.9_cuda12-archive.tar.xz
|
|
echo "cudss_DIR=${{github.workspace}}/libcudss-linux-x86_64-0.3.0.9_cuda12-archive/lib/cmake/cudss" >> $GITHUB_ENV
|
|
|
|
- name: Cache Mold
|
|
id: cache-mold
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: mold-2.36.0-x86_64-linux/
|
|
key: mold-2.36.0
|
|
|
|
- name: Setup Mold
|
|
if: steps.cache-mold.outputs.cache-hit != 'true'
|
|
run: |
|
|
wget https://github.com/rui314/mold/releases/download/v2.36.0/mold-2.36.0-x86_64-linux.tar.gz
|
|
tar xvf mold-2.36.0-x86_64-linux.tar.gz
|
|
|
|
- name: Cache Build
|
|
id: cache-build
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{env.CCACHE_DIR}}
|
|
key: ${{matrix.os}}-ccache-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.gpu}}-${{github.run_id}}
|
|
restore-keys: ${{matrix.os}}-ccache-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.gpu}}-
|
|
|
|
- name: Setup Build Environment
|
|
if: matrix.build_type == 'Release'
|
|
run: |
|
|
echo 'CXXFLAGS=-flto=auto -Werror=odr' >> $GITHUB_ENV
|
|
|
|
- name: Setup Runtime Environment
|
|
run: |
|
|
echo "${{github.workspace}}/mold-2.36.0-x86_64-linux/libexec/mold" >> $GITHUB_PATH
|
|
|
|
- name: Configure
|
|
run: |
|
|
cmake -S . -B build_${{matrix.build_type}} \
|
|
-DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} \
|
|
-DWITH_CUDA=${{matrix.gpu == 'cuda'}} \
|
|
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
|
|
-DCMAKE_C_COMPILER_LAUNCHER=$(which ccache) \
|
|
-DCMAKE_CXX_COMPILER_LAUNCHER=$(which ccache) \
|
|
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install
|
|
|
|
- name: Build
|
|
run: |
|
|
cmake --build build_${{matrix.build_type}} \
|
|
--config ${{matrix.build_type}}
|
|
|
|
- name: Test
|
|
if: matrix.gpu == 'no-cuda'
|
|
run: |
|
|
cd build_${{matrix.build_type}}/
|
|
ctest --build-config ${{matrix.build_type}} \
|
|
--output-on-failure \
|
|
-j$(nproc)
|
|
|
|
- name: Install
|
|
run: |
|
|
cmake --build build_${{matrix.build_type}}/ \
|
|
--config ${{matrix.build_type}} \
|
|
--target install
|