Skip to content

Commit 403f63a

Browse files
committed
ci: test libc++ instead of libstdc++ in one job
1 parent d19ee2c commit 403f63a

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

ci/configs/llvm.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1-
CI_DESC="CI job using LLVM-based tools (clang, clang-tidy, iwyu) and testing Ninja"
1+
CI_DESC="CI job using LLVM-based libraries and tools (clang, libc++, clang-tidy, iwyu) and testing Ninja"
22
CI_DIR=build-llvm
3+
NIX_ARGS=(
4+
--arg libcxx true
5+
)
6+
7+
# Note: CMAKE_CXX_STANDARD_LIBRARY is still an undocumented, experimental switch
8+
# (present in CMake ≥3.29) that toggles libc++/libstdc++; we use it for now, but
9+
# expect breakage if CMake renames or removes it in a future release.
310
CMAKE_ARGS=(
411
-G Ninja
512
-DCMAKE_CXX_COMPILER=clang++
13+
-DCMAKE_CXX_STANDARD_LIBRARY=libc++
614
-DCMAKE_CXX_FLAGS="-Werror -Wall -Wextra -Wpedantic -Wthread-safety-analysis -Wno-unused-parameter"
715
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
816
-DMP_ENABLE_CLANG_TIDY=ON

ci/scripts/run.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/env bash
22
set -o errexit -o nounset -o pipefail -o xtrace
33

4-
nix-shell --pure --keep CI_CONFIG --run ci/scripts/ci.sh shell.nix
4+
[ "${CI_CONFIG+x}" ] && source "$CI_CONFIG"
5+
6+
nix-shell --pure --keep CI_CONFIG "${NIX_ARGS[@]+"${NIX_ARGS[@]}"}" --run ci/scripts/ci.sh shell.nix

shell.nix

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
1-
{ pkgs ? import <nixpkgs> {} }:
1+
{ pkgs ? import <nixpkgs> {}
2+
, libcxx ? false # Whether to use libc++ toolchain and libraries instead of libstdc++
3+
}:
24

3-
pkgs.mkShell {
4-
buildInputs = with pkgs; [
5+
let
6+
lib = pkgs.lib;
7+
llvm = pkgs.llvmPackages_20;
8+
mkShell = pkgs.mkShell.override (lib.optionalAttrs libcxx { stdenv = llvm.libcxxStdenv; });
9+
capnproto = pkgs.capnproto.override (lib.optionalAttrs libcxx { clangStdenv = llvm.libcxxStdenv; });
10+
in mkShell {
11+
buildInputs = [
512
capnproto
13+
llvm.libcxx
614
];
715
nativeBuildInputs = with pkgs; [
816
cmake
917
include-what-you-use
10-
llvmPackages_20.clang
11-
llvmPackages_20.clang-tools
18+
llvm.clang
19+
llvm.clang-tools
1220
ninja
1321
];
1422
}

0 commit comments

Comments
 (0)