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")
|
|
|
|
|
[Polly][CMake] Use the CMake Package instead of llvm-config in out-of-tree builds
Summary:
As of now, Polly uses llvm-config to set up LLVM dependencies in an out-of-tree build.
This is problematic for two reasons:
1) Right now, in-tree and out-of-tree builds in fact do different things. E.g., in an in-tree build, libPolly depends on a handful of LLVM libraries, while in an out-of-tree build it depends on all of them. This means that we often need to treat both paths seperately.
2) I'm specifically unhappy with the way libPolly is linked right now, because it just blindly links against all the LLVM libs. That doesn't make a lot of sense. For instance, one of these libs is LLVMTableGen, which contains a command line definition of a -o option. This means that I can not link an out-of-tree libPolly into a tool which might want to offer a -o option as well.
This patch (mostly) drop the use of llvm-config in favor of LLVMs exported cmake package. However, building Polly with unittests requires access to the gtest sources (in the LLVM source tree). If we're building against an LLVM installation, this source tree is unavailable and must specified. I'm using llvm-config to provide a default in this case.
Reviewers: Meinersbur, grosser
Reviewed By: grosser
Subscribers: tstellar, bollu, chapuni, mgorny, pollydev, llvm-commits
Differential Revision: https://reviews.llvm.org/D33299
llvm-svn: 307650
2017-07-11 19:24:25 +08:00
|
|
|
if(NOT LLVM_MAIN_SRC_DIR)
|
|
|
|
find_program(LLVM_OPT NAMES opt HINTS ${LLVM_TOOLS_BINARY_DIR})
|
|
|
|
find_program(LLVM_FILECHECK NAMES FileCheck HINTS ${LLVM_TOOLS_BINARY_DIR})
|
|
|
|
find_program(LLVM_NOT NAMES not HINTS ${LLVM_TOOLS_BINARY_DIR})
|
|
|
|
if (NOT LLVM_OPT)
|
|
|
|
message(WARNING "LLVM's opt program could not be found. Please set LLVM_OPT.")
|
2012-12-06 15:59:18 +08:00
|
|
|
endif()
|
[Polly][CMake] Use the CMake Package instead of llvm-config in out-of-tree builds
Summary:
As of now, Polly uses llvm-config to set up LLVM dependencies in an out-of-tree build.
This is problematic for two reasons:
1) Right now, in-tree and out-of-tree builds in fact do different things. E.g., in an in-tree build, libPolly depends on a handful of LLVM libraries, while in an out-of-tree build it depends on all of them. This means that we often need to treat both paths seperately.
2) I'm specifically unhappy with the way libPolly is linked right now, because it just blindly links against all the LLVM libs. That doesn't make a lot of sense. For instance, one of these libs is LLVMTableGen, which contains a command line definition of a -o option. This means that I can not link an out-of-tree libPolly into a tool which might want to offer a -o option as well.
This patch (mostly) drop the use of llvm-config in favor of LLVMs exported cmake package. However, building Polly with unittests requires access to the gtest sources (in the LLVM source tree). If we're building against an LLVM installation, this source tree is unavailable and must specified. I'm using llvm-config to provide a default in this case.
Reviewers: Meinersbur, grosser
Reviewed By: grosser
Subscribers: tstellar, bollu, chapuni, mgorny, pollydev, llvm-commits
Differential Revision: https://reviews.llvm.org/D33299
llvm-svn: 307650
2017-07-11 19:24:25 +08:00
|
|
|
if (NOT LLVM_FILECHECK)
|
|
|
|
message(WARNING "LLVM's FileCheck program could not be found. "
|
|
|
|
"Please set LLVM_FILECHECK. Please set LLVM_FILECHECK.")
|
2017-02-28 01:54:25 +08:00
|
|
|
endif()
|
[Polly][CMake] Use the CMake Package instead of llvm-config in out-of-tree builds
Summary:
As of now, Polly uses llvm-config to set up LLVM dependencies in an out-of-tree build.
This is problematic for two reasons:
1) Right now, in-tree and out-of-tree builds in fact do different things. E.g., in an in-tree build, libPolly depends on a handful of LLVM libraries, while in an out-of-tree build it depends on all of them. This means that we often need to treat both paths seperately.
2) I'm specifically unhappy with the way libPolly is linked right now, because it just blindly links against all the LLVM libs. That doesn't make a lot of sense. For instance, one of these libs is LLVMTableGen, which contains a command line definition of a -o option. This means that I can not link an out-of-tree libPolly into a tool which might want to offer a -o option as well.
This patch (mostly) drop the use of llvm-config in favor of LLVMs exported cmake package. However, building Polly with unittests requires access to the gtest sources (in the LLVM source tree). If we're building against an LLVM installation, this source tree is unavailable and must specified. I'm using llvm-config to provide a default in this case.
Reviewers: Meinersbur, grosser
Reviewed By: grosser
Subscribers: tstellar, bollu, chapuni, mgorny, pollydev, llvm-commits
Differential Revision: https://reviews.llvm.org/D33299
llvm-svn: 307650
2017-07-11 19:24:25 +08:00
|
|
|
if (NOT LLVM_NOT)
|
|
|
|
message(WARNING "LLVM's not program could not be found. Please set LLVM_NOT.")
|
|
|
|
endif()
|
|
|
|
get_filename_component(EXTRA_PATHS ${LLVM_OPT} DIRECTORY)
|
|
|
|
list(APPEND POLLY_TEST_EXTRA_PATHS "${EXTRA_PATHS}")
|
|
|
|
get_filename_component(EXTRA_PATHS ${LLVM_FILECHECK} DIRECTORY)
|
|
|
|
list(APPEND POLLY_TEST_EXTRA_PATHS "${EXTRA_PATHS}")
|
|
|
|
get_filename_component(EXTRA_PATHS ${LLVM_NOT} DIRECTORY)
|
|
|
|
list(APPEND POLLY_TEST_EXTRA_PATHS "${EXTRA_PATHS}")
|
|
|
|
list(REMOVE_DUPLICATES POLLY_TEST_EXTRA_PATHS)
|
|
|
|
message(STATUS "Extra paths: ${POLLY_TEST_EXTRA_PATHS}")
|
|
|
|
if ("${POLLY_TEST_EXTRA_PATHS}" STREQUAL "${LLVM_TOOLS_BINARY_DIR}")
|
|
|
|
set(POLLY_TEST_EXTRA_PATHS "")
|
|
|
|
endif()
|
2017-07-20 03:20:58 +08:00
|
|
|
set(POLLY_TEST_DEPS LLVMPolly)
|
[Polly][CMake] Use the CMake Package instead of llvm-config in out-of-tree builds
Summary:
As of now, Polly uses llvm-config to set up LLVM dependencies in an out-of-tree build.
This is problematic for two reasons:
1) Right now, in-tree and out-of-tree builds in fact do different things. E.g., in an in-tree build, libPolly depends on a handful of LLVM libraries, while in an out-of-tree build it depends on all of them. This means that we often need to treat both paths seperately.
2) I'm specifically unhappy with the way libPolly is linked right now, because it just blindly links against all the LLVM libs. That doesn't make a lot of sense. For instance, one of these libs is LLVMTableGen, which contains a command line definition of a -o option. This means that I can not link an out-of-tree libPolly into a tool which might want to offer a -o option as well.
This patch (mostly) drop the use of llvm-config in favor of LLVMs exported cmake package. However, building Polly with unittests requires access to the gtest sources (in the LLVM source tree). If we're building against an LLVM installation, this source tree is unavailable and must specified. I'm using llvm-config to provide a default in this case.
Reviewers: Meinersbur, grosser
Reviewed By: grosser
Subscribers: tstellar, bollu, chapuni, mgorny, pollydev, llvm-commits
Differential Revision: https://reviews.llvm.org/D33299
llvm-svn: 307650
2017-07-11 19:24:25 +08:00
|
|
|
else ()
|
|
|
|
set(LLVM_OPT "${LLVM_TOOLS_BINARY_DIR}/opt")
|
|
|
|
set(LLVM_FILECHECK "${LLVM_TOOLS_BINARY_DIR}/FileCheck")
|
|
|
|
set(LLVM_NOT "${LLVM_TOOLS_BINARY_DIR}/not")
|
|
|
|
set(POLLY_TEST_EXTRA_PATHS "")
|
2021-08-29 11:50:07 +08:00
|
|
|
set(POLLY_TEST_DEPS llvm-config opt LLVMPolly FileCheck not count)
|
[Polly][CMake] Use the CMake Package instead of llvm-config in out-of-tree builds
Summary:
As of now, Polly uses llvm-config to set up LLVM dependencies in an out-of-tree build.
This is problematic for two reasons:
1) Right now, in-tree and out-of-tree builds in fact do different things. E.g., in an in-tree build, libPolly depends on a handful of LLVM libraries, while in an out-of-tree build it depends on all of them. This means that we often need to treat both paths seperately.
2) I'm specifically unhappy with the way libPolly is linked right now, because it just blindly links against all the LLVM libs. That doesn't make a lot of sense. For instance, one of these libs is LLVMTableGen, which contains a command line definition of a -o option. This means that I can not link an out-of-tree libPolly into a tool which might want to offer a -o option as well.
This patch (mostly) drop the use of llvm-config in favor of LLVMs exported cmake package. However, building Polly with unittests requires access to the gtest sources (in the LLVM source tree). If we're building against an LLVM installation, this source tree is unavailable and must specified. I'm using llvm-config to provide a default in this case.
Reviewers: Meinersbur, grosser
Reviewed By: grosser
Subscribers: tstellar, bollu, chapuni, mgorny, pollydev, llvm-commits
Differential Revision: https://reviews.llvm.org/D33299
llvm-svn: 307650
2017-07-11 19:24:25 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if (POLLY_BUNDLED_ISL)
|
|
|
|
list(APPEND POLLY_TEST_DEPS polly-isl-test)
|
|
|
|
endif()
|
|
|
|
if (POLLY_GTEST_AVAIL)
|
|
|
|
list(APPEND POLLY_TEST_DEPS PollyUnitTests)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
set(LLVM_BINARY_DIR "${LLVM_BINARY_DIR}")
|
|
|
|
set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}")
|
|
|
|
set(LLVM_LIBS_DIR "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}")
|
2018-03-05 22:43:04 +08:00
|
|
|
if (CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
|
|
|
set(POLLY_LIB_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
|
|
|
|
else()
|
|
|
|
set(POLLY_LIB_DIR "${POLLY_BINARY_DIR}/lib")
|
|
|
|
endif()
|
[Polly][CMake] Use the CMake Package instead of llvm-config in out-of-tree builds
Summary:
As of now, Polly uses llvm-config to set up LLVM dependencies in an out-of-tree build.
This is problematic for two reasons:
1) Right now, in-tree and out-of-tree builds in fact do different things. E.g., in an in-tree build, libPolly depends on a handful of LLVM libraries, while in an out-of-tree build it depends on all of them. This means that we often need to treat both paths seperately.
2) I'm specifically unhappy with the way libPolly is linked right now, because it just blindly links against all the LLVM libs. That doesn't make a lot of sense. For instance, one of these libs is LLVMTableGen, which contains a command line definition of a -o option. This means that I can not link an out-of-tree libPolly into a tool which might want to offer a -o option as well.
This patch (mostly) drop the use of llvm-config in favor of LLVMs exported cmake package. However, building Polly with unittests requires access to the gtest sources (in the LLVM source tree). If we're building against an LLVM installation, this source tree is unavailable and must specified. I'm using llvm-config to provide a default in this case.
Reviewers: Meinersbur, grosser
Reviewed By: grosser
Subscribers: tstellar, bollu, chapuni, mgorny, pollydev, llvm-commits
Differential Revision: https://reviews.llvm.org/D33299
llvm-svn: 307650
2017-07-11 19:24:25 +08:00
|
|
|
|
|
|
|
configure_lit_site_cfg(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
|
|
|
|
|
|
|
|
# Run regression and unit tests
|
|
|
|
add_lit_testsuite(check-polly-tests "Running polly regression tests"
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
PARAMS polly_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
|
|
|
polly_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
|
|
|
|
DEPENDS ${POLLY_TEST_DEPS}
|
|
|
|
)
|
|
|
|
set_target_properties(check-polly-tests PROPERTIES FOLDER "Polly")
|
|
|
|
add_dependencies(check-polly check-polly-tests)
|
|
|
|
|
[Polly][CMake] Skip unit-tests in lit if gtest is not available
Summary:
There is a bug in the current lit configurations for the unittests. If gtest is not available, the site-config for the unit tests won't be generated. Because lit recurses through the test directory, the lit configuration for the unit tests will be discovered nevertheless, leading to a fatal error in lit.
This patch semi-gracefully skips the unittests if gtest is not available. As a result, running lit now prints this: `warning: test suite 'Polly-Unit' contained no test`.
If people think that this is too annoying, the alternative would be to pick apart the test directory, so that the lit testsuite discovery will always only find one configuration. In fact, both of these things could be combined. While it's certainly nice that running a single lit command runs all the tests, I suppose people use the `check-polly` make target over lit most of the time, so the difference might not be noticed.
Reviewers: Meinersbur, grosser
Reviewed By: grosser
Subscribers: mgorny, bollu, pollydev, llvm-commits
Tags: #polly
Differential Revision: https://reviews.llvm.org/D34053
llvm-svn: 307651
2017-07-11 19:37:35 +08:00
|
|
|
configure_lit_site_cfg(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
|
|
|
|
)
|
2012-12-06 15:59:18 +08:00
|
|
|
|
[Polly][CMake] Skip unit-tests in lit if gtest is not available
Summary:
There is a bug in the current lit configurations for the unittests. If gtest is not available, the site-config for the unit tests won't be generated. Because lit recurses through the test directory, the lit configuration for the unit tests will be discovered nevertheless, leading to a fatal error in lit.
This patch semi-gracefully skips the unittests if gtest is not available. As a result, running lit now prints this: `warning: test suite 'Polly-Unit' contained no test`.
If people think that this is too annoying, the alternative would be to pick apart the test directory, so that the lit testsuite discovery will always only find one configuration. In fact, both of these things could be combined. While it's certainly nice that running a single lit command runs all the tests, I suppose people use the `check-polly` make target over lit most of the time, so the difference might not be noticed.
Reviewers: Meinersbur, grosser
Reviewed By: grosser
Subscribers: mgorny, bollu, pollydev, llvm-commits
Tags: #polly
Differential Revision: https://reviews.llvm.org/D34053
llvm-svn: 307651
2017-07-11 19:37:35 +08:00
|
|
|
if (POLLY_GTEST_AVAIL)
|
[Polly][CMake] Use the CMake Package instead of llvm-config in out-of-tree builds
Summary:
As of now, Polly uses llvm-config to set up LLVM dependencies in an out-of-tree build.
This is problematic for two reasons:
1) Right now, in-tree and out-of-tree builds in fact do different things. E.g., in an in-tree build, libPolly depends on a handful of LLVM libraries, while in an out-of-tree build it depends on all of them. This means that we often need to treat both paths seperately.
2) I'm specifically unhappy with the way libPolly is linked right now, because it just blindly links against all the LLVM libs. That doesn't make a lot of sense. For instance, one of these libs is LLVMTableGen, which contains a command line definition of a -o option. This means that I can not link an out-of-tree libPolly into a tool which might want to offer a -o option as well.
This patch (mostly) drop the use of llvm-config in favor of LLVMs exported cmake package. However, building Polly with unittests requires access to the gtest sources (in the LLVM source tree). If we're building against an LLVM installation, this source tree is unavailable and must specified. I'm using llvm-config to provide a default in this case.
Reviewers: Meinersbur, grosser
Reviewed By: grosser
Subscribers: tstellar, bollu, chapuni, mgorny, pollydev, llvm-commits
Differential Revision: https://reviews.llvm.org/D33299
llvm-svn: 307650
2017-07-11 19:24:25 +08:00
|
|
|
# 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
|
2016-08-25 20:36:15 +08:00
|
|
|
)
|
[Polly][CMake] Use the CMake Package instead of llvm-config in out-of-tree builds
Summary:
As of now, Polly uses llvm-config to set up LLVM dependencies in an out-of-tree build.
This is problematic for two reasons:
1) Right now, in-tree and out-of-tree builds in fact do different things. E.g., in an in-tree build, libPolly depends on a handful of LLVM libraries, while in an out-of-tree build it depends on all of them. This means that we often need to treat both paths seperately.
2) I'm specifically unhappy with the way libPolly is linked right now, because it just blindly links against all the LLVM libs. That doesn't make a lot of sense. For instance, one of these libs is LLVMTableGen, which contains a command line definition of a -o option. This means that I can not link an out-of-tree libPolly into a tool which might want to offer a -o option as well.
This patch (mostly) drop the use of llvm-config in favor of LLVMs exported cmake package. However, building Polly with unittests requires access to the gtest sources (in the LLVM source tree). If we're building against an LLVM installation, this source tree is unavailable and must specified. I'm using llvm-config to provide a default in this case.
Reviewers: Meinersbur, grosser
Reviewed By: grosser
Subscribers: tstellar, bollu, chapuni, mgorny, pollydev, llvm-commits
Differential Revision: https://reviews.llvm.org/D33299
llvm-svn: 307650
2017-07-11 19:24:25 +08:00
|
|
|
set_target_properties(check-polly-unittests PROPERTIES FOLDER "Polly")
|
|
|
|
endif ()
|
2016-08-25 20:36:15 +08:00
|
|
|
|
[Polly][CMake] Use the CMake Package instead of llvm-config in out-of-tree builds
Summary:
As of now, Polly uses llvm-config to set up LLVM dependencies in an out-of-tree build.
This is problematic for two reasons:
1) Right now, in-tree and out-of-tree builds in fact do different things. E.g., in an in-tree build, libPolly depends on a handful of LLVM libraries, while in an out-of-tree build it depends on all of them. This means that we often need to treat both paths seperately.
2) I'm specifically unhappy with the way libPolly is linked right now, because it just blindly links against all the LLVM libs. That doesn't make a lot of sense. For instance, one of these libs is LLVMTableGen, which contains a command line definition of a -o option. This means that I can not link an out-of-tree libPolly into a tool which might want to offer a -o option as well.
This patch (mostly) drop the use of llvm-config in favor of LLVMs exported cmake package. However, building Polly with unittests requires access to the gtest sources (in the LLVM source tree). If we're building against an LLVM installation, this source tree is unavailable and must specified. I'm using llvm-config to provide a default in this case.
Reviewers: Meinersbur, grosser
Reviewed By: grosser
Subscribers: tstellar, bollu, chapuni, mgorny, pollydev, llvm-commits
Differential Revision: https://reviews.llvm.org/D33299
llvm-svn: 307650
2017-07-11 19:24:25 +08:00
|
|
|
configure_file(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/UnitIsl/lit.site.cfg.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/UnitIsl/lit.site.cfg)
|
|
|
|
|
|
|
|
if (POLLY_BUNDLED_ISL)
|
|
|
|
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")
|
|
|
|
endif (POLLY_BUNDLED_ISL)
|
|
|
|
|
|
|
|
# Run polly-check-format as part of polly-check only if we are compiling with
|
|
|
|
# clang, so clang-format is available.
|
|
|
|
# if (TARGET clang-format) would be preferable, but this target is only added
|
|
|
|
# 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)
|
|
|
|
add_dependencies(check-polly polly-check-format)
|
|
|
|
endif ()
|
2011-04-29 15:34:54 +08:00
|
|
|
|
2016-02-29 22:58:13 +08:00
|
|
|
configure_file(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/update_check.py
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/update_check.py)
|
|
|
|
|
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)
|