lit.common.configured.in 3.49 KB
@LIT_SITE_CFG_IN_HEADER@

# Set attribute value if it is unset.
def set_default(attr, value):
  if not getattr(config, attr, None):
    setattr(config, attr, value)

# Generic config options for all compiler-rt lit tests.
set_default("target_triple", "@COMPILER_RT_DEFAULT_TARGET_TRIPLE@")
set_default("target_cflags", "@COMPILER_RT_TEST_COMPILER_CFLAGS@")
set_default("host_arch", "@HOST_ARCH@")
set_default("target_arch", "@COMPILER_RT_DEFAULT_TARGET_ARCH@")
set_default("host_os", "@HOST_OS@")
set_default("llvm_build_mode", "@LLVM_BUILD_MODE@")
set_default("llvm_src_root", "@LLVM_MAIN_SRC_DIR@")
set_default("llvm_obj_root", "@LLVM_BINARY_DIR@")
set_default("compiler_rt_src_root", "@COMPILER_RT_SOURCE_DIR@")
set_default("compiler_rt_obj_root", "@COMPILER_RT_BINARY_DIR@")
set_default("enable_per_target_runtime_dir", @LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_PYBOOL@)
set_default("llvm_tools_dir", "@LLVM_TOOLS_DIR@")
set_default("llvm_shlib_dir", "@LLVM_LIBRARY_OUTPUT_INTDIR@")
set_default("gnu_ld_executable", "@GNU_LD_EXECUTABLE@")
set_default("gold_executable", "@GOLD_EXECUTABLE@")
set_default("clang", "@COMPILER_RT_RESOLVED_TEST_COMPILER@")
set_default("compiler_id", "@COMPILER_RT_TEST_COMPILER_ID@")
set_default("python_executable", "@Python3_EXECUTABLE@")
set_default("compiler_rt_debug", @COMPILER_RT_DEBUG_PYBOOL@)
set_default("compiler_rt_intercept_libdispatch", @COMPILER_RT_INTERCEPT_LIBDISPATCH_PYBOOL@)
set_default("compiler_rt_libdir", "@COMPILER_RT_RESOLVED_LIBRARY_OUTPUT_DIR@")
set_default("emulator", "@COMPILER_RT_EMULATOR@")
set_default("asan_shadow_scale", "@COMPILER_RT_ASAN_SHADOW_SCALE@")
set_default("apple_platform", "osx")
set_default("apple_platform_min_deployment_target_flag", "-mmacosx-version-min")
set_default("sanitizer_can_use_cxxabi", @SANITIZER_CAN_USE_CXXABI_PYBOOL@)
set_default("has_lld", @COMPILER_RT_HAS_LLD_PYBOOL@)
set_default("can_symbolize", @CAN_SYMBOLIZE@)
set_default("use_lld", False)
set_default("use_thinlto", False)
set_default("use_lto", config.use_thinlto)
set_default("use_newpm", False)
set_default("android", @ANDROID_PYBOOL@)
set_default("android_ndk_version", @ANDROID_NDK_VERSION@)
set_default("android_serial", "@ANDROID_SERIAL_FOR_TESTING@")
set_default("android_files_to_push", [])
set_default("have_rpc_xdr_h", @HAVE_RPC_XDR_H@)
set_default("gwp_asan", @COMPILER_RT_HAS_GWP_ASAN_PYBOOL@)
set_default("expensive_checks", @LLVM_ENABLE_EXPENSIVE_CHECKS_PYBOOL@)
config.available_features.add('target-is-%s' % config.target_arch)

if config.enable_per_target_runtime_dir:
  set_default("target_suffix", "")
elif config.android:
  if config.target_arch == "i386":
    set_default("target_suffix", "-i686-android")
  else:
    set_default("target_suffix", "-%s-android" % config.target_arch)
else:
  set_default("target_suffix", "-%s" % config.target_arch)

set_default("have_zlib", "@LLVM_ENABLE_ZLIB@")
set_default("libcxx_used", "@LLVM_LIBCXX_USED@")

# LLVM tools dir can be passed in lit parameters, so try to
# apply substitution.
try:
  config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
  config.clang = config.clang % lit_config.params
  config.compiler_rt_libdir = config.compiler_rt_libdir % lit_config.params
except KeyError as e:
  key, = e.args
  lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key, key))

if not os.path.exists(config.clang):
  lit_config.fatal("Can't find compiler on path %r" % config.clang)

# Setup attributes common for all compiler-rt projects.
lit_config.load_config(config, "@COMPILER_RT_SOURCE_DIR@/test/lit.common.cfg.py")