From f7dcea562ffd859b6852c4ee82578ba56c1d46da Mon Sep 17 00:00:00 2001 From: Benoit Blanchon Date: Mon, 6 Nov 2023 13:24:32 +0100 Subject: [PATCH] CI: always use libc++ with clang --- .github/workflows/ci.yml | 12 ++++++++---- extras/CompileOptions.cmake | 3 +++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 21193f78..79b2336a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,11 +80,9 @@ jobs: matrix: include: - clang: "3.9" - cxxflags: "-stdlib=libc++" runner: ubuntu-20.04 archive: bionic - clang: "4.0" - cxxflags: "-stdlib=libc++" runner: ubuntu-20.04 archive: bionic - clang: "5.0" @@ -121,10 +119,16 @@ jobs: run: | sudo add-apt-repository -yn 'deb http://archive.ubuntu.com/ubuntu/ ${{ matrix.archive }} main' sudo add-apt-repository -yn 'deb http://archive.ubuntu.com/ubuntu/ ${{ matrix.archive }} universe' - - name: Install + - name: Install Clang ${{ matrix.clang }} run: | sudo apt-get update sudo apt-get install -y clang-${{ matrix.clang }} + - name: Install libc++ ${{ matrix.clang }} + if: matrix.clang >= 11 + run: sudo apt-get install -y libc++-${{ matrix.clang }}-dev libc++abi-${{ matrix.clang }}-dev + - name: Install libunwind ${{ matrix.clang }} + if: matrix.clang == 12 # dependency is missing in Ubuntu 22.04 + run: sudo apt-get install -y libunwind-${{ matrix.clang }}-dev - name: Checkout uses: actions/checkout@v3 - name: Configure @@ -134,7 +138,7 @@ jobs: CXX: clang++-${{ matrix.clang }} CXXFLAGS: >- ${{ matrix.cxxflags }} - ${{ contains(matrix.cxxflags, 'libc++') && '-I/usr/lib/llvm-10/include/c++/v1/' || '' }} + ${{ matrix.clang < 11 && '-I/usr/lib/llvm-10/include/c++/v1/' || '' }} - name: Build run: cmake --build . - name: Test diff --git a/extras/CompileOptions.cmake b/extras/CompileOptions.cmake index 0cbd576c..65c90827 100644 --- a/extras/CompileOptions.cmake +++ b/extras/CompileOptions.cmake @@ -64,6 +64,9 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") endif() if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + add_compile_options(-stdlib=libc++) + link_libraries(c++ m) + if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.0) AND(NOT ${COVERAGE})) add_compile_options(-g -Og) else()