1# Testing configuration for Apple's system libc++. 2# 3# This configuration differs from a normal LLVM shared library configuration in 4# that we must use DYLD_LIBRARY_PATH to run the tests against the just-built library, 5# since Apple's libc++ has an absolute install_name. 6# 7# We also don't use a per-target include directory layout, so we have only one 8# include directory for the libc++ headers. 9# 10# Finally, we also link against an artificial shims library that provides 11# the functionality necessary for the upstream libc++ to be usable in place 12# of a system-provided libc++. Without that, attempting to replace the system 13# libc++ with DYLD_LIBRARY_PATH would result in missing symbols and other similar 14# issues since the upstream libc++ does not contain all the symbols provided by 15# the system library. 16 17lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg') 18 19import os, site 20site.addsitedir(os.path.join('@LIBCXX_SOURCE_DIR@', 'utils')) 21import libcxx.test.params, libcxx.test.config, libcxx.test.dsl 22ADDITIONAL_PARAMETERS = [ 23 libcxx.test.dsl.Parameter(name='apple_system_shims', type=str, 24 actions=lambda path: [libcxx.test.dsl.AddSubstitution('%{apple-system-shims}', path)], 25 help=""" 26 Path to a pre-built object file or static archive that contains shims necessary to 27 allow replacing the system libc++ by the just-built one. 28 """), 29] 30 31config.substitutions.append(('%{flags}', 32 '-isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else '' 33)) 34config.substitutions.append(('%{compile_flags}', 35 '-nostdinc++ -I %{include-dir} -I %{libcxx-dir}/test/support' 36)) 37config.substitutions.append(('%{link_flags}', 38 '-nostdlib++ -L %{lib-dir} -lc++ %{apple-system-shims}' 39)) 40config.substitutions.append(('%{exec}', 41 '%{executor} --execdir %T --env DYLD_LIBRARY_PATH=%{lib-dir} -- ' 42)) 43 44config.stdlib = 'apple-libc++' 45 46libcxx.test.config.configure( 47 libcxx.test.params.DEFAULT_PARAMETERS + ADDITIONAL_PARAMETERS, 48 libcxx.test.features.DEFAULT_FEATURES, 49 config, 50 lit_config 51) 52