From 554c95a8468c3636450c74ce1982a55626f9e952 Mon Sep 17 00:00:00 2001 From: vaxerski Date: Thu, 23 May 2024 11:54:00 +0200 Subject: [PATCH] ci/cmake: fix clang build on arch --- .github/workflows/arch.yml | 8 ++++---- CMakeLists.txt | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/arch.yml b/.github/workflows/arch.yml index 58ddc04..85bc5d8 100644 --- a/.github/workflows/arch.yml +++ b/.github/workflows/arch.yml @@ -17,7 +17,7 @@ jobs: run: | sed -i 's/SigLevel = Required DatabaseOptional/SigLevel = Optional TrustAll/' /etc/pacman.conf pacman --noconfirm --noprogressbar -Syyu - pacman --noconfirm --noprogressbar -Sy gcc base-devel cmake clang + pacman --noconfirm --noprogressbar -Sy gcc base-devel cmake clang libc++ - name: Build hyprlang with gcc run: | @@ -28,7 +28,7 @@ jobs: - name: Build tests with clang run: | rm -rf ./build - CC="/usr/bin/clang" CXX="/usr/bin/clang++" cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build + CC="/usr/bin/clang" CXX="/usr/bin/clang++" cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_CXX_FLAGS="-stdlib=libc++" -S . -B ./build CC="/usr/bin/clang" CXX="/usr/bin/clang++" cmake --build ./build --config Release --target tests -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` - name: Run tests @@ -131,11 +131,11 @@ jobs: run: | sed -i 's/SigLevel = Required DatabaseOptional/SigLevel = Optional TrustAll/' /etc/pacman.conf pacman --noconfirm --noprogressbar -Syyu - pacman --noconfirm --noprogressbar -Sy gcc base-devel cmake clang + pacman --noconfirm --noprogressbar -Sy gcc base-devel cmake clang libc++ - name: Build hyprlang with clang run: | - CC="/usr/bin/clang" CXX="/usr/bin/clang++" cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build + CC="/usr/bin/clang" CXX="/usr/bin/clang++" cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_CXX_FLAGS="-stdlib=libc++" -S . -B ./build CC="/usr/bin/clang" CXX="/usr/bin/clang++" cmake --build ./build --config Release --target hyprlang -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` cmake --install ./build diff --git a/CMakeLists.txt b/CMakeLists.txt index 37c330f..3837e78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,6 +44,9 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") # for std::expected. # probably evil. Arch's clang is very outdated tho... target_compile_options(hyprlang PUBLIC -std=gnu++2b -D__cpp_concepts=202002L -Wno-macro-redefined) + add_compile_options(-stdlib=libc++) + add_link_options(-stdlib=libc++ -lc++abi) + message(STATUS "Using clang++ to compile hyprlang") endif() install(TARGETS hyprlang)