[PATCH] D30495: [Polly][Cmake] Generate a PollyConfig.cmake

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 7 15:20:56 PST 2017


Meinersbur added a comment.

Thanks for this update. Here are some more comments.



================
Comment at: cmake/CMakeLists.txt:13
+if (POLLY_ENABLE_GPGPU_CODEGEN)
+  list(APPEND POLLY_EXPORTED_TARGETS PollyPPCG)
+endif()
----------------
Did you mean
```
list(APPEND POLLY_CONFIG_EXPORTED_TARGETS PollyPPCG)
```
?


================
Comment at: cmake/CMakeLists.txt:44
+# Generate PollyConfig.cmake for the build tree.
+set(POLLY_CONFIG_CMAKE_DIR "${POLLY_BINARY_DIR}/${POLLY_INSTALL_PACKAGE_DIR}")
+set(POLLY_CONFIG_INCLUDE_DIRS @ISL_INCLUDE_DIRS@)
----------------
Clang uses
```
set(clang_cmake_builddir "${CMAKE_BINARY_DIR}/${CLANG_INSTALL_PACKAGE_DIR}")
```
(`CMAKE_BINARY_DIR` instead of `POLLY_BINARY_DIR`). The effect is that the `PollyConfig.cmake` lands in `<build dir>/lib/polly/PollyConfig.cmake`, not in `<build dir>/tools/polly/lib/cmake/PollyConfig.cmake` as done currently. I think we should do the same. I think the idea is that all the `*Config.cmake` for the build dir can be found at a central place. We should do the same.


================
Comment at: cmake/CMakeLists.txt:45
+set(POLLY_CONFIG_CMAKE_DIR "${POLLY_BINARY_DIR}/${POLLY_INSTALL_PACKAGE_DIR}")
+set(POLLY_CONFIG_INCLUDE_DIRS @ISL_INCLUDE_DIRS@)
+set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_BINARY_DIR}/lib")
----------------
Did you mean
```
set(POLLY_CONFIG_INCLUDE_DIRS ${ISL_INCLUDE_DIRS})
```
?


================
Comment at: cmake/CMakeLists.txt:65-67
+file(GENERATE
+  OUTPUT ${POLLY_CONFIG_CMAKE_DIR}/PollyExports.cmake
+  CONTENT "${POLLY_EXPORTS}")
----------------
On Windows, this generates several errors:
```
CMake Error at tools/polly/cmake/CMakeLists.txt:63 (file):
  Error evaluating generator expression:

    $<TARGET_FILE:LLVMPolly>

  Target "LLVMPolly" is not an executable or library.
```
(same for line 109)
Because LLVMPolly is only a dummy target on Windows.

For the other targets these errors show up:
```
  CMake Error in tools/polly/cmake/CMakeLists.txt:
    Evaluation file to be written multiple times for different configurations
    or languages with different content:

      C:/Users/Meinersbur/build/llvm/vc14/tools/polly/lib/cmake/polly/PollyExports.cmake
```
with multi-configuration generators such as Visual Studio.

I don't really care about having this generated on Windows, but there shouldn't be errors. Can you just skip this in these cases? I suggest:
```
if (NOT CMAKE_CONFIGURATION_TYPES AND NOT MSVC)
  add_subdirectory(cmake)
endif ()
```
(this also excludes XCode)


https://reviews.llvm.org/D30495





More information about the llvm-commits mailing list