1 set(LLVM_SHLIBEXT "${CMAKE_SHARED_MODULE_SUFFIX}")
3 add_custom_target(check-polly)
4 set_target_properties(check-polly PROPERTIES FOLDER "Polly/Meta")
6 if(NOT LLVM_MAIN_SRC_DIR)
7 find_program(LLVM_OPT NAMES opt HINTS ${LLVM_TOOLS_BINARY_DIR})
8 find_program(LLVM_FILECHECK NAMES FileCheck HINTS ${LLVM_TOOLS_BINARY_DIR})
9 find_program(LLVM_NOT NAMES not HINTS ${LLVM_TOOLS_BINARY_DIR})
11 message(WARNING "LLVM's opt program could not be found. Please set LLVM_OPT.")
13 if (NOT LLVM_FILECHECK)
14 message(WARNING "LLVM's FileCheck program could not be found. "
15 "Please set LLVM_FILECHECK. Please set LLVM_FILECHECK.")
18 message(WARNING "LLVM's not program could not be found. Please set LLVM_NOT.")
20 get_filename_component(EXTRA_PATHS ${LLVM_OPT} DIRECTORY)
21 list(APPEND POLLY_TEST_EXTRA_PATHS "${EXTRA_PATHS}")
22 get_filename_component(EXTRA_PATHS ${LLVM_FILECHECK} DIRECTORY)
23 list(APPEND POLLY_TEST_EXTRA_PATHS "${EXTRA_PATHS}")
24 get_filename_component(EXTRA_PATHS ${LLVM_NOT} DIRECTORY)
25 list(APPEND POLLY_TEST_EXTRA_PATHS "${EXTRA_PATHS}")
26 list(REMOVE_DUPLICATES POLLY_TEST_EXTRA_PATHS)
27 message(STATUS "Extra paths: ${POLLY_TEST_EXTRA_PATHS}")
28 if ("${POLLY_TEST_EXTRA_PATHS}" STREQUAL "${LLVM_TOOLS_BINARY_DIR}")
29 set(POLLY_TEST_EXTRA_PATHS "")
31 set(POLLY_TEST_DEPS LLVMPolly)
33 set(LLVM_OPT "${LLVM_TOOLS_BINARY_DIR}/opt")
34 set(LLVM_FILECHECK "${LLVM_TOOLS_BINARY_DIR}/FileCheck")
35 set(LLVM_NOT "${LLVM_TOOLS_BINARY_DIR}/not")
36 set(POLLY_TEST_EXTRA_PATHS "")
37 set(POLLY_TEST_DEPS llvm-config opt LLVMPolly FileCheck not count)
40 if (POLLY_BUNDLED_ISL)
41 list(APPEND POLLY_TEST_DEPS polly-isl-test)
43 if (POLLY_GTEST_AVAIL)
44 list(APPEND POLLY_TEST_DEPS PollyUnitTests)
47 set(LLVM_BINARY_DIR "${LLVM_BINARY_DIR}")
48 set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}")
49 set(LLVM_LIBS_DIR "${LLVM_LIBRARY_DIR}")
50 if (CMAKE_LIBRARY_OUTPUT_DIRECTORY)
51 set(POLLY_LIB_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
53 set(POLLY_LIB_DIR "${POLLY_BINARY_DIR}/lib")
56 configure_lit_site_cfg(
57 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
58 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
60 # Run regression and unit tests
61 add_lit_testsuite(check-polly-tests "Running polly regression tests"
62 ${CMAKE_CURRENT_BINARY_DIR}
63 PARAMS polly_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
64 polly_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
65 DEPENDS ${POLLY_TEST_DEPS}
67 add_dependencies(check-polly check-polly-tests)
69 configure_lit_site_cfg(
70 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
71 ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
74 if (POLLY_GTEST_AVAIL)
76 add_lit_testsuite(check-polly-unittests "Running polly unit tests only"
77 ${CMAKE_CURRENT_BINARY_DIR}/Unit
78 PARAMS polly_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
79 EXCLUDE_FROM_CHECK_ALL
80 DEPENDS PollyUnitTests
85 ${CMAKE_CURRENT_SOURCE_DIR}/UnitIsl/lit.site.cfg.in
86 ${CMAKE_CURRENT_BINARY_DIR}/UnitIsl/lit.site.cfg)
88 if (POLLY_BUNDLED_ISL)
89 add_lit_testsuite(check-polly-isl "Running isl unit tests only"
90 ${CMAKE_CURRENT_BINARY_DIR}/UnitIsl
91 PARAMS polly_site_config=${CMAKE_CURRENT_BINARY_DIR}/UnitIsl/lit.site.cfg
92 EXCLUDE_FROM_CHECK_ALL
93 DEPENDS polly-isl-test
95 endif (POLLY_BUNDLED_ISL)
97 # Run polly-check-format as part of polly-check only if we are compiling with
98 # clang, so clang-format is available.
99 # if (TARGET clang-format) would be preferable, but this target is only added
100 # after Polly, i.e. there is no such target yet at this point. The CMake cache
101 # entry LLVM_TOOL_CLANG_BUILD will only be defined after clang has been
102 # configured at least once, i.e. format will be checked only after a rerun of
104 if (LLVM_TOOL_CLANG_BUILD)
105 add_dependencies(check-polly polly-check-format)
109 ${CMAKE_CURRENT_SOURCE_DIR}/update_check.py
110 ${CMAKE_CURRENT_BINARY_DIR}/update_check.py)
112 # Add a legacy target spelling: polly-test
113 add_custom_target(polly-test)
114 set_target_properties(polly-test PROPERTIES FOLDER "Polly/Metatargets")
115 add_dependencies(polly-test check-polly)