mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-18 12:06:38 +00:00
Allow compiler-rt test targets to work with multi-config CMake generators
Multi-config CMake generators need lit to be able to resolve paths of artifacts from previous build steps at lit time, rather than expect them to be fully resolved at CMake time as they may contain the build mode. Differential Revision: https://reviews.llvm.org/D38471 llvm-svn: 318037
This commit is contained in:
parent
2aa707bdaa
commit
d6b0ecb795
@ -508,3 +508,14 @@ function(rt_externalize_debuginfo name)
|
||||
message(FATAL_ERROR "COMPILER_RT_EXTERNALIZE_DEBUGINFO isn't implemented for non-darwin platforms!")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
# Configure lit configuration files, including compiler-rt specific variables.
|
||||
function(configure_compiler_rt_lit_site_cfg input output)
|
||||
set_llvm_build_mode()
|
||||
|
||||
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} COMPILER_RT_RESOLVED_TEST_COMPILER ${COMPILER_RT_TEST_COMPILER})
|
||||
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} COMPILER_RT_RESOLVED_LIBRARY_OUTPUT_DIR ${COMPILER_RT_LIBRARY_OUTPUT_DIR})
|
||||
|
||||
configure_lit_site_cfg(${input} ${output})
|
||||
endfunction()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Needed for lit support
|
||||
# Needed for lit support in standalone builds.
|
||||
include(AddLLVM)
|
||||
|
||||
configure_lit_site_cfg(
|
||||
configure_compiler_rt_lit_site_cfg(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lit.common.configured.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/lit.common.configured)
|
||||
|
||||
|
@ -27,11 +27,6 @@ config.test_format = lit.formats.ShTest(execute_external)
|
||||
if execute_external:
|
||||
config.available_features.add('shell')
|
||||
|
||||
# Setup clang binary.
|
||||
compiler_path = getattr(config, 'clang', None)
|
||||
if (not compiler_path) or (not os.path.exists(compiler_path)):
|
||||
lit_config.fatal("Can't find compiler on path %r" % compiler_path)
|
||||
|
||||
compiler_id = getattr(config, 'compiler_id', None)
|
||||
if compiler_id == "Clang":
|
||||
if platform.system() != 'Windows':
|
||||
|
@ -16,14 +16,14 @@ 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("llvm_tools_dir", "@LLVM_TOOLS_BINARY_DIR@")
|
||||
set_default("llvm_tools_dir", "@LLVM_TOOLS_DIR@")
|
||||
set_default("llvm_shlib_dir", "@LLVM_LIBRARY_OUTPUT_INTDIR@")
|
||||
set_default("gold_executable", "@GOLD_EXECUTABLE@")
|
||||
set_default("clang", "@COMPILER_RT_TEST_COMPILER@")
|
||||
set_default("clang", "@COMPILER_RT_RESOLVED_TEST_COMPILER@")
|
||||
set_default("compiler_id", "@COMPILER_RT_TEST_COMPILER_ID@")
|
||||
set_default("python_executable", "@PYTHON_EXECUTABLE@")
|
||||
set_default("compiler_rt_debug", @COMPILER_RT_DEBUG_PYBOOL@)
|
||||
set_default("compiler_rt_libdir", "@COMPILER_RT_LIBRARY_OUTPUT_DIR@")
|
||||
set_default("compiler_rt_libdir", "@COMPILER_RT_RESOLVED_LIBRARY_OUTPUT_DIR@")
|
||||
set_default("emulator", "@COMPILER_RT_EMULATOR@")
|
||||
set_default("ios", False)
|
||||
set_default("iossim", False)
|
||||
@ -39,9 +39,14 @@ config.available_features.add('target-is-%s' % config.target_arch)
|
||||
# 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")
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Needed for lit support
|
||||
# Needed for lit support in standalone builds.
|
||||
include(AddLLVM)
|
||||
|
||||
configure_lit_site_cfg(
|
||||
configure_compiler_rt_lit_site_cfg(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lit.common.unit.configured.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/lit.common.unit.configured)
|
||||
|
@ -4,9 +4,9 @@
|
||||
config.target_triple = "@TARGET_TRIPLE@"
|
||||
config.llvm_src_root = "@LLVM_MAIN_SRC_DIR@"
|
||||
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
|
||||
config.llvm_tools_dir = "@LLVM_TOOLS_BINARY_DIR@"
|
||||
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
|
||||
config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"
|
||||
config.compiler_rt_libdir = "@COMPILER_RT_LIBRARY_OUTPUT_DIR@"
|
||||
config.compiler_rt_libdir = "@COMPILER_RT_RESOLVED_LIBRARY_OUTPUT_DIR@"
|
||||
config.llvm_build_mode = "@LLVM_BUILD_MODE@"
|
||||
config.host_arch = "@HOST_ARCH@"
|
||||
config.host_os = "@HOST_OS@"
|
||||
@ -15,6 +15,7 @@ config.host_os = "@HOST_OS@"
|
||||
# so try to apply substitution.
|
||||
try:
|
||||
config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
|
||||
config.compiler_rt_libdir = config.compiler_rt_libdir % lit_config.params
|
||||
config.llvm_build_mode = config.llvm_build_mode % lit_config.params
|
||||
except KeyError as e:
|
||||
key, = e.args
|
||||
|
Loading…
x
Reference in New Issue
Block a user