2 # This testing configuration runs the test suite using the libstdc++ Standard library.
4 # The additional '--param libstdcxx-install-prefix=<PATH>', '--param libstdcxx-triple=<TRIPLE>' and
5 # '--param libstdcxx-version=<VERSION>' lit parameters must be provided when invoking lit for the
6 # configuration to find the appropriate headers and library.
10 # $ ./libcxx/utils/libcxx-lit <BUILD> -sv libcxx/test/std --param libstdcxx-install-prefix=/opt/homebrew/Cellar/gcc/14.1.0_1 \
11 # --param libstdcxx-version=14 \
12 # --param libstdcxx-triple=aarch64-apple-darwin22
15 lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
18 site.addsitedir(os.path.join('@LIBCXX_SOURCE_DIR@', 'utils'))
19 import libcxx.test.params, libcxx.test.config, libcxx.test.dsl
21 # Additional parameters for libstdc++
22 LIBSTDCXX_PARAMETERS = [
23 libcxx.test.dsl.Parameter(name='libstdcxx-install-prefix', type=str,
24 actions=lambda path: [libcxx.test.dsl.AddSubstitution('%{libstdcxx-install-prefix}', path)],
26 The installation prefix where libstdc++ was installed. This is used to find the libstdc++ headers,
27 link against its built library, etc.
29 libcxx.test.dsl.Parameter(name='libstdcxx-triple', type=str,
30 actions=lambda triple: [libcxx.test.dsl.AddSubstitution('%{libstdcxx-triple}', triple)],
32 The target triple used for the target-specific include directory of libstdc++. This is used to find the
35 libcxx.test.dsl.Parameter(name='libstdcxx-version', type=str,
36 actions=lambda version: [libcxx.test.dsl.AddSubstitution('%{libstdcxx-version}', version)],
38 The version of libstdc++. This is used to find the libstdc++ headers and library.
42 # Configure the compiler and flags
43 config.substitutions.append(('%{flags}',
44 '-pthread' + (' -isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else '')
46 config.substitutions.append(('%{compile_flags}',
47 '-nostdinc++ -isystem %{libstdcxx-install-prefix}/include/c++/%{libstdcxx-version} -isystem %{libstdcxx-install-prefix}/include/c++/%{libstdcxx-version}/%{libstdcxx-triple} -I %{libcxx-dir}/test/support'
49 config.substitutions.append(('%{link_flags}',
50 '-nostdlib++ -L %{libstdcxx-install-prefix}/lib/gcc/%{libstdcxx-version} -Wl,-rpath,%{libstdcxx-install-prefix}/lib/gcc/%{libstdcxx-version} -lstdc++'
52 config.substitutions.append(('%{exec}',
53 '%{executor} --execdir %T -- '
57 site.addsitedir(os.path.join('@LIBCXX_SOURCE_DIR@', 'utils'))
58 import libcxx.test.params, libcxx.test.config
59 libcxx.test.config.configure(
60 libcxx.test.params.DEFAULT_PARAMETERS + LIBSTDCXX_PARAMETERS,
61 libcxx.test.features.DEFAULT_FEATURES,