2011-04-29 14:27:02 +08:00
|
|
|
set(POLLY_TEST_DIRECTORIES
|
|
|
|
"AffineIterator"
|
2011-08-25 16:40:59 +08:00
|
|
|
"ScopInfo"
|
|
|
|
"ScheduleOptimizer"
|
2011-04-29 14:27:02 +08:00
|
|
|
"CodeGen"
|
|
|
|
"OpenMP"
|
2011-08-02 15:22:05 +08:00
|
|
|
"polybench"
|
|
|
|
"vect")
|
2011-04-29 14:27:02 +08:00
|
|
|
|
2011-04-29 15:34:54 +08:00
|
|
|
|
2011-04-29 14:27:02 +08:00
|
|
|
set(POLLY_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/..")
|
|
|
|
set(POLLY_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..")
|
2012-10-22 05:08:29 +08:00
|
|
|
set(LLVM_SHLIBEXT "${CMAKE_SHARED_MODULE_SUFFIX}")
|
2011-04-29 14:27:02 +08:00
|
|
|
|
2016-09-05 18:54:16 +08:00
|
|
|
add_custom_target(check-polly)
|
|
|
|
set_target_properties(check-polly PROPERTIES FOLDER "Polly")
|
|
|
|
|
2011-04-29 15:34:54 +08:00
|
|
|
if (NOT DEFINED LLVM_MAIN_SRC_DIR)
|
2012-12-06 15:59:18 +08:00
|
|
|
|
2011-04-29 15:34:54 +08:00
|
|
|
# We are building polly out of tree, adjust the settings.
|
|
|
|
# FIXME: FileCheck is not available in llvm install directory at the moment.
|
|
|
|
set(LLVM_LIT ${LLVM_INSTALL_ROOT}/bin/llvm-lit)
|
|
|
|
set(POLLY_TEST_DEPS LLVMPolly)
|
2016-08-25 20:36:15 +08:00
|
|
|
if (POLLY_GTEST_AVAIL)
|
|
|
|
list(APPEND POLLY_TEST_DEPS PollyUnitTests)
|
|
|
|
endif ()
|
2011-04-29 15:34:54 +08:00
|
|
|
|
|
|
|
set(LLVM_BINARY_DIR "${LLVM_INSTALL_ROOT}")
|
|
|
|
set(LLVM_TOOLS_DIR "${LLVM_INSTALL_ROOT}/bin")
|
|
|
|
set(LLVM_LIBS_DIR "${LLVM_INSTALL_ROOT}/lib")
|
2012-03-16 22:34:20 +08:00
|
|
|
set(POLLY_LIB_DIR "${POLLY_BINARY_DIR}/lib")
|
2012-12-06 15:59:18 +08:00
|
|
|
|
|
|
|
include(FindPythonInterp)
|
|
|
|
if(PYTHONINTERP_FOUND)
|
|
|
|
option(POLLY_TEST_DISABLE_BAR "Run Polly tests with --no-progress-bar" OFF)
|
|
|
|
set(POLLY_TEST_EXTRA_ARGS)
|
|
|
|
if (MSVC OR XCODE OR POLLY_TEST_DISABLE_BAR)
|
|
|
|
set(POLLY_TEST_EXTRA_ARGS "--no-progress-bar")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
option(POLLY_TEST_USE_VG "Run Polly tests under Valgrind" OFF)
|
|
|
|
if(POLLY_TEST_USE_VG)
|
|
|
|
set(POLLY_TEST_EXTRA_ARGS ${POLLY_TEST_EXTRA_ARGS} "--vg")
|
|
|
|
endif ()
|
|
|
|
|
2016-08-25 20:03:33 +08:00
|
|
|
# Parameters required for lit.site.cfg.in
|
|
|
|
set(LLVM_SOURCE_DIR ${LLVM_SOURCE_ROOT})
|
|
|
|
if (CMAKE_CFG_INTDIR STREQUAL ".")
|
|
|
|
set(LLVM_BUILD_MODE ".")
|
|
|
|
else ()
|
|
|
|
set(LLVM_BUILD_MODE "%(build_mode)s")
|
|
|
|
endif ()
|
|
|
|
set(ENABLE_SHARED "1")
|
|
|
|
set(SHLIBDIR "${LLVM_BINARY_DIR}/bin")
|
|
|
|
set(LINK_POLLY_INTO_TOOLS "OFF")
|
|
|
|
|
|
|
|
configure_file(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
|
|
|
|
|
2012-12-06 15:59:18 +08:00
|
|
|
foreach(testdir ${POLLY_TEST_DIRECTORIES})
|
|
|
|
add_custom_target(polly-test-${testdir}
|
|
|
|
COMMAND ${LLVM_LIT}
|
|
|
|
--param polly_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
|
|
|
--param build_config=${CMAKE_CFG_INTDIR}
|
|
|
|
-sv ${POLLY_TEST_EXTRA_ARGS}
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/${testdir}
|
|
|
|
DEPENDS ${POLLY_TEST_DEPS}
|
|
|
|
COMMENT "Running Polly regression tests in ${testdir}")
|
2015-07-21 20:40:01 +08:00
|
|
|
set_target_properties(polly-test-${testdir} PROPERTIES FOLDER "Polly")
|
2012-12-06 15:59:18 +08:00
|
|
|
endforeach()
|
|
|
|
|
2016-09-05 18:54:16 +08:00
|
|
|
add_custom_target(check-polly-tests
|
2012-12-06 15:59:18 +08:00
|
|
|
COMMAND ${LLVM_LIT}
|
|
|
|
--param polly_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
2016-08-25 20:36:15 +08:00
|
|
|
--param polly_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
|
2012-12-06 15:59:18 +08:00
|
|
|
--param build_config=${CMAKE_CFG_INTDIR}
|
|
|
|
-sv ${POLLY_TEST_EXTRA_ARGS}
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
DEPENDS ${POLLY_TEST_DEPS}
|
2016-08-25 20:36:15 +08:00
|
|
|
COMMENT "Running Polly regression/unit tests")
|
2016-09-05 18:54:16 +08:00
|
|
|
set_target_properties(check-polly-tests PROPERTIES FOLDER "Polly")
|
|
|
|
add_dependencies(check-polly check-polly-tests)
|
2016-08-25 20:36:15 +08:00
|
|
|
|
|
|
|
if (POLLY_GTEST_AVAIL)
|
|
|
|
configure_file(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg)
|
|
|
|
|
|
|
|
add_custom_target(check-polly-unittests
|
|
|
|
COMMAND ${LLVM_LIT}
|
|
|
|
--param polly_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
|
|
|
|
--param build_config=${CMAKE_CFG_INTDIR}
|
|
|
|
-sv ${POLLY_TEST_EXTRA_ARGS}
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/Unit
|
|
|
|
DEPENDS PollyUnitTests
|
|
|
|
COMMENT "Running Polly unit tests")
|
|
|
|
set_target_properties(check-polly-unittests PROPERTIES FOLDER "Polly")
|
|
|
|
endif ()
|
2016-10-05 03:48:40 +08:00
|
|
|
configure_file(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/UnitIsl/lit.site.cfg.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/UnitIsl/lit.site.cfg)
|
|
|
|
|
|
|
|
add_custom_target(check-polly-isl
|
|
|
|
command ${LLVM_LIT}
|
|
|
|
--param polly_site_config=${CMAKE_CURRENT_BINARY_DIR}/UnitIsl/lit.site.cfg
|
|
|
|
--param build_config=${CMAKE_CFG_INTDIR}
|
|
|
|
-sv ${POLLY_TEST_EXTRA_ARGS}
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
DEPENDS polly-isl-test
|
|
|
|
COMMENT "Running isl unit tests")
|
2016-10-07 20:38:24 +08:00
|
|
|
set_target_properties(check-polly-isl PROPERTIES FOLDER "Polly")
|
2012-12-06 15:59:18 +08:00
|
|
|
endif()
|
|
|
|
|
2011-04-29 15:34:54 +08:00
|
|
|
else (NOT DEFINED LLVM_MAIN_SRC_DIR)
|
2012-12-06 15:59:18 +08:00
|
|
|
|
2011-04-29 15:34:54 +08:00
|
|
|
set(LLVM_LIT ${LLVM_TOOLS_BINARY_DIR}/llvm-lit)
|
2014-05-14 22:18:14 +08:00
|
|
|
set(POLLY_TEST_DEPS llvm-config opt LLVMPolly FileCheck not)
|
2016-08-25 20:36:15 +08:00
|
|
|
if (POLLY_GTEST_AVAIL)
|
|
|
|
list(APPEND POLLY_TEST_DEPS PollyUnitTests)
|
|
|
|
endif ()
|
2011-04-29 15:34:54 +08:00
|
|
|
|
|
|
|
set(LLVM_BINARY_DIR "${LLVM_BINARY_DIR}")
|
2012-12-06 15:59:18 +08:00
|
|
|
set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}")
|
2015-01-19 09:03:05 +08:00
|
|
|
set(LLVM_LIBS_DIR "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}")
|
2012-03-16 22:34:20 +08:00
|
|
|
set(POLLY_LIB_DIR "${LLVM_LIBS_DIR}")
|
2012-12-06 15:59:18 +08:00
|
|
|
|
2016-08-25 20:03:33 +08:00
|
|
|
configure_lit_site_cfg(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
|
|
|
|
|
2016-08-25 20:36:15 +08:00
|
|
|
# Run regression and unit tests
|
2016-09-05 18:54:16 +08:00
|
|
|
add_lit_testsuite(check-polly-tests "Running polly regression tests"
|
2012-12-06 15:59:18 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
PARAMS polly_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
2016-08-25 20:36:15 +08:00
|
|
|
polly_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
|
2012-12-06 15:59:18 +08:00
|
|
|
DEPENDS ${POLLY_TEST_DEPS}
|
|
|
|
)
|
2016-09-05 18:54:16 +08:00
|
|
|
set_target_properties(check-polly-tests PROPERTIES FOLDER "Polly")
|
|
|
|
add_dependencies(check-polly check-polly-tests)
|
2012-12-06 15:59:18 +08:00
|
|
|
|
2016-08-25 20:36:15 +08:00
|
|
|
if (POLLY_GTEST_AVAIL)
|
|
|
|
configure_lit_site_cfg(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
|
|
|
|
)
|
|
|
|
|
|
|
|
# Run only unit tests
|
|
|
|
add_lit_testsuite(check-polly-unittests "Running polly unit tests only"
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/Unit
|
|
|
|
PARAMS polly_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
|
|
|
|
DEPENDS PollyUnitTests
|
|
|
|
)
|
|
|
|
set_target_properties(check-polly-unittests PROPERTIES FOLDER "Polly")
|
|
|
|
endif ()
|
|
|
|
|
2016-10-05 03:48:40 +08:00
|
|
|
configure_file(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/UnitIsl/lit.site.cfg.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/UnitIsl/lit.site.cfg)
|
|
|
|
|
|
|
|
add_lit_testsuite(check-polly-isl "Running isl unit tests only"
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/UnitIsl
|
|
|
|
PARAMS polly_site_config=${CMAKE_CURRENT_BINARY_DIR}/UnitIsl/lit.site.cfg
|
|
|
|
DEPENDS polly-isl-test
|
|
|
|
)
|
|
|
|
set_target_properties(check-polly-isl PROPERTIES FOLDER "Polly")
|
|
|
|
|
2015-09-15 03:11:48 +08:00
|
|
|
# Run polly-check-format as part of polly-check only if we are compiling with
|
2016-09-19 18:55:31 +08:00
|
|
|
# clang, so clang-format is available.
|
2015-09-15 03:11:48 +08:00
|
|
|
# if (TARGET clang-format) would be preferable, but this target is only added
|
2015-09-15 18:51:15 +08:00
|
|
|
# after Polly, i.e. there is no such target yet at this point. The CMake cache
|
|
|
|
# entry LLVM_TOOL_CLANG_BUILD will only be defined after clang has been
|
|
|
|
# configured at least once, i.e. format will be checked only after a rerun of
|
|
|
|
# CMake's configure.
|
|
|
|
if (LLVM_TOOL_CLANG_BUILD)
|
2015-09-15 03:11:48 +08:00
|
|
|
add_dependencies(check-polly polly-check-format)
|
|
|
|
endif ()
|
|
|
|
|
2011-04-29 15:34:54 +08:00
|
|
|
endif (NOT DEFINED LLVM_MAIN_SRC_DIR)
|
|
|
|
|
2016-02-29 22:58:13 +08:00
|
|
|
configure_file(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/update_check.py
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/update_check.py)
|
|
|
|
file(COPY ${CMAKE_CURRENT_BINARY_DIR}/update_check.py
|
|
|
|
DESTINATION ${LLVM_TOOLS_DIR}
|
|
|
|
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
|
|
|
|
GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
|
|
|
|
2012-12-06 15:59:18 +08:00
|
|
|
# Add a legacy target spelling: polly-test
|
|
|
|
add_custom_target(polly-test)
|
2015-07-21 20:40:01 +08:00
|
|
|
set_target_properties(polly-test PROPERTIES FOLDER "Polly")
|
2012-12-06 15:59:18 +08:00
|
|
|
add_dependencies(polly-test check-polly)
|