diff --git a/.github/actions/xahau-ga-build/action.yml b/.github/actions/xahau-ga-build/action.yml index 5a21eda60..4acef6223 100644 --- a/.github/actions/xahau-ga-build/action.yml +++ b/.github/actions/xahau-ga-build/action.yml @@ -36,10 +36,13 @@ inputs: description: 'Main branch name for restore keys' required: false default: 'dev' - clang_use_libstdcpp: - description: 'Force clang to use libstdc++ instead of libc++ (workaround for clang-16)' - required: false - default: 'false' + stdlib: + description: 'C++ standard library to use' + required: true + type: choice + options: + - libstdcxx + - libcxx runs: using: 'composite' @@ -85,12 +88,14 @@ runs: CCACHE_ARGS="-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache" fi - # Configure libstdc++ override for clang if requested - # This works around clang-16 missing lexicographical_compare_three_way in libc++ - # which is only available in LLVM 17+. Can be removed when upgrading to clang-17+ + # Configure C++ standard library if specified + # libstdcxx used for clang-14/16 to work around missing lexicographical_compare_three_way in libc++ + # libcxx can be used with clang-17+ which has full C++20 support STDLIB_ARGS="" - if [ "${{ inputs.clang_use_libstdcpp }}" = "true" ] && [[ "${{ inputs.cxx }}" == *"clang"* ]]; then + if [ "${{ inputs.stdlib }}" = "libstdcxx" ]; then STDLIB_ARGS="-DCMAKE_CXX_FLAGS=-stdlib=libstdc++" + elif [ "${{ inputs.stdlib }}" = "libcxx" ]; then + STDLIB_ARGS="-DCMAKE_CXX_FLAGS=-stdlib=libc++" fi # Run CMake configure diff --git a/.github/actions/xahau-ga-dependencies/action.yml b/.github/actions/xahau-ga-dependencies/action.yml index b6bd08582..43efcf917 100644 --- a/.github/actions/xahau-ga-dependencies/action.yml +++ b/.github/actions/xahau-ga-dependencies/action.yml @@ -25,10 +25,13 @@ inputs: description: 'Main branch name for restore keys' required: false default: 'dev' - stdlib_choice: - description: 'Standard library choice (affects cache key for different stdlib builds)' - required: false - default: 'default' + stdlib: + description: 'C++ standard library - affects cache key' + required: true + type: choice + options: + - libstdcxx + - libcxx outputs: cache-hit: @@ -54,10 +57,10 @@ runs: path: | ~/.conan ~/.conan2 - key: ${{ runner.os }}-conan-v${{ inputs.cache_version }}-${{ inputs.compiler-id }}-${{ inputs.stdlib_choice }}-${{ hashFiles('**/conanfile.txt', '**/conanfile.py') }}-${{ inputs.configuration }} + key: ${{ runner.os }}-conan-v${{ inputs.cache_version }}-${{ inputs.compiler-id }}-${{ inputs.stdlib }}-${{ hashFiles('**/conanfile.txt', '**/conanfile.py') }}-${{ inputs.configuration }} restore-keys: | - ${{ runner.os }}-conan-v${{ inputs.cache_version }}-${{ inputs.compiler-id }}-${{ inputs.stdlib_choice }}-${{ hashFiles('**/conanfile.txt', '**/conanfile.py') }}- - ${{ runner.os }}-conan-v${{ inputs.cache_version }}-${{ inputs.compiler-id }}-${{ inputs.stdlib_choice }}- + ${{ runner.os }}-conan-v${{ inputs.cache_version }}-${{ inputs.compiler-id }}-${{ inputs.stdlib }}-${{ hashFiles('**/conanfile.txt', '**/conanfile.py') }}- + ${{ runner.os }}-conan-v${{ inputs.cache_version }}-${{ inputs.compiler-id }}-${{ inputs.stdlib }}- - name: Export custom recipes shell: bash diff --git a/.github/workflows/xahau-ga-nix.yml b/.github/workflows/xahau-ga-nix.yml index a1834084a..017200593 100644 --- a/.github/workflows/xahau-ga-nix.yml +++ b/.github/workflows/xahau-ga-nix.yml @@ -27,19 +27,19 @@ jobs: # cxx: g++-13 # compiler_id: gcc-13 # compiler_version: 13 - # force_libstdcpp: false + # stdlib: libstdcxx - compiler: clang cc: clang-14 cxx: clang++-14 compiler_id: clang-14 compiler_version: 14 - force_libstdcpp: true # Required for clang-14 compatibility + stdlib: libstdcxx # Required for clang-14 compatibility - compiler: clang cc: clang-16 cxx: clang++-16 compiler_id: clang-16 compiler_version: 16 - force_libstdcpp: true # Workaround for missing lexicographical_compare_three_way in libc++ + stdlib: libstdcxx # Workaround for missing lexicographical_compare_three_way in libc++ env: build_dir: .build # Bump this number to invalidate all caches globally. @@ -72,13 +72,11 @@ jobs: conan profile new default --detect || true # Ignore error if profile exists conan profile update settings.compiler.cppstd=20 default conan profile update settings.compiler=${{ matrix.compiler }} default - # Use libstdc++11 for clang when force_libstdcpp is enabled, otherwise use libc++ - if [ "${{ matrix.compiler }}" = "clang" ] && [ "${{ matrix.force_libstdcpp }}" = "true" ]; then + # Set the C++ standard library based on matrix configuration + if [ "${{ matrix.stdlib }}" = "libstdcxx" ]; then conan profile update settings.compiler.libcxx=libstdc++11 default - elif [ "${{ matrix.compiler }}" = "clang" ]; then + elif [ "${{ matrix.stdlib }}" = "libcxx" ]; then conan profile update settings.compiler.libcxx=libc++ default - else - conan profile update settings.compiler.libcxx=libstdc++11 default fi conan profile update env.CC=/usr/bin/${{ matrix.cc }} default conan profile update env.CXX=/usr/bin/${{ matrix.cxx }} default @@ -109,7 +107,7 @@ jobs: compiler-id: ${{ matrix.compiler_id }} cache_version: ${{ env.CACHE_VERSION }} main_branch: ${{ env.MAIN_BRANCH_NAME }} - stdlib_choice: ${{ matrix.force_libstdcpp }} + stdlib: ${{ matrix.stdlib }} - name: Build uses: ./.github/actions/xahau-ga-build @@ -122,7 +120,7 @@ jobs: compiler-id: ${{ matrix.compiler_id }} cache_version: ${{ env.CACHE_VERSION }} main_branch: ${{ env.MAIN_BRANCH_NAME }} - clang_use_libstdcpp: ${{ matrix.force_libstdcpp }} + stdlib: ${{ matrix.stdlib }} - name: Set artifact name id: set-artifact-name