150
|
1 set(LLVM_SHLIBEXT "${CMAKE_SHARED_MODULE_SUFFIX}")
|
|
2
|
|
3 add_custom_target(check-polly)
|
|
4 set_target_properties(check-polly PROPERTIES FOLDER "Polly")
|
|
5
|
|
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})
|
|
10 if (NOT LLVM_OPT)
|
|
11 message(WARNING "LLVM's opt program could not be found. Please set LLVM_OPT.")
|
|
12 endif()
|
|
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.")
|
|
16 endif()
|
|
17 if (NOT LLVM_NOT)
|
|
18 message(WARNING "LLVM's not program could not be found. Please set LLVM_NOT.")
|
|
19 endif()
|
|
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 "")
|
|
30 endif()
|
|
31 set(POLLY_TEST_DEPS LLVMPolly)
|
|
32 else ()
|
|
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 "")
|
236
|
37 set(POLLY_TEST_DEPS llvm-config opt LLVMPolly FileCheck not count)
|
150
|
38 endif()
|
|
39
|
|
40 if (POLLY_BUNDLED_ISL)
|
|
41 list(APPEND POLLY_TEST_DEPS polly-isl-test)
|
|
42 endif()
|
|
43 if (POLLY_GTEST_AVAIL)
|
|
44 list(APPEND POLLY_TEST_DEPS PollyUnitTests)
|
|
45 endif ()
|
|
46
|
|
47 set(LLVM_BINARY_DIR "${LLVM_BINARY_DIR}")
|
|
48 set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}")
|
236
|
49 set(LLVM_LIBS_DIR "${LLVM_LIBRARY_DIR}")
|
150
|
50 if (CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
|
51 set(POLLY_LIB_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
|
|
52 else()
|
|
53 set(POLLY_LIB_DIR "${POLLY_BINARY_DIR}/lib")
|
|
54 endif()
|
|
55
|
|
56 configure_lit_site_cfg(
|
|
57 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
|
|
58 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
|
|
59
|
|
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}
|
|
66 )
|
|
67 set_target_properties(check-polly-tests PROPERTIES FOLDER "Polly")
|
|
68 add_dependencies(check-polly check-polly-tests)
|
|
69
|
|
70 configure_lit_site_cfg(
|
|
71 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
|
|
72 ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
|
|
73 )
|
|
74
|
|
75 if (POLLY_GTEST_AVAIL)
|
|
76 # Run only unit tests
|
|
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
|
236
|
80 EXCLUDE_FROM_CHECK_ALL
|
150
|
81 DEPENDS PollyUnitTests
|
|
82 )
|
|
83 set_target_properties(check-polly-unittests PROPERTIES FOLDER "Polly")
|
|
84 endif ()
|
|
85
|
|
86 configure_file(
|
|
87 ${CMAKE_CURRENT_SOURCE_DIR}/UnitIsl/lit.site.cfg.in
|
|
88 ${CMAKE_CURRENT_BINARY_DIR}/UnitIsl/lit.site.cfg)
|
|
89
|
|
90 if (POLLY_BUNDLED_ISL)
|
|
91 add_lit_testsuite(check-polly-isl "Running isl unit tests only"
|
|
92 ${CMAKE_CURRENT_BINARY_DIR}/UnitIsl
|
|
93 PARAMS polly_site_config=${CMAKE_CURRENT_BINARY_DIR}/UnitIsl/lit.site.cfg
|
236
|
94 EXCLUDE_FROM_CHECK_ALL
|
150
|
95 DEPENDS polly-isl-test
|
|
96 )
|
|
97 set_target_properties(check-polly-isl PROPERTIES FOLDER "Polly")
|
|
98 endif (POLLY_BUNDLED_ISL)
|
|
99
|
|
100 # Run polly-check-format as part of polly-check only if we are compiling with
|
|
101 # clang, so clang-format is available.
|
|
102 # if (TARGET clang-format) would be preferable, but this target is only added
|
|
103 # after Polly, i.e. there is no such target yet at this point. The CMake cache
|
|
104 # entry LLVM_TOOL_CLANG_BUILD will only be defined after clang has been
|
|
105 # configured at least once, i.e. format will be checked only after a rerun of
|
|
106 # CMake's configure.
|
|
107 if (LLVM_TOOL_CLANG_BUILD)
|
|
108 add_dependencies(check-polly polly-check-format)
|
|
109 endif ()
|
|
110
|
|
111 configure_file(
|
|
112 ${CMAKE_CURRENT_SOURCE_DIR}/update_check.py
|
|
113 ${CMAKE_CURRENT_BINARY_DIR}/update_check.py)
|
|
114
|
|
115 # Add a legacy target spelling: polly-test
|
|
116 add_custom_target(polly-test)
|
|
117 set_target_properties(polly-test PROPERTIES FOLDER "Polly")
|
|
118 add_dependencies(polly-test check-polly)
|