CI: always use libc++ with clang

This commit is contained in:
Benoit Blanchon
2023-11-06 13:24:32 +01:00
parent 4774ca3d29
commit f7dcea562f
2 changed files with 11 additions and 4 deletions

View File

@ -80,11 +80,9 @@ jobs:
matrix: matrix:
include: include:
- clang: "3.9" - clang: "3.9"
cxxflags: "-stdlib=libc++"
runner: ubuntu-20.04 runner: ubuntu-20.04
archive: bionic archive: bionic
- clang: "4.0" - clang: "4.0"
cxxflags: "-stdlib=libc++"
runner: ubuntu-20.04 runner: ubuntu-20.04
archive: bionic archive: bionic
- clang: "5.0" - clang: "5.0"
@ -121,10 +119,16 @@ jobs:
run: | 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 }} main'
sudo add-apt-repository -yn 'deb http://archive.ubuntu.com/ubuntu/ ${{ matrix.archive }} universe' sudo add-apt-repository -yn 'deb http://archive.ubuntu.com/ubuntu/ ${{ matrix.archive }} universe'
- name: Install - name: Install Clang ${{ matrix.clang }}
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y clang-${{ matrix.clang }} 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 - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Configure - name: Configure
@ -134,7 +138,7 @@ jobs:
CXX: clang++-${{ matrix.clang }} CXX: clang++-${{ matrix.clang }}
CXXFLAGS: >- CXXFLAGS: >-
${{ matrix.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 - name: Build
run: cmake --build . run: cmake --build .
- name: Test - name: Test

View File

@ -64,6 +64,9 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
endif() endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") 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})) if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.0) AND(NOT ${COVERAGE}))
add_compile_options(-g -Og) add_compile_options(-g -Og)
else() else()