cmake: do not duplicate libm #509
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: Linux | |
on: [push, pull_request] | |
jobs: | |
build: | |
name: ${{matrix.os}}-GCC-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.components}}-${{matrix.gpu}}-${{matrix.metis}} | |
runs-on: ${{matrix.os}} | |
defaults: | |
run: | |
shell: bash | |
env: | |
CCACHE_DIR: ${{github.workspace}}/ccache | |
DEBIAN_FRONTEND: noninteractive | |
strategy: | |
fail-fast: true | |
matrix: | |
os: | |
- ubuntu-20.04 | |
- ubuntu-22.04 | |
build_type: [Release, Debug] | |
lib: [shared, static] | |
components: [minimal, lgpl, gpl] | |
gpu: [no-cuda, cuda] | |
metis: [no-metis, metis] | |
exclude: | |
# METIS is only usable if CHOLMOD is compiled | |
- components: minimal | |
metis: metis | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Update Packages | |
run: | | |
sudo apt-get update | |
- name: Setup Download Dependencies | |
if: steps.cache-cmake.outputs.cache-hit != 'true' | |
run: | | |
sudo apt-get install -y \ | |
wget | |
- name: Setup Minimal Dependencies | |
run: | | |
sudo apt-get install -y \ | |
build-essential \ | |
ccache \ | |
gfortran \ | |
libblas-dev \ | |
liblapack-dev \ | |
libomp-dev \ | |
libtbb-dev \ | |
ninja-build \ | |
nvidia-cuda-toolkit \ | |
wget | |
- name: Setup METIS Dependencies | |
if: ${{matrix.metis == 'metis'}} | |
run: | | |
sudo apt-get install -y \ | |
libmetis-dev \ | |
- name: Setup CUDA Dependencies | |
if: ${{matrix.gpu == 'cuda'}} | |
run: | | |
sudo apt-get install -y \ | |
ninja-build \ | |
nvidia-cuda-toolkit | |
# Due to a mismatch in LTO version used by GCC and CUDA compiler, enable | |
# -flto only when building the non-CUDA version of the library. | |
- name: Setup Environment | |
if: ${{matrix.build_type == 'Release' && matrix.gpu != 'cuda'}} | |
run: | | |
echo 'CFLAGS=-flto' >> $GITHUB_ENV | |
echo 'CXXFLAGS=-flto' >> $GITHUB_ENV | |
- name: Cache Build | |
id: cache-build | |
uses: actions/cache@v4 | |
with: | |
path: ${{env.CCACHE_DIR}} | |
key: ${{matrix.os}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.components}}-${{matrix.gpu}}-${{matrix.metis}}-ccache-${{github.run_id}} | |
restore-keys: ${{matrix.os}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.components}}-${{matrix.gpu}}-${{matrix.metis}}-ccache- | |
- name: Configure | |
run: | | |
cmake -S . -B build_${{matrix.build_type}}/ \ | |
-DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} \ | |
-DCMAKE_C_COMPILER_LAUNCHER:FILEPATH=ccache \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER:FILEPATH=ccache \ | |
-DCMAKE_Fortran_COMPILER_LAUNCHER:FILEPATH=ccache \ | |
-DCMAKE_INSTALL_PREFIX:PATH=./install \ | |
-DCMAKE_REQUIRE_FIND_PACKAGE_METIS=${{matrix.metis == 'metis'}} \ | |
-DWITH_CUDA=${{matrix.gpu == 'cuda'}} \ | |
-DWITH_GPL=${{matrix.components == 'gpl'}} \ | |
-DWITH_LGPL=${{contains(matrix.components, 'gpl')}} \ | |
-DWITH_METIS=${{matrix.metis == 'metis'}} \ | |
-G Ninja | |
- name: Build | |
run: | | |
cmake --build build_${{matrix.build_type}}/ \ | |
--config ${{matrix.build_type}} | |
- name: Install | |
run: | | |
cmake --build build_${{matrix.build_type}}/ \ | |
--config ${{matrix.build_type}} \ | |
--target install |