1 set(LLVM_SHLIBEXT "${CMAKE_SHARED_MODULE_SUFFIX}")
3 add_custom_target(check-polly)
4 set_target_properties(check-polly PROPERTIES FOLDER "Polly")
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)
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_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}")
50 set(POLLY_LIB_DIR "${POLLY_BINARY_DIR}/lib")
52 configure_lit_site_cfg(
53 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
54 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
56 # Run regression and unit tests
57 add_lit_testsuite(check-polly-tests "Running polly regression tests"
58 ${CMAKE_CURRENT_BINARY_DIR}
59 PARAMS polly_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
60 polly_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
61 DEPENDS ${POLLY_TEST_DEPS}
63 set_target_properties(check-polly-tests PROPERTIES FOLDER "Polly")
64 add_dependencies(check-polly check-polly-tests)
66 configure_lit_site_cfg(
67 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
68 ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
71 if (POLLY_GTEST_AVAIL)
73 add_lit_testsuite(check-polly-unittests "Running polly unit tests only"
74 ${CMAKE_CURRENT_BINARY_DIR}/Unit
75 PARAMS polly_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
76 DEPENDS PollyUnitTests
78 set_target_properties(check-polly-unittests PROPERTIES FOLDER "Polly")
82 ${CMAKE_CURRENT_SOURCE_DIR}/UnitIsl/lit.site.cfg.in
83 ${CMAKE_CURRENT_BINARY_DIR}/UnitIsl/lit.site.cfg)
85 if (POLLY_BUNDLED_ISL)
86 add_lit_testsuite(check-polly-isl "Running isl unit tests only"
87 ${CMAKE_CURRENT_BINARY_DIR}/UnitIsl
88 PARAMS polly_site_config=${CMAKE_CURRENT_BINARY_DIR}/UnitIsl/lit.site.cfg
89 DEPENDS polly-isl-test
91 set_target_properties(check-polly-isl PROPERTIES FOLDER "Polly")
92 endif (POLLY_BUNDLED_ISL)
94 # Run polly-check-format as part of polly-check only if we are compiling with
95 # clang, so clang-format is available.
96 # if (TARGET clang-format) would be preferable, but this target is only added
97 # after Polly, i.e. there is no such target yet at this point. The CMake cache
98 # entry LLVM_TOOL_CLANG_BUILD will only be defined after clang has been
99 # configured at least once, i.e. format will be checked only after a rerun of
101 if (LLVM_TOOL_CLANG_BUILD)
102 add_dependencies(check-polly polly-check-format)
106 ${CMAKE_CURRENT_SOURCE_DIR}/update_check.py
107 ${CMAKE_CURRENT_BINARY_DIR}/update_check.py)
109 # Add a legacy target spelling: polly-test
110 add_custom_target(polly-test)
111 set_target_properties(polly-test PROPERTIES FOLDER "Polly")
112 add_dependencies(polly-test check-polly)