mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-30 00:50:37 +08:00
Add build configuration with CUDA on Linux
Change-Id: I3144a44692a7a129857b65ed84fb2a5637b25b5d
This commit is contained in:
@@ -4,7 +4,7 @@ on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: ${{matrix.os}}-${{matrix.build_type}}-${{matrix.lib}}
|
||||
name: ${{matrix.os}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.gpu}}
|
||||
runs-on: ubuntu-latest
|
||||
container: ${{matrix.os}}
|
||||
defaults:
|
||||
@@ -25,6 +25,9 @@ jobs:
|
||||
lib:
|
||||
- shared
|
||||
- static
|
||||
gpu:
|
||||
- cuda
|
||||
- no-cuda
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@@ -46,13 +49,21 @@ jobs:
|
||||
libsuitesparse-dev \
|
||||
ninja-build
|
||||
|
||||
- name: Setup CUDA toolkit
|
||||
if: matrix.gpu == 'cuda'
|
||||
run: |
|
||||
apt-get install -y \
|
||||
nvidia-cuda-dev \
|
||||
nvidia-cuda-toolkit
|
||||
|
||||
|
||||
- name: Cache Build
|
||||
id: cache-build
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{env.CCACHE_DIR}}
|
||||
key: ${{matrix.os}}-ccache-${{matrix.build_type}}-${{matrix.lib}}-${{github.run_id}}
|
||||
restore-keys: ${{matrix.os}}-ccache-${{matrix.build_type}}-${{matrix.lib}}-
|
||||
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 Environment
|
||||
if: matrix.build_type == 'Release'
|
||||
@@ -63,6 +74,7 @@ jobs:
|
||||
run: |
|
||||
cmake -S . -B build_${{matrix.build_type}} \
|
||||
-DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} \
|
||||
-DUSE_CUDA=${{matrix.gpu == 'cuda'}} \
|
||||
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=$(which ccache) \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=$(which ccache) \
|
||||
@@ -74,6 +86,7 @@ jobs:
|
||||
--config ${{matrix.build_type}}
|
||||
|
||||
- name: Test
|
||||
if: matrix.gpu == 'no-cuda'
|
||||
run: |
|
||||
cd build_${{matrix.build_type}}/
|
||||
ctest --config ${{matrix.build_type}} \
|
||||
|
||||
Reference in New Issue
Block a user