4269ae842be8e279eff98e003c11c324d6c8c9b5
[oota-llvm.git] / tools / CMakeLists.txt
1 # NOTE: The tools are organized into groups of four consisting of one large and
2 # three small executables. This is done to minimize memory load in parallel
3 # builds.  Please retain this ordering.
4
5 # If polly exists and is not disabled compile it and add it to the LLVM tools.
6 option(LLVM_BUILD_POLLY "Compile polly" ON)
7 if( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/polly/CMakeLists.txt )
8   if (LLVM_BUILD_POLLY)
9     add_subdirectory( ${CMAKE_CURRENT_SOURCE_DIR}/polly)
10   endif (LLVM_BUILD_POLLY)
11 endif( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/polly/CMakeLists.txt )
12
13 if( NOT WIN32 OR MSYS OR CYGWIN )
14   # It is useful to build llvm-config before the other tools, so we
15   # have a fresh LibDeps.txt for regenerating the hard-coded library
16   # dependencies. llvm-config/CMakeLists.txt takes care of this but we
17   # must keep llvm-config as the first entry on the list of tools to
18   # be built.
19   add_subdirectory(llvm-config)
20 endif()
21
22 add_subdirectory(llvm-config-2)
23 add_subdirectory(opt)
24 add_subdirectory(llvm-as)
25 add_subdirectory(llvm-dis)
26 add_subdirectory(llvm-mc)
27
28 add_subdirectory(llc)
29 add_subdirectory(llvm-ranlib)
30 add_subdirectory(llvm-ar)
31 add_subdirectory(llvm-nm)
32 add_subdirectory(llvm-size)
33
34 add_subdirectory(llvm-ld)
35 add_subdirectory(llvm-prof)
36 add_subdirectory(llvm-link)
37 add_subdirectory(lli)
38
39 add_subdirectory(llvm-extract)
40 add_subdirectory(llvm-diff)
41 add_subdirectory(macho-dump)
42 add_subdirectory(llvm-objdump)
43 add_subdirectory(llvm-rtdyld)
44 add_subdirectory(llvm-dwarfdump)
45
46 add_subdirectory(bugpoint)
47 add_subdirectory(bugpoint-passes)
48 add_subdirectory(llvm-bcanalyzer)
49 add_subdirectory(llvm-stub)
50 add_subdirectory(edis)
51
52 if( NOT WIN32 )
53   add_subdirectory(lto)
54 endif()
55
56 if( LLVM_ENABLE_PIC )
57   # TODO: support other systems:
58   if( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
59     add_subdirectory(gold)
60   endif()
61 endif()
62
63 set(LLVM_CLANG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/clang" CACHE PATH "Path to Clang source directory")
64
65 if (NOT ${LLVM_CLANG_SOURCE_DIR} STREQUAL ""
66     AND EXISTS ${LLVM_CLANG_SOURCE_DIR}/CMakeLists.txt)
67   option(LLVM_BUILD_CLANG "Whether to build Clang as part of LLVM" ON)
68   if (${LLVM_BUILD_CLANG})
69     add_subdirectory(${LLVM_CLANG_SOURCE_DIR} clang)
70   endif()
71 endif ()
72
73 set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} PARENT_SCOPE)