Remove keep/take/give from isl C++ bindings
[polly-mirror.git] / lib / CMakeLists.txt
blob0e81a31295baa6398fa04f4af3719eb66f0d320c
1 set(LLVM_NO_RTTI 1)
3 set(ISL_CODEGEN_FILES
4     CodeGen/IslAst.cpp
5     CodeGen/IslExprBuilder.cpp
6     CodeGen/IslNodeBuilder.cpp
7     CodeGen/CodeGeneration.cpp)
9 if (GPU_CODEGEN)
10   set (GPGPU_CODEGEN_FILES
11        CodeGen/PPCGCodeGeneration.cpp
12        CodeGen/ManagedMemoryRewrite.cpp
13        )
14 endif (GPU_CODEGEN)
16 # Compile ISL into a separate library.
17 add_subdirectory(External)
19 set(POLLY_HEADER_FILES)
20 if (MSVC_IDE OR XCODE)
21   file(GLOB_RECURSE POLLY_HEADER_FILES "${POLLY_SOURCE_DIR}/include/polly/*.h")
22 endif ()
24 # Use an object-library to add the same files to multiple libs without requiring
25 # the sources them to be recompiled for each of them.
26 add_library(PollyCore OBJECT
27   Analysis/DependenceInfo.cpp
28   Analysis/PolyhedralInfo.cpp
29   Analysis/ScopDetection.cpp
30   Analysis/ScopDetectionDiagnostic.cpp
31   Analysis/ScopInfo.cpp
32   Analysis/ScopBuilder.cpp
33   Analysis/ScopGraphPrinter.cpp
34   Analysis/ScopPass.cpp
35   Analysis/PruneUnprofitable.cpp
36   CodeGen/BlockGenerators.cpp
37   ${ISL_CODEGEN_FILES}
38   CodeGen/LoopGenerators.cpp
39   CodeGen/IRBuilder.cpp
40   CodeGen/Utils.cpp
41   CodeGen/RuntimeDebugBuilder.cpp
42   CodeGen/CodegenCleanup.cpp
43   CodeGen/PerfMonitor.cpp
44   ${GPGPU_CODEGEN_FILES}
45   Exchange/JSONExporter.cpp
46   Support/GICHelper.cpp
47   Support/SCEVAffinator.cpp
48   Support/SCEVValidator.cpp
49   Support/RegisterPasses.cpp
50   Support/ScopHelper.cpp
51   Support/ScopLocation.cpp
52   Support/ISLTools.cpp
53   Support/DumpModulePass.cpp
54   Support/VirtualInstruction.cpp
55   ${POLLY_JSON_FILES}
56   Transform/Canonicalization.cpp
57   Transform/CodePreparation.cpp
58   Transform/DeadCodeElimination.cpp
59   Transform/ScheduleOptimizer.cpp
60   Transform/FlattenSchedule.cpp
61   Transform/FlattenAlgo.cpp
62   Transform/ForwardOpTree.cpp
63   Transform/DeLICM.cpp
64   Transform/ZoneAlgo.cpp
65   Transform/Simplify.cpp
66   Transform/MaximalStaticExpansion.cpp
67   Transform/RewriteByReferenceParameters.cpp
68   Transform/ScopInliner.cpp
69   ${POLLY_HEADER_FILES}
70   )
71 set_target_properties(PollyCore PROPERTIES FOLDER "Polly")
73 # Create the library that can be linked into LLVM's tools and Polly's unittests.
74 # It depends on all library it needs, such that with
75 # LLVM_POLLY_LINK_INTO_TOOLS=ON, its dependencies like PollyISL are linked as
76 # well.
77 add_polly_library(Polly $<TARGET_OBJECTS:PollyCore>)
78 target_link_libraries(Polly PUBLIC
79   ${ISL_TARGET}
80   ${JSONCPP_LIBRARIES}
83 # Additional dependencies for Polly-ACC.
84 if (GPU_CODEGEN)
85   target_link_libraries(Polly PUBLIC PollyPPCG)
86 endif ()
89 # Polly-ACC requires the NVPTX backend to work. Ask LLVM about its libraries.
90 set(nvptx_libs)
91 if (GPU_CODEGEN)
92   # This call emits an error if they NVPTX backend is not enable.
93   llvm_map_components_to_libnames(nvptx_libs NVPTX)
94 endif ()
96 if (LLVM_LINK_LLVM_DYLIB)
97   # The shlib/dylib contains all the LLVM components
98   # (including NVPTX is enabled) already. Adding them to target_link_libraries
99   # would cause them being twice in the address space
100   # (their LLVM*.a/so and their copies in libLLVM.so)
101   # which results in errors when the two instances try to register the same
102   # command-line switches.
103   target_link_libraries(Polly PUBLIC LLVM)
104 else ()
105   target_link_libraries(Polly PUBLIC
106     LLVMSupport
107     LLVMCore
108     LLVMScalarOpts
109     LLVMInstCombine
110     LLVMTransformUtils
111     LLVMAnalysis
112     LLVMipo
113     LLVMMC
114     LLVMPasses
115     LLVMLinker
116     LLVMIRReader
117     ${nvptx_libs}
118     # The libraries below are required for darwin: http://PR26392
119     LLVMBitReader
120     LLVMMCParser
121     LLVMObject
122     LLVMProfileData
123     LLVMTarget
124     LLVMVectorize
125     )
126 endif ()
128 # Create a loadable module Polly.so that can be loaded using
129 # LLVM's/clang's "-load" option.
130 if (MSVC)
131   # Add dummy target, because loadable modules are not supported on Windows
132   add_custom_target(LLVMPolly)
133   set_target_properties(LLVMPolly PROPERTIES FOLDER "Polly")
134 else ()
135   add_polly_loadable_module(LLVMPolly
136     Polly.cpp
137     $<TARGET_OBJECTS:PollyCore>
138   )
140   # Only add the dependencies that are not part of LLVM. The latter are assumed
141   # to be already available in the address space the module is loaded into.
142   # Adding them once more would have the effect that both copies try to register
143   # the same command line options, to which LLVM reacts with an error.
144   # If Polly-ACC is enabled, the NVPTX target is also expected to reside in the
145   # hosts. This is not the case for bugpoint. Use LLVM_POLLY_LINK_INTO_TOOLS=ON
146   # instead which will automatically resolve the additional dependencies by
147   # Polly.
148   target_link_libraries(LLVMPolly PUBLIC ${ISL_TARGET} ${JSONCPP_LIBRARIES})
149   if (GPU_CODEGEN)
150     target_link_libraries(LLVMPolly PUBLIC PollyPPCG)
151   endif ()
153   set_target_properties(LLVMPolly
154     PROPERTIES
155     LINKER_LANGUAGE CXX
156     PREFIX "")
157 endif ()
159 if (TARGET intrinsics_gen)
160   # Check if we are building as part of an LLVM build
161   add_dependencies(PollyCore intrinsics_gen)
162 endif()