blob: 8dc2ba7d9640567a43a90d4d70310b32bc1801d4 [file] [log] [blame]
Oscar Fuentes34fc5172009-04-04 22:52:02 +00001# See docs/CMake.html for instructions about how to build LLVM with CMake.
2
Cedric Venet1d083f42008-10-30 21:22:00 +00003project(LLVM)
Oscar Fuentesc677c5d2010-08-03 15:07:17 +00004cmake_minimum_required(VERSION 2.8)
Oscar Fuentes3d01fc72008-09-22 01:08:49 +00005
Oscar Fuentesee993172010-08-03 17:28:09 +00006# Add path for custom modules
7set(CMAKE_MODULE_PATH
8 ${CMAKE_MODULE_PATH}
9 "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
10 "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
11 )
12
13set(PACKAGE_VERSION "2.8")
14include(VersionFromVCS)
15add_version_info_from_vcs(PACKAGE_VERSION)
16
Oscar Fuentes3d01fc72008-09-22 01:08:49 +000017set(PACKAGE_NAME llvm)
Chris Lattner8c46e852009-01-28 17:49:03 +000018set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
Oscar Fuentesf7e73b92008-10-25 03:49:35 +000019set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu")
Oscar Fuentes3d01fc72008-09-22 01:08:49 +000020
Oscar Fuentes6326a0d2008-11-14 03:43:18 +000021if( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE )
22 message(FATAL_ERROR "In-source builds are not allowed.
23CMake would overwrite the makefiles distributed with LLVM.
24Please create a directory and run cmake from there, passing the path
25to this source directory as the last argument.
26This process created the file `CMakeCache.txt' and the directory `CMakeFiles'.
27Please delete them.")
28endif()
29
Oscar Fuentes81a87552009-06-03 15:11:25 +000030string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
31
Oscar Fuentes3d01fc72008-09-22 01:08:49 +000032set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
Oscar Fuentes980e8422008-10-29 02:33:15 +000033set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/include)
Oscar Fuentes3d01fc72008-09-22 01:08:49 +000034set(LLVM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
35set(LLVM_TOOLS_BINARY_DIR ${LLVM_BINARY_DIR}/bin)
36set(LLVM_EXAMPLES_BINARY_DIR ${LLVM_BINARY_DIR}/examples)
Oscar Fuentesaf0f65f2009-06-12 02:49:53 +000037set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" )
Oscar Fuentes3d01fc72008-09-22 01:08:49 +000038
Oscar Fuentes6761c5d2009-07-13 21:58:44 +000039if( NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR )
40 file(GLOB_RECURSE
41 tablegenned_files_on_include_dir
42 "${LLVM_MAIN_SRC_DIR}/include/llvm/*.gen")
43 file(GLOB_RECURSE
44 tablegenned_files_on_lib_dir
45 "${LLVM_MAIN_SRC_DIR}/lib/Target/*.inc")
46 if( tablegenned_files_on_include_dir OR tablegenned_files_on_lib_dir)
47 message(FATAL_ERROR "Apparently there is a previous in-source build,
48probably as the result of running `configure' and `make' on
49${LLVM_MAIN_SRC_DIR}.
50This may cause problems. The suspicious files are:
51${tablegenned_files_on_lib_dir}
52${tablegenned_files_on_include_dir}
53Please clean the source directory.")
54 endif()
55endif()
56
Oscar Fuentes4f21c132008-11-10 01:47:07 +000057set(LLVM_ALL_TARGETS
58 Alpha
59 ARM
Jakob Stoklund Olesen73b7bb72009-08-02 17:32:37 +000060 Blackfin
Oscar Fuentes4f21c132008-11-10 01:47:07 +000061 CBackend
62 CellSPU
63 CppBackend
Oscar Fuentes4f21c132008-11-10 01:47:07 +000064 Mips
Wesley Peckc84a9562010-03-05 15:15:55 +000065 MBlaze
Oscar Fuentes4f21c132008-11-10 01:47:07 +000066 MSIL
Richard Penningtona51984b2009-07-09 20:27:09 +000067 MSP430
Oscar Fuentes4f21c132008-11-10 01:47:07 +000068 PIC16
69 PowerPC
70 Sparc
Daniel Dunbar3f189a32009-07-20 00:24:17 +000071 SystemZ
Oscar Fuentes4f21c132008-11-10 01:47:07 +000072 X86
73 XCore
74 )
75
Oscar Fuentese1ad0872008-09-26 04:40:32 +000076if( MSVC )
77 set(LLVM_TARGETS_TO_BUILD X86
Oscar Fuentes4f21c132008-11-10 01:47:07 +000078 CACHE STRING "Semicolon-separated list of targets to build, or \"all\".")
Oscar Fuentese1ad0872008-09-26 04:40:32 +000079else( MSVC )
Oscar Fuentes4f21c132008-11-10 01:47:07 +000080 set(LLVM_TARGETS_TO_BUILD ${LLVM_ALL_TARGETS}
81 CACHE STRING "Semicolon-separated list of targets to build, or \"all\".")
Oscar Fuentese1ad0872008-09-26 04:40:32 +000082endif( MSVC )
Oscar Fuentes3d01fc72008-09-22 01:08:49 +000083
Oscar Fuentes8e3c1692009-11-12 06:48:09 +000084set(C_INCLUDE_DIRS "" CACHE STRING
85 "Colon separated list of directories clang will search for headers.")
86
Oscar Fuentesa9ff1392009-09-13 22:18:38 +000087set(LLVM_TARGET_ARCH "host"
88 CACHE STRING "Set target to use for LLVM JIT or use \"host\" for automatic detection.")
89
Oscar Fuentes4b442832008-11-18 23:45:21 +000090option(LLVM_ENABLE_THREADS "Use threads if available." ON)
91
Oscar Fuentes81a87552009-06-03 15:11:25 +000092if( uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" )
Oscar Fuentes76941b22009-06-04 09:26:16 +000093 option(LLVM_ENABLE_ASSERTIONS "Enable assertions" OFF)
Oscar Fuentes81a87552009-06-03 15:11:25 +000094else()
Oscar Fuentes76941b22009-06-04 09:26:16 +000095 option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON)
Oscar Fuentes81a87552009-06-03 15:11:25 +000096endif()
97
Oscar Fuentes76941b22009-06-04 09:26:16 +000098if( LLVM_ENABLE_ASSERTIONS )
Oscar Fuentesaf109102009-07-05 18:43:52 +000099 # MSVC doesn't like _DEBUG on release builds. See PR 4379.
Oscar Fuentese8c81ea2009-07-05 23:58:20 +0000100 if( NOT MSVC )
Oscar Fuentesaf109102009-07-05 18:43:52 +0000101 add_definitions( -D_DEBUG )
102 endif()
Oscar Fuentes76941b22009-06-04 09:26:16 +0000103 # On Release builds cmake automatically defines NDEBUG, so we
104 # explicitly undefine it:
105 if( uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" )
106 add_definitions( -UNDEBUG )
107 endif()
108else()
109 if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" )
110 add_definitions( -DNDEBUG )
111 endif()
Oscar Fuentes81a87552009-06-03 15:11:25 +0000112endif()
113
Oscar Fuentes4f21c132008-11-10 01:47:07 +0000114if( LLVM_TARGETS_TO_BUILD STREQUAL "all" )
115 set( LLVM_TARGETS_TO_BUILD ${LLVM_ALL_TARGETS} )
116endif()
117
Douglas Gregor1555a232009-06-16 20:12:29 +0000118set(LLVM_ENUM_TARGETS "")
Oscar Fuentes4f21c132008-11-10 01:47:07 +0000119foreach(c ${LLVM_TARGETS_TO_BUILD})
120 list(FIND LLVM_ALL_TARGETS ${c} idx)
121 if( idx LESS 0 )
Gabor Greif9befba82009-08-12 08:37:37 +0000122 message(FATAL_ERROR "The target `${c}' does not exist.
Oscar Fuentes4f21c132008-11-10 01:47:07 +0000123 It should be one of\n${LLVM_ALL_TARGETS}")
Douglas Gregor1555a232009-06-16 20:12:29 +0000124 else()
125 set(LLVM_ENUM_TARGETS "${LLVM_ENUM_TARGETS}LLVM_TARGET(${c})\n")
Oscar Fuentes4f21c132008-11-10 01:47:07 +0000126 endif()
127endforeach(c)
128
Douglas Gregor1555a232009-06-16 20:12:29 +0000129# Produce llvm/Config/Targets.def
130configure_file(
131 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/Targets.def.in
132 ${LLVM_BINARY_DIR}/include/llvm/Config/Targets.def
133 )
134
Oscar Fuentes3d01fc72008-09-22 01:08:49 +0000135set(llvm_builded_incs_dir ${LLVM_BINARY_DIR}/include/llvm)
136
Oscar Fuentes9a0107d2009-04-04 22:41:07 +0000137include(AddLLVMDefinitions)
138
Oscar Fuentes3d01fc72008-09-22 01:08:49 +0000139if(WIN32)
Oscar Fuentes4fd38b82008-10-30 17:15:54 +0000140 if(CYGWIN)
141 set(LLVM_ON_WIN32 0)
142 set(LLVM_ON_UNIX 1)
143 else(CYGWIN)
144 set(LLVM_ON_WIN32 1)
145 set(LLVM_ON_UNIX 0)
146 endif(CYGWIN)
Oscar Fuentes3d01fc72008-09-22 01:08:49 +0000147 set(LTDL_SHLIB_EXT ".dll")
148 set(EXEEXT ".exe")
149 # Maximum path length is 160 for non-unicode paths
150 set(MAXPATHLEN 160)
151else(WIN32)
152 if(UNIX)
153 set(LLVM_ON_WIN32 0)
154 set(LLVM_ON_UNIX 1)
Daniel Dunbar05dafd82009-09-22 06:09:37 +0000155 if(APPLE)
156 set(LTDL_SHLIB_EXT ".dylib")
157 else(APPLE)
158 set(LTDL_SHLIB_EXT ".so")
159 endif(APPLE)
Oscar Fuentes3d01fc72008-09-22 01:08:49 +0000160 set(EXEEXT "")
161 # FIXME: Maximum path length is currently set to 'safe' fixed value
162 set(MAXPATHLEN 2024)
163 else(UNIX)
164 MESSAGE(SEND_ERROR "Unable to determine platform")
165 endif(UNIX)
166endif(WIN32)
167
Oscar Fuentesde98db32008-10-25 03:29:36 +0000168include(config-ix)
Oscar Fuentes3d01fc72008-09-22 01:08:49 +0000169
Oscar Fuentes1e02bf02009-08-18 15:29:35 +0000170option(LLVM_ENABLE_PIC "Build Position-Independent Code" ON)
Oscar Fuentes64fb4c82008-11-20 19:13:51 +0000171
Douglas Gregor318de602009-06-05 23:46:34 +0000172set(ENABLE_PIC 0)
Oscar Fuentes64fb4c82008-11-20 19:13:51 +0000173if( LLVM_ENABLE_PIC )
Daniel Dunbar36206182009-11-08 00:34:22 +0000174 if( XCODE )
175 # Xcode has -mdynamic-no-pic on by default, which overrides -fPIC. I don't
176 # know how to disable this, so just force ENABLE_PIC off for now.
177 message(STATUS "Warning: -fPIC not supported with Xcode.")
178 else( XCODE )
179 if( SUPPORTS_FPIC_FLAG )
180 message(STATUS "Building with -fPIC")
181 add_llvm_definitions(-fPIC)
182 set(ENABLE_PIC 1)
183 else( SUPPORTS_FPIC_FLAG )
184 message(STATUS "Warning: -fPIC not supported.")
185 endif()
186 endif()
Oscar Fuentes64fb4c82008-11-20 19:13:51 +0000187endif()
188
Oscar Fuentes3d01fc72008-09-22 01:08:49 +0000189set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR} )
190set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib )
191set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib )
192
193# set(CMAKE_VERBOSE_MAKEFILE true)
194
Oscar Fuentes9a0107d2009-04-04 22:41:07 +0000195add_llvm_definitions( -D__STDC_LIMIT_MACROS )
196add_llvm_definitions( -D__STDC_CONSTANT_MACROS )
Oscar Fuentes3d01fc72008-09-22 01:08:49 +0000197
Daniel Dunbar9ea3a2c2009-12-01 19:11:36 +0000198# MSVC has a gazillion warnings with this.
199if( MSVC )
200 option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." OFF)
201else( MSVC )
202 option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON)
203endif()
204
Oscar Fuentesf12a9002009-12-01 02:21:51 +0000205option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
206option(LLVM_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
207
Oscar Fuentesb0c56992008-11-04 03:27:24 +0000208if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
209 # TODO: support other platforms and toolchains.
Oscar Fuentes6307b942008-11-19 00:10:39 +0000210 option(LLVM_BUILD_32_BITS "Build 32 bits executables and libraries." OFF)
211 if( LLVM_BUILD_32_BITS )
Oscar Fuentesb0c56992008-11-04 03:27:24 +0000212 message(STATUS "Building 32 bits executables and libraries.")
Oscar Fuentes9a0107d2009-04-04 22:41:07 +0000213 add_llvm_definitions( -m32 )
Oscar Fuentes6307b942008-11-19 00:10:39 +0000214 list(APPEND CMAKE_EXE_LINKER_FLAGS -m32)
215 list(APPEND CMAKE_SHARED_LINKER_FLAGS -m32)
Oscar Fuentes6307b942008-11-19 00:10:39 +0000216 endif( LLVM_BUILD_32_BITS )
Oscar Fuentesb0c56992008-11-04 03:27:24 +0000217endif( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
218
Oscar Fuentes3d01fc72008-09-22 01:08:49 +0000219if( MSVC )
Oscar Fuentes02a8f762010-08-05 01:25:48 +0000220 include(ChooseMSVCCRT)
Stefanus Du Toit4ba3a0e2009-06-08 21:18:31 +0000221
Oscar Fuentes9a0107d2009-04-04 22:41:07 +0000222 add_llvm_definitions( -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS )
223 add_llvm_definitions( -D_SCL_SECURE_NO_WARNINGS -DCRT_NONSTDC_NO_WARNINGS )
224 add_llvm_definitions( -D_SCL_SECURE_NO_DEPRECATE )
225 add_llvm_definitions( -wd4146 -wd4503 -wd4996 -wd4800 -wd4244 -wd4624 )
226 add_llvm_definitions( -wd4355 -wd4715 -wd4180 -wd4345 -wd4224 )
Stefanus Du Toit4ba3a0e2009-06-08 21:18:31 +0000227
Daniel Dunbar2c4df5a2009-07-19 01:35:10 +0000228 # Suppress 'new behavior: elements of array 'array' will be default initialized'
229 add_llvm_definitions( -wd4351 )
230
Oscar Fuentesf12a9002009-12-01 02:21:51 +0000231 # Enable warnings
232 if (LLVM_ENABLE_WARNINGS)
233 add_llvm_definitions( /W4 /Wall )
234 if (LLVM_ENABLE_PEDANTIC)
235 # No MSVC equivalent available
236 endif (LLVM_ENABLE_PEDANTIC)
237 endif (LLVM_ENABLE_WARNINGS)
238 if (LLVM_ENABLE_WERROR)
239 add_llvm_definitions( /WX )
240 endif (LLVM_ENABLE_WERROR)
Oscar Fuentes2343b102009-11-30 23:50:14 +0000241elseif( CMAKE_COMPILER_IS_GNUCXX )
Oscar Fuentesf12a9002009-12-01 02:21:51 +0000242 if (LLVM_ENABLE_WARNINGS)
243 add_llvm_definitions( -Wall -W -Wno-unused-parameter -Wwrite-strings )
244 if (LLVM_ENABLE_PEDANTIC)
245 add_llvm_definitions( -pedantic -Wno-long-long )
246 endif (LLVM_ENABLE_PEDANTIC)
247 endif (LLVM_ENABLE_WARNINGS)
248 if (LLVM_ENABLE_WERROR)
249 add_llvm_definitions( -Werror )
250 endif (LLVM_ENABLE_WERROR)
Oscar Fuentes3d01fc72008-09-22 01:08:49 +0000251endif( MSVC )
252
Oscar Fuentes980e8422008-10-29 02:33:15 +0000253include_directories( ${LLVM_BINARY_DIR}/include ${LLVM_MAIN_INCLUDE_DIR})
Oscar Fuentes3d01fc72008-09-22 01:08:49 +0000254
Edward O'Callaghanc6cf5fe2009-10-12 04:00:11 +0000255if( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )
256 SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-include llvm/System/Solaris.h")
257endif( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )
258
Oscar Fuentes3d01fc72008-09-22 01:08:49 +0000259include(AddLLVM)
Oscar Fuentese1ad0872008-09-26 04:40:32 +0000260include(TableGen)
Oscar Fuentes3d01fc72008-09-22 01:08:49 +0000261
262add_subdirectory(lib/Support)
263add_subdirectory(lib/System)
Oscar Fuentes1d8e4cf2008-09-22 18:21:51 +0000264
265# Everything else depends on Support and System:
266set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} ${LLVM_LIBS} )
267
Oscar Fuentes3ab40ca2008-11-09 18:53:19 +0000268set(LLVM_TABLEGEN "tblgen" CACHE
Oscar Fuentes41bdedf2008-11-10 02:35:55 +0000269 STRING "Native TableGen executable. Saves building one when cross-compiling.")
Oscar Fuentes99b94892009-06-11 04:16:10 +0000270# Effective tblgen executable to be used:
271set(LLVM_TABLEGEN_EXE ${LLVM_TABLEGEN})
Oscar Fuentes3ab40ca2008-11-09 18:53:19 +0000272
Oscar Fuentes02516ba2008-11-10 01:32:14 +0000273add_subdirectory(utils/TableGen)
274
Oscar Fuentes3ab40ca2008-11-09 18:53:19 +0000275if( CMAKE_CROSSCOMPILING )
Oscar Fuentes02516ba2008-11-10 01:32:14 +0000276 # This adds a dependency on target `tblgen', so must go after utils/TableGen
Oscar Fuentes3ab40ca2008-11-09 18:53:19 +0000277 include( CrossCompileLLVM )
278endif( CMAKE_CROSSCOMPILING )
279
Oscar Fuentes422fcf32008-11-15 00:24:38 +0000280add_subdirectory(include/llvm)
Oscar Fuentes1d8e4cf2008-09-22 18:21:51 +0000281
Oscar Fuentes3d01fc72008-09-22 01:08:49 +0000282add_subdirectory(lib/VMCore)
283add_subdirectory(lib/CodeGen)
284add_subdirectory(lib/CodeGen/SelectionDAG)
285add_subdirectory(lib/CodeGen/AsmPrinter)
286add_subdirectory(lib/Bitcode/Reader)
287add_subdirectory(lib/Bitcode/Writer)
288add_subdirectory(lib/Transforms/Utils)
289add_subdirectory(lib/Transforms/Instrumentation)
Douglas Gregorf1c3a862010-01-04 21:58:55 +0000290add_subdirectory(lib/Transforms/InstCombine)
Oscar Fuentes3d01fc72008-09-22 01:08:49 +0000291add_subdirectory(lib/Transforms/Scalar)
292add_subdirectory(lib/Transforms/IPO)
293add_subdirectory(lib/Transforms/Hello)
294add_subdirectory(lib/Linker)
295add_subdirectory(lib/Analysis)
296add_subdirectory(lib/Analysis/IPA)
Daniel Dunbarecc63f82009-06-23 22:01:43 +0000297add_subdirectory(lib/MC)
Daniel Dunbar4bd8dc32010-01-22 02:04:33 +0000298add_subdirectory(lib/MC/MCParser)
Chris Lattner847da552010-07-20 18:25:19 +0000299add_subdirectory(lib/MC/MCDisassembler)
Daniel Dunbara1774922009-09-22 07:38:44 +0000300add_subdirectory(test)
Oscar Fuentese1ad0872008-09-26 04:40:32 +0000301
Douglas Gregor4d20c242009-07-20 18:30:25 +0000302add_subdirectory(utils/FileCheck)
Daniel Dunbar48f7ce82009-09-24 06:23:57 +0000303add_subdirectory(utils/count)
304add_subdirectory(utils/not)
Douglas Gregor4d20c242009-07-20 18:30:25 +0000305
Oscar Fuentes75caad42009-08-14 04:55:21 +0000306set(LLVM_ENUM_ASM_PRINTERS "")
307set(LLVM_ENUM_ASM_PARSERS "")
Daniel Dunbarfa3f0b92009-11-25 04:30:13 +0000308set(LLVM_ENUM_DISASSEMBLERS "")
Oscar Fuentes75caad42009-08-14 04:55:21 +0000309foreach(t ${LLVM_TARGETS_TO_BUILD})
Oscar Fuentese1ad0872008-09-26 04:40:32 +0000310 message(STATUS "Targeting ${t}")
311 add_subdirectory(lib/Target/${t})
Daniel Dunbarb5a8c082009-07-15 07:04:27 +0000312 add_subdirectory(lib/Target/${t}/TargetInfo)
Oscar Fuentescccecb82008-11-14 22:21:02 +0000313 if( EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Target/${t}/AsmPrinter/CMakeLists.txt )
Oscar Fuentes75caad42009-08-14 04:55:21 +0000314 add_subdirectory(lib/Target/${t}/AsmPrinter)
Douglas Gregor1555a232009-06-16 20:12:29 +0000315 set(LLVM_ENUM_ASM_PRINTERS
Oscar Fuentes75caad42009-08-14 04:55:21 +0000316 "${LLVM_ENUM_ASM_PRINTERS}LLVM_ASM_PRINTER(${t})\n")
317 endif( EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Target/${t}/AsmPrinter/CMakeLists.txt )
Daniel Dunbar092a9dd2009-07-17 20:42:00 +0000318 if( EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Target/${t}/AsmParser/CMakeLists.txt )
Oscar Fuentes75caad42009-08-14 04:55:21 +0000319 add_subdirectory(lib/Target/${t}/AsmParser)
Daniel Dunbar092a9dd2009-07-17 20:42:00 +0000320 set(LLVM_ENUM_ASM_PARSERS
Oscar Fuentes75caad42009-08-14 04:55:21 +0000321 "${LLVM_ENUM_ASM_PARSERS}LLVM_ASM_PARSER(${t})\n")
322 endif( EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Target/${t}/AsmParser/CMakeLists.txt )
Daniel Dunbarfa3f0b92009-11-25 04:30:13 +0000323 if( EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Target/${t}/Disassembler/CMakeLists.txt )
324 add_subdirectory(lib/Target/${t}/Disassembler)
325 set(LLVM_ENUM_DISASSEMBLERS
326 "${LLVM_ENUM_DISASSEMBLERS}LLVM_DISASSEMBLER(${t})\n")
327 endif( EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Target/${t}/Disassembler/CMakeLists.txt )
Oscar Fuentesb78829e2009-08-16 05:16:43 +0000328 set(CURRENT_LLVM_TARGET)
Oscar Fuentese1ad0872008-09-26 04:40:32 +0000329endforeach(t)
330
Douglas Gregor1555a232009-06-16 20:12:29 +0000331# Produce llvm/Config/AsmPrinters.def
332configure_file(
333 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/AsmPrinters.def.in
334 ${LLVM_BINARY_DIR}/include/llvm/Config/AsmPrinters.def
335 )
336
Daniel Dunbar092a9dd2009-07-17 20:42:00 +0000337# Produce llvm/Config/AsmParsers.def
338configure_file(
339 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/AsmParsers.def.in
340 ${LLVM_BINARY_DIR}/include/llvm/Config/AsmParsers.def
341 )
342
Daniel Dunbarfa3f0b92009-11-25 04:30:13 +0000343# Produce llvm/Config/Disassemblers.def
344configure_file(
345 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/Disassemblers.def.in
346 ${LLVM_BINARY_DIR}/include/llvm/Config/Disassemblers.def
347 )
348
Oscar Fuentes3d01fc72008-09-22 01:08:49 +0000349add_subdirectory(lib/ExecutionEngine)
350add_subdirectory(lib/ExecutionEngine/Interpreter)
351add_subdirectory(lib/ExecutionEngine/JIT)
352add_subdirectory(lib/Target)
353add_subdirectory(lib/AsmParser)
Oscar Fuentes3d01fc72008-09-22 01:08:49 +0000354add_subdirectory(lib/Archive)
355
Oscar Fuentes5c6bf652009-03-06 01:16:52 +0000356add_subdirectory(projects)
Oscar Fuentes3d01fc72008-09-22 01:08:49 +0000357
Oscar Fuentesc81f56d2009-08-16 20:56:30 +0000358option(LLVM_BUILD_TOOLS "Build LLVM tool programs." ON)
Oscar Fuentesb8352de2009-11-23 00:21:43 +0000359add_subdirectory(tools)
Oscar Fuentesc81f56d2009-08-16 20:56:30 +0000360
Daniel Dunbare1caa982009-11-18 17:42:22 +0000361option(LLVM_BUILD_EXAMPLES "Build LLVM example programs." OFF)
Oscar Fuentesb8352de2009-11-23 00:21:43 +0000362add_subdirectory(examples)
Oscar Fuentes1dc97162008-10-22 02:56:07 +0000363
Oscar Fuentes6252e982010-08-09 03:26:43 +0000364add_subdirectory(cmake/modules)
365
Oscar Fuentes1d7c43b2009-10-27 19:57:29 +0000366install(DIRECTORY include/
367 DESTINATION include
368 FILES_MATCHING
Oscar Fuentesbc2eb132009-10-30 11:42:08 +0000369 PATTERN "*.def"
Oscar Fuentes1d7c43b2009-10-27 19:57:29 +0000370 PATTERN "*.h"
371 PATTERN "*.td"
Oscar Fuentesa2281e72009-10-27 20:04:22 +0000372 PATTERN "*.inc"
Oscar Fuentes1dc97162008-10-22 02:56:07 +0000373 PATTERN ".svn" EXCLUDE
Oscar Fuentes1dc97162008-10-22 02:56:07 +0000374 )
375
Oscar Fuentes1d7c43b2009-10-27 19:57:29 +0000376install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
377 DESTINATION include
378 FILES_MATCHING
379 PATTERN "*.def"
380 PATTERN "*.h"
381 PATTERN "*.gen"
Oscar Fuentesa2281e72009-10-27 20:04:22 +0000382 PATTERN "*.inc"
Oscar Fuentes1d7c43b2009-10-27 19:57:29 +0000383 # Exclude include/llvm/CMakeFiles/intrinsics_gen.dir, matched by "*.def"
384 PATTERN "CMakeFiles" EXCLUDE
385 PATTERN ".svn" EXCLUDE
Oscar Fuentes1dc97162008-10-22 02:56:07 +0000386 )
387
388# TODO: make and install documentation.