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 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 set_target_properties(check-polly-tests PROPERTIES FOLDER "Polly")
68 add_dependencies(check-polly check-polly-tests)
70 configure_lit_site_cfg(
71 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
72 ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
75 if (POLLY_GTEST_AVAIL)
77 add_lit_testsuite(check-polly-unittests "Running polly unit tests only"
78 ${CMAKE_CURRENT_BINARY_DIR}/Unit
79 PARAMS polly_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
80 DEPENDS PollyUnitTests
82 set_target_properties(check-polly-unittests PROPERTIES FOLDER "Polly")
86 ${CMAKE_CURRENT_SOURCE_DIR}/UnitIsl/lit.site.cfg.in
87 ${CMAKE_CURRENT_BINARY_DIR}/UnitIsl/lit.site.cfg)
89 if (POLLY_BUNDLED_ISL)
90 add_lit_testsuite(check-polly-isl "Running isl unit tests only"
91 ${CMAKE_CURRENT_BINARY_DIR}/UnitIsl
92 PARAMS polly_site_config=${CMAKE_CURRENT_BINARY_DIR}/UnitIsl/lit.site.cfg
93 DEPENDS polly-isl-test
95 set_target_properties(check-polly-isl PROPERTIES FOLDER "Polly")
96 endif (POLLY_BUNDLED_ISL)
98 # Run polly-check-format as part of polly-check only if we are compiling with
99 # clang, so clang-format is available.
100 # if (TARGET clang-format) would be preferable, but this target is only added
101 # after Polly, i.e. there is no such target yet at this point. The CMake cache
102 # entry LLVM_TOOL_CLANG_BUILD will only be defined after clang has been
103 # configured at least once, i.e. format will be checked only after a rerun of
105 if (LLVM_TOOL_CLANG_BUILD)
106 add_dependencies(check-polly polly-check-format)
110 ${CMAKE_CURRENT_SOURCE_DIR}/update_check.py
111 ${CMAKE_CURRENT_BINARY_DIR}/update_check.py)
113 # Add a legacy target spelling: polly-test
114 add_custom_target(polly-test)
115 set_target_properties(polly-test PROPERTIES FOLDER "Polly")
116 add_dependencies(polly-test check-polly)