diff options
| author | Adam Nemet <anemet@apple.com> | 2017-11-27 19:00:29 +0000 | 
|---|---|---|
| committer | Adam Nemet <anemet@apple.com> | 2017-11-27 19:00:29 +0000 | 
| commit | cbdd238d5e70e88e6d7d552cdc35d17795a3a55d (patch) | |
| tree | e2a458a6801977e55d36edfbc291842b45bd0d86 /llvm/cmake/config-ix.cmake | |
| parent | ed7a9325193288b37a9822f7e2c801e6b8e7ce83 (diff) | |
| download | bcm5719-llvm-cbdd238d5e70e88e6d7d552cdc35d17795a3a55d.tar.gz bcm5719-llvm-cbdd238d5e70e88e6d7d552cdc35d17795a3a55d.zip  | |
Add opt-viewer testing
Detects whether we have the Python modules (pygments, yaml) required by
opt-viewer and hooks this up to REQUIRES.
This fixes https://bugs.llvm.org/show_bug.cgi?id=34129 (the lack of opt-viewer
testing).
It's also related to https://github.com/apple/swift/pull/12938 and the idea is
to expose LLVM_HAVE_OPT_VIEWER_MODULES to the Swift cmake.
Differential Revision: https://reviews.llvm.org/D40202
llvm-svn: 319073
Diffstat (limited to 'llvm/cmake/config-ix.cmake')
| -rw-r--r-- | llvm/cmake/config-ix.cmake | 31 | 
1 files changed, 31 insertions, 0 deletions
diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index 23494fb96c6..caa538082fc 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -628,3 +628,34 @@ else()  endif()  string(REPLACE " " ";" LLVM_BINDINGS_LIST "${LLVM_BINDINGS}") + +function(find_python_module module) +  string(TOUPPER ${module} module_upper) +  set(FOUND_VAR PY_${module_upper}_FOUND) + +  execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" "import ${module}" +    RESULT_VARIABLE status +    ERROR_QUIET) + +  if(status) +    set(${FOUND_VAR} 0 PARENT_SCOPE) +    message(STATUS "Could NOT find Python module ${module}") +  else() +    set(${FOUND_VAR} 1 PARENT_SCOPE) +    message(STATUS "Found Python module ${module}") +  endif() +endfunction() + +set (PYTHON_MODULES +  pygments +  yaml +  ) +foreach(module ${PYTHON_MODULES}) +  find_python_module(${module}) +endforeach() + +if(PY_PYGMENTS_FOUND AND PY_YAML_FOUND) +  set (LLVM_HAVE_OPT_VIEWER_MODULES 1) +else() +  set (LLVM_HAVE_OPT_VIEWER_MODULES 0) +endif()  | 

