2009-09-22 07:38:44 +00:00
|
|
|
foreach(c ${LLVM_TARGETS_TO_BUILD})
|
|
|
|
set(TARGETS_BUILT "${TARGETS_BUILT} ${c}")
|
|
|
|
endforeach(c)
|
|
|
|
set(TARGETS_TO_BUILD ${TARGETS_BUILT})
|
|
|
|
|
2009-11-08 09:29:52 +00:00
|
|
|
# FIXME: This won't work for project files, we need to use a --param.
|
|
|
|
set(LLVM_LIBS_DIR "${LLVM_BINARY_DIR}/lib/${CMAKE_CFG_INTDIR}")
|
|
|
|
set(SHLIBEXT "${LTDL_SHLIB_EXT}")
|
|
|
|
|
2010-03-10 18:41:59 +00:00
|
|
|
if(BUILD_SHARED_LIBS)
|
|
|
|
set(LLVM_SHARED_LIBS_ENABLED "1")
|
|
|
|
else()
|
|
|
|
set(LLVM_SHARED_LIBS_ENABLED "0")
|
|
|
|
endif(BUILD_SHARED_LIBS)
|
|
|
|
|
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
|
|
set(SHLIBPATH_VAR "DYLD_LIBRARY_PATH")
|
|
|
|
else() # Default for all other unix like systems.
|
|
|
|
# CMake hardcodes the library locaction using rpath.
|
|
|
|
# Therefore LD_LIBRARY_PATH is not required to run binaries in the
|
|
|
|
# build dir. We pass it anyways.
|
|
|
|
set(SHLIBPATH_VAR "LD_LIBRARY_PATH")
|
|
|
|
endif()
|
|
|
|
|
2009-09-22 07:38:44 +00:00
|
|
|
include(FindPythonInterp)
|
|
|
|
if(PYTHONINTERP_FOUND)
|
2010-08-30 14:49:00 +00:00
|
|
|
get_directory_property(DEFINITIONS COMPILE_DEFINITIONS)
|
|
|
|
foreach(DEF ${DEFINITIONS})
|
|
|
|
set(DEFS "${DEFS} -D${DEF}")
|
|
|
|
endforeach()
|
|
|
|
get_directory_property(INC_DIRS INCLUDE_DIRECTORIES)
|
|
|
|
foreach(INC_DIR ${INC_DIRS})
|
|
|
|
set(IDIRS "${IDIRS} -I${INC_DIR}")
|
|
|
|
endforeach()
|
|
|
|
string(REPLACE "<CMAKE_CXX_COMPILER>" "${CMAKE_CXX_COMPILER}" TEST_COMPILE_CXX_CMD ${CMAKE_CXX_COMPILE_OBJECT})
|
|
|
|
string(REPLACE "<DEFINES>" "${DEFS}" TEST_COMPILE_CXX_CMD ${TEST_COMPILE_CXX_CMD})
|
|
|
|
string(REPLACE "<FLAGS>" "${CMAKE_CXX_FLAGS}" TEST_COMPILE_CXX_CMD ${TEST_COMPILE_CXX_CMD})
|
|
|
|
string(REPLACE "-o" "" TEST_COMPILE_CXX_CMD ${TEST_COMPILE_CXX_CMD})
|
|
|
|
string(REGEX REPLACE "<[^>]+>" "" TEST_COMPILE_CXX_CMD ${TEST_COMPILE_CXX_CMD})
|
|
|
|
set(TEST_COMPILE_CXX_CMD "${TEST_COMPILE_CXX_CMD} ${IDIRS}")
|
|
|
|
if(NOT MSVC)
|
|
|
|
set(TEST_COMPILE_CXX_CMD "${TEST_COMPILE_CXX_CMD} -x c++")
|
|
|
|
endif()
|
2009-09-22 07:38:44 +00:00
|
|
|
configure_file(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/site.exp.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/site.exp)
|
|
|
|
|
2009-11-08 09:08:00 +00:00
|
|
|
MAKE_DIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/Unit)
|
|
|
|
|
|
|
|
add_custom_target(check
|
2009-09-22 07:38:44 +00:00
|
|
|
COMMAND sed -e "s#\@LLVM_SOURCE_DIR\@#${LLVM_MAIN_SRC_DIR}#"
|
|
|
|
-e "s#\@LLVM_BINARY_DIR\@#${LLVM_BINARY_DIR}#"
|
2009-11-08 09:08:00 +00:00
|
|
|
-e "s#\@LLVM_TOOLS_DIR\@#${LLVM_TOOLS_BINARY_DIR}/${CMAKE_CFG_INTDIR}#"
|
|
|
|
-e "s#\@LLVMGCCDIR\@##"
|
2010-06-12 16:21:19 +00:00
|
|
|
-e "s#\@PYTHON_EXECUTABLE\@#${PYTHON_EXECUTABLE}#"
|
2009-09-22 07:38:44 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in >
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
2009-11-08 09:07:51 +00:00
|
|
|
COMMAND sed -e "s#\@LLVM_SOURCE_DIR\@#${LLVM_MAIN_SRC_DIR}#"
|
|
|
|
-e "s#\@LLVM_BINARY_DIR\@#${LLVM_BINARY_DIR}#"
|
2009-11-08 09:08:00 +00:00
|
|
|
-e "s#\@LLVM_TOOLS_DIR\@#${LLVM_TOOLS_BINARY_DIR}/${CMAKE_CFG_INTDIR}#"
|
|
|
|
-e "s#\@LLVMGCCDIR\@##"
|
2009-11-08 09:07:51 +00:00
|
|
|
-e "s#\@LLVM_BUILD_MODE\@#${CMAKE_CFG_INTDIR}#"
|
2010-03-10 18:41:59 +00:00
|
|
|
-e "s#\@ENABLE_SHARED\@#${LLVM_SHARED_LIBS_ENABLED}#"
|
|
|
|
-e "s#\@SHLIBPATH_VAR\@#${SHLIBPATH_VAR}#"
|
2009-11-08 09:07:51 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in >
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
|
2009-11-08 09:08:00 +00:00
|
|
|
COMMAND ${PYTHON_EXECUTABLE}
|
2009-09-22 07:38:44 +00:00
|
|
|
${LLVM_SOURCE_DIR}/utils/lit/lit.py
|
2009-12-08 19:47:36 +00:00
|
|
|
--param llvm_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
|
|
|
--param llvm_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
|
2009-09-22 07:38:44 +00:00
|
|
|
-sv
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
DEPENDS
|
|
|
|
COMMENT "Running LLVM regression tests")
|
|
|
|
|
2009-11-08 09:08:00 +00:00
|
|
|
endif()
|