From 1a1d56da754f6480effa851529af27f5023ac735 Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Mon, 22 Apr 2024 06:47:09 -0700 Subject: [PATCH 1/4] Backport implementation when libc++<17 is used Signed-off-by: Julien Jerphanion --- include/sparrow/algorithm.hpp | 8 ++++---- include/sparrow/config.hpp | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/include/sparrow/algorithm.hpp b/include/sparrow/algorithm.hpp index 63c1df12..eb941301 100644 --- a/include/sparrow/algorithm.hpp +++ b/include/sparrow/algorithm.hpp @@ -21,7 +21,7 @@ namespace sparrow { -#if COMPILING_WITH_APPLE_CLANG +#if COMPILING_WITH_APPLE_CLANG || USING_LIBCPP_PRE_17 template concept OrdCategory = std::same_as || std::same_as @@ -71,7 +71,7 @@ namespace sparrow constexpr auto lexicographical_compare_three_way(const R1& range1, const R2& range2, Cmp comp) -> decltype(comp(*range1.cbegin(), *range2.cbegin())) { -#if COMPILING_WITH_APPLE_CLANG +#if COMPILING_WITH_APPLE_CLANG || USING_LIBCPP_PRE_17 return lexicographical_compare_three_way_non_std(range1, range2, comp); #else return std::lexicographical_compare_three_way( @@ -84,7 +84,7 @@ namespace sparrow #endif } -#if COMPILING_WITH_APPLE_CLANG +#if COMPILING_WITH_APPLE_CLANG || USING_LIBCPP_PRE_17 struct compare_three_way { template @@ -109,7 +109,7 @@ namespace sparrow return lexicographical_compare_three_way( r1, r2, -#if COMPILING_WITH_APPLE_CLANG +#if COMPILING_WITH_APPLE_CLANG || USING_LIBCPP_PRE_17 compare_three_way {} #else std::compare_three_way{} diff --git a/include/sparrow/config.hpp b/include/sparrow/config.hpp index d473737e..3cc91b66 100644 --- a/include/sparrow/config.hpp +++ b/include/sparrow/config.hpp @@ -20,6 +20,12 @@ #define COMPILING_WITH_APPLE_CLANG 0 #endif +#if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION < 170000 +#define USING_LIBCPP_PRE_17 1 +#else +#define USING_LIBCPP_PRE_17 0 +#endif + consteval bool is_apple_compiler() { return static_cast(COMPILING_WITH_APPLE_CLANG); From 01d2c32fe8674ddf35b8ea6ce9adb6019615ff21 Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Mon, 22 Apr 2024 16:12:33 +0200 Subject: [PATCH 2/4] Use clang++ instead of Apple Clang Signed-off-by: Julien Jerphanion --- .github/workflows/osx.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/osx.yml b/.github/workflows/osx.yml index a12733ef..ccf01b5c 100644 --- a/.github/workflows/osx.yml +++ b/.github/workflows/osx.yml @@ -28,6 +28,10 @@ jobs: - name: Checkout code uses: actions/checkout@v3 + - name: Add specification clang++ in the conda environment specification + run: | + echo " - clangxx==17.0.6" >> environment-dev.yml + - name: Set conda environment uses: mamba-org/setup-micromamba@main with: @@ -36,6 +40,11 @@ jobs: init-shell: bash cache-downloads: true + - name: Set environment variable to use clang++ + run: | + echo "CXX=$CONDA_PREFIX/bin/clang++" >> $GITHUB_ENV + echo "CMAKE_CXX_COMPILER=$CONDA_PREFIX/bin/clang++" >> $GITHUB_ENV + - name: Configure using CMake run: cmake -Bbuild -DCMAKE_BUILD_TYPE:STRING=${{matrix.config.name}} -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DBUILD_TESTS=ON From 5777bb4b25e23600142ddfba3233ed057c0a38b3 Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Tue, 23 Apr 2024 09:06:43 +0200 Subject: [PATCH 3/4] Add compilers to the matrix Signed-off-by: Julien Jerphanion Co-authored-by: Johan Mabille --- .github/workflows/osx.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/osx.yml b/.github/workflows/osx.yml index ccf01b5c..f3875050 100644 --- a/.github/workflows/osx.yml +++ b/.github/workflows/osx.yml @@ -22,13 +22,17 @@ jobs: config: - { name: Debug } - { name: Release } + compiler: + - clang + - apple-clang steps: - name: Checkout code uses: actions/checkout@v3 - - name: Add specification clang++ in the conda environment specification + - name: Add specification of clang++ in the conda environment specification + if: matrix.compiler == 'clang' run: | echo " - clangxx==17.0.6" >> environment-dev.yml @@ -40,11 +44,18 @@ jobs: init-shell: bash cache-downloads: true - - name: Set environment variable to use clang++ + - name: Use clang++ from conda-forge + if: matrix.compiler == 'clang' run: | echo "CXX=$CONDA_PREFIX/bin/clang++" >> $GITHUB_ENV echo "CMAKE_CXX_COMPILER=$CONDA_PREFIX/bin/clang++" >> $GITHUB_ENV + - name: Use Apple Clang (i.e. clang++ from Xcode) + if: matrix.compiler == 'apple-clang' + run: | + echo "CXX=/usr/bin/clang++" >> $GITHUB_ENV + echo "CMAKE_CXX_COMPILER=/usr/bin/clang++" >> $GITHUB_ENV + - name: Configure using CMake run: cmake -Bbuild -DCMAKE_BUILD_TYPE:STRING=${{matrix.config.name}} -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DBUILD_TESTS=ON From 91a555e1a4b261e738db40f8e2288b95ffd3bea1 Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Tue, 23 Apr 2024 09:09:40 +0200 Subject: [PATCH 4/4] Modify workflows' names Signed-off-by: Julien Jerphanion --- .github/workflows/osx.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/osx.yml b/.github/workflows/osx.yml index f3875050..aa2f199d 100644 --- a/.github/workflows/osx.yml +++ b/.github/workflows/osx.yml @@ -13,7 +13,7 @@ defaults: jobs: build: runs-on: macos-${{ matrix.os }} - name: ${{ matrix.os }}-${{ matrix.config.name }} + name: ${{ matrix.os }}-${{ matrix.config.name }}-${{ matrix.compiler }} strategy: fail-fast: false matrix: