Index: compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake =================================================================== --- compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake +++ compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake @@ -508,3 +508,14 @@ 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() Index: compiler-rt/trunk/test/CMakeLists.txt =================================================================== --- compiler-rt/trunk/test/CMakeLists.txt +++ compiler-rt/trunk/test/CMakeLists.txt @@ -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) Index: compiler-rt/trunk/test/lit.common.cfg =================================================================== --- compiler-rt/trunk/test/lit.common.cfg +++ compiler-rt/trunk/test/lit.common.cfg @@ -27,11 +27,6 @@ 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': Index: compiler-rt/trunk/test/lit.common.configured.in =================================================================== --- compiler-rt/trunk/test/lit.common.configured.in +++ compiler-rt/trunk/test/lit.common.configured.in @@ -16,14 +16,14 @@ 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 @@ # 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") Index: compiler-rt/trunk/unittests/CMakeLists.txt =================================================================== --- compiler-rt/trunk/unittests/CMakeLists.txt +++ compiler-rt/trunk/unittests/CMakeLists.txt @@ -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) Index: compiler-rt/trunk/unittests/lit.common.unit.configured.in =================================================================== --- compiler-rt/trunk/unittests/lit.common.unit.configured.in +++ compiler-rt/trunk/unittests/lit.common.unit.configured.in @@ -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 @@ # 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