summaryrefslogtreecommitdiff
path: root/cmake/modules
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-09-21 00:24:52 +0000
committerZachary Turner <zturner@google.com>2017-09-21 00:24:52 +0000
commit1e4a12522612e29dc0d7e3597f6455da19e7fb8b (patch)
treedead30dd7246ea29d83b3de33332cc4555b5d4c5 /cmake/modules
parent8d6f84c7d5658030b4d12074b679fe55e9eb3639 (diff)
[lit] Make lit support config files with .py extension.
Many editors and Python-related diagnostics tools such as debuggers break or fail in mysterious ways when python files don't end in .py. This is especially true on Windows, but still exists on other platforms. I don't want to be too heavy handed in changing everything across the board, but I do want to at least *allow* lit configs to have .py extensions. This patch makes the discovery process first look for a config file with a .py extension, and if one is not found, then looks for a config file using the old method. So for existing users, there should be no functional change. Differential Revision: https://reviews.llvm.org/D37838 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313849 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake/modules')
-rw-r--r--cmake/modules/AddLLVM.cmake18
1 files changed, 12 insertions, 6 deletions
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
index 7c26e396caf..f328e049764 100644
--- a/cmake/modules/AddLLVM.cmake
+++ b/cmake/modules/AddLLVM.cmake
@@ -1112,7 +1112,13 @@ endfunction(llvm_canonicalize_cmake_booleans)
# variables needed for the 'lit.site.cfg' files. This function bundles the
# common variables that any Lit instance is likely to need, and custom
# variables can be passed in.
-function(configure_lit_site_cfg input output)
+function(configure_lit_site_cfg site_in site_out)
+ cmake_parse_arguments(ARG "" "" "MAIN_CONFIG" ${ARGN})
+
+ if ("${ARG_MAIN_CONFIG}" STREQUAL "")
+ set(ARG_MAIN_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg")
+ endif()
+
foreach(c ${LLVM_TARGETS_TO_BUILD})
set(TARGETS_BUILT "${TARGETS_BUILT} ${c}")
endforeach(c)
@@ -1158,7 +1164,7 @@ function(configure_lit_site_cfg input output)
set(HOST_CXX "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}")
set(HOST_LDFLAGS "${CMAKE_EXE_LINKER_FLAGS}")
- set(LIT_SITE_CFG_IN_HEADER "## Autogenerated from ${input}\n## Do not edit!")
+ set(LIT_SITE_CFG_IN_HEADER "## Autogenerated from ${site_in}\n## Do not edit!")
# Override config_target_triple (and the env)
if(LLVM_TARGET_TRIPLE_ENV)
@@ -1177,10 +1183,10 @@ function(configure_lit_site_cfg input output)
"import lit.llvm\n"
"lit.llvm.initialize(lit_config, config)\n")
- configure_file(${input} ${output} @ONLY)
- get_filename_component(INPUT_DIR ${input} DIRECTORY)
- if (EXISTS "${INPUT_DIR}/lit.cfg")
- set(PYTHON_STATEMENT "map_config('${INPUT_DIR}/lit.cfg', '${output}')")
+ configure_file(${site_in} ${site_out} @ONLY)
+ get_filename_component(INPUT_DIR ${site_in} DIRECTORY)
+ if (EXISTS "${ARG_MAIN_CONFIG}")
+ set(PYTHON_STATEMENT "map_config('${ARG_MAIN_CONFIG}', '${site_out}')")
get_property(LLVM_LIT_CONFIG_MAP GLOBAL PROPERTY LLVM_LIT_CONFIG_MAP)
set(LLVM_LIT_CONFIG_MAP "${LLVM_LIT_CONFIG_MAP}\n${PYTHON_STATEMENT}")
set_property(GLOBAL PROPERTY LLVM_LIT_CONFIG_MAP ${LLVM_LIT_CONFIG_MAP})