build/cmake: Change to require Python be available.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143742 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2011-11-04 23:04:05 +00:00
parent 44e895761f
commit a54c8ea8cf
2 changed files with 58 additions and 53 deletions

View File

@ -205,6 +205,15 @@ option(LLVM_INCLUDE_TESTS "Generate build targets for the LLVM unit tests." ON)
include(config-ix)
include(HandleLLVMOptions)
# Verify that we can find a Python interpreter,
include(FindPythonInterp)
if( NOT PYTHONINTERP_FOUND )
message(FATAL_ERROR
"Unable to find Python interpreter, required for builds and testing.
Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
endif()
# Configure all of the various header file fragments LLVM uses which depend on
# configuration variables.
set(LLVM_ENUM_ASM_PRINTERS "")

View File

@ -24,62 +24,58 @@ else() # Default for all other unix like systems.
set(SHLIBPATH_VAR "LD_LIBRARY_PATH")
endif()
include(FindPythonInterp)
if(PYTHONINTERP_FOUND)
set(LIT_ARGS "${LLVM_LIT_ARGS}")
separate_arguments(LIT_ARGS)
set(LIT_ARGS "${LLVM_LIT_ARGS}")
separate_arguments(LIT_ARGS)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/site.exp.in
${CMAKE_CURRENT_BINARY_DIR}/site.exp)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/site.exp.in
${CMAKE_CURRENT_BINARY_DIR}/site.exp)
MAKE_DIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/Unit)
MAKE_DIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/Unit)
# Configuration-time: See Unit/lit.site.cfg.in
set(LLVM_BUILD_MODE "%(build_mode)s")
# Configuration-time: See Unit/lit.site.cfg.in
set(LLVM_BUILD_MODE "%(build_mode)s")
set(LLVM_SOURCE_DIR ${LLVM_MAIN_SRC_DIR})
set(LLVM_BINARY_DIR ${LLVM_BINARY_DIR})
set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}/%(build_config)s")
set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})
set(ENABLE_SHARED ${LLVM_SHARED_LIBS_ENABLED})
set(SHLIBPATH_VAR ${SHLIBPATH_VAR})
if(LLVM_ENABLE_ASSERTIONS AND NOT MSVC_IDE)
set(ENABLE_ASSERTIONS "1")
else()
set(ENABLE_ASSERTIONS "0")
endif()
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
@ONLY)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
@ONLY)
add_custom_target(check
COMMAND ${PYTHON_EXECUTABLE}
${LLVM_SOURCE_DIR}/utils/lit/lit.py
--param llvm_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
--param llvm_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
--param build_config=${CMAKE_CFG_INTDIR}
--param build_mode=${RUNTIME_BUILD_MODE}
${LIT_ARGS}
${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Running LLVM regression tests")
set_target_properties(check PROPERTIES FOLDER "Tests")
add_custom_target(check.deps)
add_dependencies(check check.deps)
add_dependencies(check.deps
UnitTests
BugpointPasses LLVMHello
llc lli llvm-ar llvm-as llvm-dis llvm-extract llvm-dwarfdump
llvm-ld llvm-link llvm-mc llvm-nm llvm-objdump macho-dump opt
FileCheck count not)
set_target_properties(check.deps PROPERTIES FOLDER "Tests")
set(LLVM_SOURCE_DIR ${LLVM_MAIN_SRC_DIR})
set(LLVM_BINARY_DIR ${LLVM_BINARY_DIR})
set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}/%(build_config)s")
set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})
set(ENABLE_SHARED ${LLVM_SHARED_LIBS_ENABLED})
set(SHLIBPATH_VAR ${SHLIBPATH_VAR})
if(LLVM_ENABLE_ASSERTIONS AND NOT MSVC_IDE)
set(ENABLE_ASSERTIONS "1")
else()
set(ENABLE_ASSERTIONS "0")
endif()
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
@ONLY)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
@ONLY)
add_custom_target(check
COMMAND ${PYTHON_EXECUTABLE}
${LLVM_SOURCE_DIR}/utils/lit/lit.py
--param llvm_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
--param llvm_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
--param build_config=${CMAKE_CFG_INTDIR}
--param build_mode=${RUNTIME_BUILD_MODE}
${LIT_ARGS}
${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Running LLVM regression tests")
set_target_properties(check PROPERTIES FOLDER "Tests")
add_custom_target(check.deps)
add_dependencies(check check.deps)
add_dependencies(check.deps
UnitTests
BugpointPasses LLVMHello
llc lli llvm-ar llvm-as llvm-dis llvm-extract llvm-dwarfdump
llvm-ld llvm-link llvm-mc llvm-nm llvm-objdump macho-dump opt
FileCheck count not)
set_target_properties(check.deps PROPERTIES FOLDER "Tests")