llvm.org GIT mirror llvm / 6d857ca
Move library stuff out of the toplevel CMakeLists.txt file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125968 91177308-0d34-0410-b5e6-96231b3b80d8 Oscar Fuentes 8 years ago
13 changed file(s) with 95 addition(s) and 82 deletion(s). Raw diff Collapse all Expand all
194194 llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "-O2")
195195 endif()
196196
197 # Put this before tblgen. Else we have a circular dependence.
197198 add_subdirectory(lib/Support)
198
199 # Everything else depends on Support:
200 set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} ${LLVM_LIBS} )
201199
202200 set(LLVM_TABLEGEN "tblgen" CACHE
203201 STRING "Native TableGen executable. Saves building one when cross-compiling.")
213211
214212 add_subdirectory(include/llvm)
215213
216 add_subdirectory(lib/VMCore)
217 add_subdirectory(lib/CodeGen)
218 add_subdirectory(lib/CodeGen/SelectionDAG)
219 add_subdirectory(lib/CodeGen/AsmPrinter)
220 add_subdirectory(lib/Bitcode/Reader)
221 add_subdirectory(lib/Bitcode/Writer)
222 add_subdirectory(lib/Transforms/Utils)
223 add_subdirectory(lib/Transforms/Instrumentation)
224 add_subdirectory(lib/Transforms/InstCombine)
225 add_subdirectory(lib/Transforms/Scalar)
226 add_subdirectory(lib/Transforms/IPO)
227 add_subdirectory(lib/Transforms/Hello)
228 add_subdirectory(lib/Linker)
229 add_subdirectory(lib/Analysis)
230 add_subdirectory(lib/Analysis/IPA)
231 add_subdirectory(lib/MC)
232 add_subdirectory(lib/MC/MCParser)
233 add_subdirectory(lib/MC/MCDisassembler)
234 add_subdirectory(lib/Object)
214 add_subdirectory(lib)
235215
236216 add_subdirectory(utils/FileCheck)
237217 add_subdirectory(utils/FileUpdate)
238218 add_subdirectory(utils/count)
239219 add_subdirectory(utils/not)
240220 add_subdirectory(utils/llvm-lit)
241
242 set(LLVM_ENUM_ASM_PRINTERS "")
243 set(LLVM_ENUM_ASM_PARSERS "")
244 set(LLVM_ENUM_DISASSEMBLERS "")
245 foreach(t ${LLVM_TARGETS_TO_BUILD})
246 message(STATUS "Targeting ${t}")
247 add_subdirectory(lib/Target/${t})
248 add_subdirectory(lib/Target/${t}/TargetInfo)
249 set( td ${LLVM_MAIN_SRC_DIR}/lib/Target/${t} )
250 file(GLOB asmp_file "${td}/*AsmPrinter.cpp")
251 if( asmp_file )
252 set(LLVM_ENUM_ASM_PRINTERS
253 "${LLVM_ENUM_ASM_PRINTERS}LLVM_ASM_PRINTER(${t})\n")
254 endif()
255 if( EXISTS ${td}/InstPrinter/CMakeLists.txt )
256 add_subdirectory(lib/Target/${t}/InstPrinter)
257 endif()
258 if( EXISTS ${td}/AsmParser/CMakeLists.txt )
259 add_subdirectory(lib/Target/${t}/AsmParser)
260 set(LLVM_ENUM_ASM_PARSERS
261 "${LLVM_ENUM_ASM_PARSERS}LLVM_ASM_PARSER(${t})\n")
262 endif()
263 if( EXISTS ${td}/Disassembler/CMakeLists.txt )
264 add_subdirectory(lib/Target/${t}/Disassembler)
265 set(LLVM_ENUM_DISASSEMBLERS
266 "${LLVM_ENUM_DISASSEMBLERS}LLVM_DISASSEMBLER(${t})\n")
267 endif()
268 if( EXISTS ${td}/Utils/CMakeLists.txt )
269 add_subdirectory(${td}/Utils)
270 endif()
271 set(CURRENT_LLVM_TARGET)
272 endforeach(t)
273
274 # Produce llvm/Config/AsmPrinters.def
275 configure_file(
276 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/AsmPrinters.def.in
277 ${LLVM_BINARY_DIR}/include/llvm/Config/AsmPrinters.def
278 )
279
280 # Produce llvm/Config/AsmParsers.def
281 configure_file(
282 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/AsmParsers.def.in
283 ${LLVM_BINARY_DIR}/include/llvm/Config/AsmParsers.def
284 )
285
286 # Produce llvm/Config/Disassemblers.def
287 configure_file(
288 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/Disassemblers.def.in
289 ${LLVM_BINARY_DIR}/include/llvm/Config/Disassemblers.def
290 )
291
292 add_subdirectory(lib/ExecutionEngine)
293 add_subdirectory(lib/ExecutionEngine/Interpreter)
294 add_subdirectory(lib/ExecutionEngine/JIT)
295 add_subdirectory(lib/ExecutionEngine/MCJIT)
296 add_subdirectory(lib/Target)
297 add_subdirectory(lib/AsmParser)
298 add_subdirectory(lib/Archive)
299221
300222 add_subdirectory(projects)
301223
33 macro(add_llvm_library name)
44 llvm_process_sources( ALL_FILES ${ARGN} )
55 add_library( ${name} ${ALL_FILES} )
6 set( llvm_libs ${llvm_libs} ${name} PARENT_SCOPE)
7 set( llvm_lib_targets ${llvm_lib_targets} ${name} PARENT_SCOPE )
6 set_property( GLOBAL APPEND PROPERTY LLVM_LIBS ${name} )
7 set_property( GLOBAL APPEND PROPERTY LLVM_LIB_TARGETS ${name} )
88 if( LLVM_COMMON_DEPENDS )
99 add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
1010 endif( LLVM_COMMON_DEPENDS )
0 set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/share/llvm/cmake")
1
2 get_property(llvm_libs GLOBAL PROPERTY LLVM_LIBS)
3 get_property(llvm_lib_targets GLOBAL PROPERTY LLVM_LIB_TARGETS)
14
25 configure_file(
36 LLVM.cmake
5858
5959 function(explicit_map_components_to_libraries out_libs)
6060 set( link_components ${ARGN} )
61 get_property(llvm_libs GLOBAL PROPERTY LLVM_LIBS)
6162 string(TOUPPER "${llvm_libs}" capitalized_libs)
6263 # Translate symbolic component names to real libraries:
6364 foreach(c ${link_components})
5555 TypeBasedAliasAnalysis.cpp
5656 ValueTracking.cpp
5757 )
58
59 add_subdirectory(IPA)
0 add_subdirectory(Reader)
1 add_subdirectory(Writer)
0 # `Support' library is added on the top-level CMakeLists.txt
1
2 add_subdirectory(VMCore)
3 add_subdirectory(CodeGen)
4 add_subdirectory(Bitcode)
5 add_subdirectory(Transforms)
6 add_subdirectory(Linker)
7 add_subdirectory(Analysis)
8 add_subdirectory(MC)
9 add_subdirectory(Object)
10 add_subdirectory(ExecutionEngine)
11 add_subdirectory(Target)
12 add_subdirectory(AsmParser)
13 add_subdirectory(Archive)
9393 VirtRegMap.cpp
9494 VirtRegRewriter.cpp
9595 )
96
97 add_subdirectory(SelectionDAG)
98 add_subdirectory(AsmPrinter)
11 ExecutionEngine.cpp
22 ExecutionEngineBindings.cpp
33 )
4
5 add_subdirectory(Interpreter)
6 add_subdirectory(JIT)
7 add_subdirectory(MCJIT)
3333 WinCOFFObjectWriter.cpp
3434 TargetAsmBackend.cpp
3535 )
36
37 add_subdirectory(MCParser)
38 add_subdirectory(MCDisassembler)
1414 TargetRegisterInfo.cpp
1515 TargetSubtarget.cpp
1616 )
17
18 set(LLVM_ENUM_ASM_PRINTERS "")
19 set(LLVM_ENUM_ASM_PARSERS "")
20 set(LLVM_ENUM_DISASSEMBLERS "")
21 foreach(t ${LLVM_TARGETS_TO_BUILD})
22 message(STATUS "Targeting ${t}")
23 add_subdirectory(${t})
24 add_subdirectory(${t}/TargetInfo)
25 set( td ${LLVM_MAIN_SRC_DIR}/lib/Target/${t} )
26 file(GLOB asmp_file "${td}/*AsmPrinter.cpp")
27 if( asmp_file )
28 set(LLVM_ENUM_ASM_PRINTERS
29 "${LLVM_ENUM_ASM_PRINTERS}LLVM_ASM_PRINTER(${t})\n")
30 endif()
31 if( EXISTS ${td}/InstPrinter/CMakeLists.txt )
32 add_subdirectory(${t}/InstPrinter)
33 endif()
34 if( EXISTS ${td}/AsmParser/CMakeLists.txt )
35 add_subdirectory(${t}/AsmParser)
36 set(LLVM_ENUM_ASM_PARSERS
37 "${LLVM_ENUM_ASM_PARSERS}LLVM_ASM_PARSER(${t})\n")
38 endif()
39 if( EXISTS ${td}/Disassembler/CMakeLists.txt )
40 add_subdirectory(${t}/Disassembler)
41 set(LLVM_ENUM_DISASSEMBLERS
42 "${LLVM_ENUM_DISASSEMBLERS}LLVM_DISASSEMBLER(${t})\n")
43 endif()
44 if( EXISTS ${td}/Utils/CMakeLists.txt )
45 add_subdirectory(${td}/Utils)
46 endif()
47 set(CURRENT_LLVM_TARGET)
48 endforeach(t)
49
50 # Produce llvm/Config/AsmPrinters.def
51 configure_file(
52 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/AsmPrinters.def.in
53 ${LLVM_BINARY_DIR}/include/llvm/Config/AsmPrinters.def
54 )
55
56 # Produce llvm/Config/AsmParsers.def
57 configure_file(
58 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/AsmParsers.def.in
59 ${LLVM_BINARY_DIR}/include/llvm/Config/AsmParsers.def
60 )
61
62 # Produce llvm/Config/Disassemblers.def
63 configure_file(
64 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/Disassemblers.def.in
65 ${LLVM_BINARY_DIR}/include/llvm/Config/Disassemblers.def
66 )
0 add_subdirectory(Utils)
1 add_subdirectory(Instrumentation)
2 add_subdirectory(InstCombine)
3 add_subdirectory(Scalar)
4 add_subdirectory(IPO)
5 add_subdirectory(Hello)
6969 message(FATAL_ERROR "`nm' not found")
7070 endif()
7171
72 get_property(llvm_libs GLOBAL PROPERTY LLVM_LIBS)
73
7274 add_custom_command(OUTPUT ${LIBDEPS_TMP}
7375 COMMAND ${PERL_EXECUTABLE} ${LLVM_MAIN_SRC_DIR}/utils/GenLibDeps.pl -flat ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR} ${NM_PATH} > ${LIBDEPS_TMP}
7476 DEPENDS ${llvm_libs}
121123 add_custom_target(llvm-config.target ALL
122124 DEPENDS ${LLVM_CONFIG})
123125
126 get_property(llvm_lib_targets GLOBAL PROPERTY LLVM_LIB_TARGETS)
124127 add_dependencies(llvm-config.target ${llvm_lib_targets})
125128
126129 # Make sure that llvm-config builds before the llvm tools, so we have