[PATCH] D24442: cmake: Specify library dependences even without BUILD_SHARED_LIBS
Tobias Grosser via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 10 13:19:40 PDT 2016
grosser created this revision.
grosser added a reviewer: Meinersbur.
grosser added subscribers: llvm-commits, pollydev.
Herald added subscribers: mgorny, beanz.
This is necessary to make sure Polly's dependency on LLVMTarget is properly
registered. Without this change, we got link time failures in bugpoint,
which apparently does not require llvm::TargetRecip::TargetRecip, which however
is needed by Polly ACC.
Registering library dependences for Polly.a will break LLVMPolly.so, hence we
disable the build of LLVMPolly.so when using LINK_POLLY_INTO_TOOLS.
https://reviews.llvm.org/D24442
Files:
lib/CMakeLists.txt
test/CMakeLists.txt
Index: test/CMakeLists.txt
===================================================================
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -20,7 +20,9 @@
# We are building polly out of tree, adjust the settings.
# FIXME: FileCheck is not available in llvm install directory at the moment.
set(LLVM_LIT ${LLVM_INSTALL_ROOT}/bin/llvm-lit)
- set(POLLY_TEST_DEPS LLVMPolly)
+ if (NOT LINK_POLLY_INTO_TOOLS)
+ set(POLLY_TEST_DEPS LLVMPolly)
+ endif ()
if (POLLY_GTEST_AVAIL)
list(APPEND POLLY_TEST_DEPS PollyUnitTests)
endif ()
@@ -102,7 +104,10 @@
else (NOT DEFINED LLVM_MAIN_SRC_DIR)
set(LLVM_LIT ${LLVM_TOOLS_BINARY_DIR}/llvm-lit)
- set(POLLY_TEST_DEPS llvm-config opt LLVMPolly FileCheck not)
+ set(POLLY_TEST_DEPS llvm-config opt FileCheck not)
+ if (NOT LINK_POLLY_INTO_TOOLS)
+ set(POLLY_TEST_DEPS ${POLLY_TEST_DEPS} LLVMPolly)
+ endif()
if (POLLY_GTEST_AVAIL)
list(APPEND POLLY_TEST_DEPS PollyUnitTests)
endif ()
Index: lib/CMakeLists.txt
===================================================================
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -66,7 +66,14 @@
target_link_libraries(Polly PollyISL)
-if (BUILD_SHARED_LIBS)
+if (LLVM_LINK_LLVM_DYLIB)
+ target_link_libraries(Polly
+ LLVM
+ )
+ link_directories(
+ ${LLVM_LIBRARY_DIR}
+ )
+elseif (BUILD_SHARED_LIBS OR LINK_POLLY_INTO_TOOLS)
target_link_libraries(Polly
LLVMSupport
LLVMCore
@@ -87,33 +94,28 @@
link_directories(
${LLVM_LIBRARY_DIR}
)
-elseif (LLVM_LINK_LLVM_DYLIB)
- target_link_libraries(Polly
- LLVM
- )
- link_directories(
- ${LLVM_LIBRARY_DIR}
- )
endif()
# Build a monolithic Polly.a and a thin module LLVMPolly.moduleext that links to
# that static library.
-if (MSVC)
- # Add dummy target, because loadable modules are not supported on Windows
- add_custom_target(LLVMPolly)
- set_target_properties(LLVMPolly PROPERTIES FOLDER "Polly")
-else ()
- add_polly_loadable_module(LLVMPolly
- Polly.cpp
- )
+if (NOT LINK_POLLY_INTO_TOOLS)
+ if (MSVC)
+ # Add dummy target, because loadable modules are not supported on Windows
+ add_custom_target(LLVMPolly)
+ set_target_properties(LLVMPolly PROPERTIES FOLDER "Polly")
+ else ()
+ add_polly_loadable_module(LLVMPolly
+ Polly.cpp
+ )
- target_link_libraries(LLVMPolly Polly)
+ target_link_libraries(LLVMPolly Polly)
- set_target_properties(LLVMPolly
- PROPERTIES
- LINKER_LANGUAGE CXX
- PREFIX "")
-endif ()
+ set_target_properties(LLVMPolly
+ PROPERTIES
+ LINKER_LANGUAGE CXX
+ PREFIX "")
+ endif ()
+endif(NOT LINK_POLLY_INTO_TOOLS)
if (TARGET intrinsics_gen)
# Check if we are building as part of an LLVM build
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24442.70954.patch
Type: text/x-patch
Size: 2725 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160910/4414d2ef/attachment.bin>
More information about the llvm-commits
mailing list