Permalink
Browse files

cmake: Fix building of Polly on Apple system

The Apple linker fails by default, if some function calls can not be resolved at
link time. However, all functions that are part of LLVM itself will not be
linked into Polly, but will be provided by the compiler that Polly is loaded
into.  Hence, during linking we need to ignore failures due to unresolved
function calls.

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@161234 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information...
1 parent a9aeefd commit 5e6be27df58d3030d7926333ff57d98737d6a463 @tobig tobig committed Aug 3, 2012
Showing with 11 additions and 1 deletion.
  1. +10 −0 CMakeLists.txt
  2. +1 −1 lib/CMakeLists.txt
View
10 CMakeLists.txt
@@ -170,6 +170,16 @@ macro(add_polly_library name)
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
endmacro(add_polly_library)
+macro(add_polly_loadable_module name)
+ set(srcs ${ARGN})
+ add_polly_library(${name} ${srcs})
+ if (APPLE)
+ # Darwin-specific linker flags for loadable modules.
+ set_target_properties(${name} PROPERTIES
+ LINK_FLAGS "-Wl,-flat_namespace -Wl,-undefined -Wl,suppress")
+ endif()
+endmacro(add_polly_loadable_module)
+
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/lib/JSON/include
View
2 lib/CMakeLists.txt
@@ -23,7 +23,7 @@ set(LLVM_USED_LIBS
PollyJSON
)
-add_polly_library(LLVMPolly
+add_polly_loadable_module(LLVMPolly
CodePreparation.cpp
DeadCodeElimination.cpp
IndependentBlocks.cpp

0 comments on commit 5e6be27

Please sign in to comment.