Skip to content

Commit

Permalink
CI: always use libc++ with clang
Browse files Browse the repository at this point in the history
  • Loading branch information
bblanchon committed Nov 6, 2023
1 parent 4774ca3 commit f7dcea5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions extras/CompileOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit f7dcea5

Please sign in to comment.