Skip to content

Add ability to build with Clang #2354

Add ability to build with Clang

Add ability to build with Clang #2354

Workflow file for this run

name: CMake
on:
pull_request:
types: [opened, synchronize, reopened]
#paths-ignore:
#- docs/**
#- README.md
#- README_PYPI.md
#- cli/**
#- images/**
#- .gitignore
#- COPYING
#- pyproject.toml
#- examples/**
push:
branches:
- main
#paths-ignore:
#- docs/**
#- README.md
#- README_PYPI.md
#- cli/**
#- images/**
#- .gitignore
#- COPYING
#- pyproject.toml
#- examples/**
workflow_dispatch:
jobs:
run_tests:
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
compiler:
- gcc
- llvm-clang
- apple-clang
cfg:
- { BUILD_TYPE: Release }
- { BUILD_TYPE: Debug }
- { BUILD_TYPE: Debug, SANITIZER : ADDRESS }
- { BUILD_TYPE: Debug, SANITIZER : UB }
exclude:
- os: ubuntu-latest
compiler: apple-clang
- os: macos-latest
compiler: gcc
# Comment this to enable macOS-llvm-clang tests:
- os: macos-latest
compiler: llvm-clang
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install dependencies
uses: ./.github/composite-actions/install-dependencies
with:
os: ${{ matrix.os }}
toolset: ${{ matrix.compiler }}
- name: Download datasets
uses: ./.github/composite-actions/download-datasets
- name: Build
shell: bash
# Maybe separate composite action will be more readable?
run: |
if [[ ${{ matrix.os }} == 'ubuntu-latest' && ${{ matrix.compiler }} == 'gcc' ]]; then
echo "Ubuntu, GCC"
export CC=gcc-10
export CXX=g++-10
elif [[ ${{ matrix.os }} == 'ubuntu-latest' && ${{ matrix.compiler }} == 'llvm-clang' ]]; then
echo "Ubuntu, LLVM Clang"
export CC=clang-17
export CXX=clang++-17
export CXXFLAGS="-stdlib=libc++"
export LDFLAGS="-lc++abi"
elif [[ ${{ matrix.os }} == 'macos-latest' && ${{ matrix.compiler }} == 'llvm-clang' ]]; then
echo "macOS, LLVM Clang"
export CC=$(brew --prefix llvm@17)/bin/clang
export CXX=$(brew --prefix llvm@17)/bin/clang++
export BOOST_ROOT=/usr/local
elif [[ ${{ matrix.os }} == 'macos-latest' && ${{ matrix.compiler }} == 'apple-clang' ]]; then
echo "macOS, Apple Clang"
export CC=clang
export CXX=clang++
else
echo 'Invalid matrix configuration'
exit 1
fi
if [[ "${{matrix.cfg.BUILD_TYPE}}" == "Debug" ]]; then
./build.sh --debug --sanitizer=${{ matrix.cfg.SANITIZER }}
else
./build.sh
fi
- name: Test
working-directory: ${{github.workspace}}/build/target
shell: bash
run: |
if [[ ${{ matrix.os }} == 'macos-latest' ]]; then
export DYLD_LIBRARY_PATH=/usr/local/lib:${DYLD_LIBRARY_PATH}
fi
./Desbordante_test --gtest_filter='*:-*HeavyDatasets*'