blob: 63751d6007e8b90d31ab86e3b836f369d0a4290f [file] [log] [blame]
Oscar Fuentesfff33a32009-04-04 22:52:02 +00001# See docs/CMake.html for instructions about how to build LLVM with CMake.
2
Cedric Venet6c9f3ec2008-10-30 21:22:00 +00003project(LLVM)
Oscar Fuentes758f71a2010-08-03 15:07:17 +00004cmake_minimum_required(VERSION 2.8)
Oscar Fuentesa229b3c2008-09-22 01:08:49 +00005
Oscar Fuentes052c23c2010-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 Fuentesa229b3c2008-09-22 01:08:49 +000017set(PACKAGE_NAME llvm)
Chris Lattnerff2d99d2009-01-28 17:49:03 +000018set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
Oscar Fuentes24617b72008-10-25 03:49:35 +000019set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu")
Oscar Fuentesa229b3c2008-09-22 01:08:49 +000020
Oscar Fuentesa5f83562008-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 Fuentes61338132009-06-03 15:11:25 +000030string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
31
Oscar Fuentesa229b3c2008-09-22 01:08:49 +000032set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
Oscar Fuentes2500aae2008-10-29 02:33:15 +000033set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/include)
Oscar Fuentesa229b3c2008-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 Fuentes46fed3b2009-06-12 02:49:53 +000037set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" )
Oscar Fuentesa229b3c2008-09-22 01:08:49 +000038
Oscar Fuentes304396a2009-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 Fuentese9edc2c2008-11-10 01:47:07 +000057set(LLVM_ALL_TARGETS
58 Alpha
59 ARM
Jakob Stoklund Olesen526e8032009-08-02 17:32:37 +000060 Blackfin
Oscar Fuentese9edc2c2008-11-10 01:47:07 +000061 CBackend
62 CellSPU
63 CppBackend
Oscar Fuentese9edc2c2008-11-10 01:47:07 +000064 Mips
Wesley Peckb0578bf2010-03-05 15:15:55 +000065 MBlaze
Oscar Fuentese9edc2c2008-11-10 01:47:07 +000066 MSIL
Richard Pennington9f3bd4a2009-07-09 20:27:09 +000067 MSP430
Oscar Fuentese9edc2c2008-11-10 01:47:07 +000068 PIC16
69 PowerPC
70 Sparc
Daniel Dunbar88f35c82009-07-20 00:24:17 +000071 SystemZ
Oscar Fuentese9edc2c2008-11-10 01:47:07 +000072 X86
73 XCore
74 )
75
Oscar Fuentescdc95492008-09-26 04:40:32 +000076if( MSVC )
77 set(LLVM_TARGETS_TO_BUILD X86
Oscar Fuentese9edc2c2008-11-10 01:47:07 +000078 CACHE STRING "Semicolon-separated list of targets to build, or \"all\".")
Oscar Fuentescdc95492008-09-26 04:40:32 +000079else( MSVC )
Oscar Fuentese9edc2c2008-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 Fuentescdc95492008-09-26 04:40:32 +000082endif( MSVC )
Oscar Fuentesa229b3c2008-09-22 01:08:49 +000083
Oscar Fuentes700205c2009-11-12 06:48:09 +000084set(C_INCLUDE_DIRS "" CACHE STRING
85 "Colon separated list of directories clang will search for headers.")
86
Oscar Fuentesb9a78132009-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 Fuentes366fbb72008-11-18 23:45:21 +000090option(LLVM_ENABLE_THREADS "Use threads if available." ON)
91
Oscar Fuentes61338132009-06-03 15:11:25 +000092if( uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" )
Oscar Fuentes208a8732009-06-04 09:26:16 +000093 option(LLVM_ENABLE_ASSERTIONS "Enable assertions" OFF)
Oscar Fuentes61338132009-06-03 15:11:25 +000094else()
Oscar Fuentes208a8732009-06-04 09:26:16 +000095 option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON)
Oscar Fuentes61338132009-06-03 15:11:25 +000096endif()
97
Oscar Fuentes208a8732009-06-04 09:26:16 +000098if( LLVM_ENABLE_ASSERTIONS )
Oscar Fuentes56745312009-07-05 18:43:52 +000099 # MSVC doesn't like _DEBUG on release builds. See PR 4379.
Oscar Fuentesc296b892009-07-05 23:58:20 +0000100 if( NOT MSVC )
Oscar Fuentes56745312009-07-05 18:43:52 +0000101 add_definitions( -D_DEBUG )
102 endif()
Oscar Fuentes208a8732009-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 Fuentes61338132009-06-03 15:11:25 +0000112endif()
113
Oscar Fuentese9edc2c2008-11-10 01:47:07 +0000114if( LLVM_TARGETS_TO_BUILD STREQUAL "all" )
115 set( LLVM_TARGETS_TO_BUILD ${LLVM_ALL_TARGETS} )
116endif()
117
Douglas Gregor1b731d52009-06-16 20:12:29 +0000118set(LLVM_ENUM_TARGETS "")
Oscar Fuentese9edc2c2008-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 Greif27c7a9d2009-08-12 08:37:37 +0000122 message(FATAL_ERROR "The target `${c}' does not exist.
Oscar Fuentese9edc2c2008-11-10 01:47:07 +0000123 It should be one of\n${LLVM_ALL_TARGETS}")
Douglas Gregor1b731d52009-06-16 20:12:29 +0000124 else()
125 set(LLVM_ENUM_TARGETS "${LLVM_ENUM_TARGETS}LLVM_TARGET(${c})\n")
Oscar Fuentese9edc2c2008-11-10 01:47:07 +0000126 endif()
127endforeach(c)
128
Douglas Gregor1b731d52009-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 Fuentesa229b3c2008-09-22 01:08:49 +0000135set(llvm_builded_incs_dir ${LLVM_BINARY_DIR}/include/llvm)
136
Oscar Fuentesbda403b2009-04-04 22:41:07 +0000137include(AddLLVMDefinitions)
138
Oscar Fuentesa229b3c2008-09-22 01:08:49 +0000139if(WIN32)
Oscar Fuentes876aa172008-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 Fuentesa229b3c2008-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 Dunbar6ce1ab12009-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 Fuentesa229b3c2008-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 Fuentesa9ac9092008-10-25 03:29:36 +0000168include(config-ix)
Oscar Fuentesa229b3c2008-09-22 01:08:49 +0000169
Oscar Fuentes6d61f552009-08-18 15:29:35 +0000170option(LLVM_ENABLE_PIC "Build Position-Independent Code" ON)
Oscar Fuentes073b0b12008-11-20 19:13:51 +0000171
Douglas Gregor5f11afc2009-06-05 23:46:34 +0000172set(ENABLE_PIC 0)
Oscar Fuentes073b0b12008-11-20 19:13:51 +0000173if( LLVM_ENABLE_PIC )
Daniel Dunbar3908a402009-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 Fuentes073b0b12008-11-20 19:13:51 +0000187endif()
188
Oscar Fuentesa229b3c2008-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 Fuentesbda403b2009-04-04 22:41:07 +0000195add_llvm_definitions( -D__STDC_LIMIT_MACROS )
196add_llvm_definitions( -D__STDC_CONSTANT_MACROS )
Oscar Fuentesa229b3c2008-09-22 01:08:49 +0000197
Daniel Dunbar04433fe2009-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 Fuentes5c600b52009-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 Fuentes7751a7b2008-11-04 03:27:24 +0000208if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
209 # TODO: support other platforms and toolchains.
Oscar Fuentes32581492008-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 Fuentes7751a7b2008-11-04 03:27:24 +0000212 message(STATUS "Building 32 bits executables and libraries.")
Oscar Fuentesbda403b2009-04-04 22:41:07 +0000213 add_llvm_definitions( -m32 )
Oscar Fuentes32581492008-11-19 00:10:39 +0000214 list(APPEND CMAKE_EXE_LINKER_FLAGS -m32)
215 list(APPEND CMAKE_SHARED_LINKER_FLAGS -m32)
Oscar Fuentes32581492008-11-19 00:10:39 +0000216 endif( LLVM_BUILD_32_BITS )
Oscar Fuentes7751a7b2008-11-04 03:27:24 +0000217endif( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
218
Oscar Fuentesa229b3c2008-09-22 01:08:49 +0000219if( MSVC )
Stefanus Du Toit6b602ad2009-06-08 21:18:31 +0000220 # List of valid CRTs for MSVC
221 set(MSVC_CRT
222 MD
Oscar Fuentese5ca63a2010-03-18 13:52:05 +0000223 MDd
224 MT
225 MTd)
Stefanus Du Toit6b602ad2009-06-08 21:18:31 +0000226
227 set(LLVM_USE_CRT "" CACHE STRING "Specify VC++ CRT to use for debug/release configurations.")
Oscar Fuentes30644952010-08-02 19:00:34 +0000228 # Lets the GUI show a drop-down list of possible values, including
229 # an empty string as the default:
230 set_property(CACHE LLVM_USE_CRT PROPERTY STRINGS "";${MSVC_CRT})
Oscar Fuentesbda403b2009-04-04 22:41:07 +0000231 add_llvm_definitions( -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS )
232 add_llvm_definitions( -D_SCL_SECURE_NO_WARNINGS -DCRT_NONSTDC_NO_WARNINGS )
233 add_llvm_definitions( -D_SCL_SECURE_NO_DEPRECATE )
234 add_llvm_definitions( -wd4146 -wd4503 -wd4996 -wd4800 -wd4244 -wd4624 )
235 add_llvm_definitions( -wd4355 -wd4715 -wd4180 -wd4345 -wd4224 )
Stefanus Du Toit6b602ad2009-06-08 21:18:31 +0000236
Daniel Dunbaracd56a02009-07-19 01:35:10 +0000237 # Suppress 'new behavior: elements of array 'array' will be default initialized'
238 add_llvm_definitions( -wd4351 )
239
Stefanus Du Toit6b602ad2009-06-08 21:18:31 +0000240 if (NOT ${LLVM_USE_CRT} STREQUAL "")
241 list(FIND MSVC_CRT ${LLVM_USE_CRT} idx)
242 if (idx LESS 0)
243 message(FATAL_ERROR "Invalid value for LLVM_USE_CRT: ${LLVM_USE_CRT}. Valid options are one of: ${MSVC_CRT}")
244 endif (idx LESS 0)
245 add_llvm_definitions("/${LLVM_USE_CRT}")
246 message(STATUS "Using VC++ CRT: ${LLVM_USE_CRT}")
247 endif (NOT ${LLVM_USE_CRT} STREQUAL "")
Oscar Fuentes5c600b52009-12-01 02:21:51 +0000248
249 # Enable warnings
250 if (LLVM_ENABLE_WARNINGS)
251 add_llvm_definitions( /W4 /Wall )
252 if (LLVM_ENABLE_PEDANTIC)
253 # No MSVC equivalent available
254 endif (LLVM_ENABLE_PEDANTIC)
255 endif (LLVM_ENABLE_WARNINGS)
256 if (LLVM_ENABLE_WERROR)
257 add_llvm_definitions( /WX )
258 endif (LLVM_ENABLE_WERROR)
Oscar Fuentescc717832009-11-30 23:50:14 +0000259elseif( CMAKE_COMPILER_IS_GNUCXX )
Oscar Fuentes5c600b52009-12-01 02:21:51 +0000260 if (LLVM_ENABLE_WARNINGS)
261 add_llvm_definitions( -Wall -W -Wno-unused-parameter -Wwrite-strings )
262 if (LLVM_ENABLE_PEDANTIC)
263 add_llvm_definitions( -pedantic -Wno-long-long )
264 endif (LLVM_ENABLE_PEDANTIC)
265 endif (LLVM_ENABLE_WARNINGS)
266 if (LLVM_ENABLE_WERROR)
267 add_llvm_definitions( -Werror )
268 endif (LLVM_ENABLE_WERROR)
Oscar Fuentesa229b3c2008-09-22 01:08:49 +0000269endif( MSVC )
270
Oscar Fuentes2500aae2008-10-29 02:33:15 +0000271include_directories( ${LLVM_BINARY_DIR}/include ${LLVM_MAIN_INCLUDE_DIR})
Oscar Fuentesa229b3c2008-09-22 01:08:49 +0000272
Edward O'Callaghan396ed2b2009-10-12 04:00:11 +0000273if( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )
274 SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-include llvm/System/Solaris.h")
275endif( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )
276
Oscar Fuentesa229b3c2008-09-22 01:08:49 +0000277include(AddLLVM)
Oscar Fuentescdc95492008-09-26 04:40:32 +0000278include(TableGen)
Oscar Fuentesa229b3c2008-09-22 01:08:49 +0000279
280add_subdirectory(lib/Support)
281add_subdirectory(lib/System)
Oscar Fuentes8807bdd2008-09-22 18:21:51 +0000282
283# Everything else depends on Support and System:
284set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} ${LLVM_LIBS} )
285
Oscar Fuentesb45a43a2008-11-09 18:53:19 +0000286set(LLVM_TABLEGEN "tblgen" CACHE
Oscar Fuentes9530edd2008-11-10 02:35:55 +0000287 STRING "Native TableGen executable. Saves building one when cross-compiling.")
Oscar Fuentescaa7a942009-06-11 04:16:10 +0000288# Effective tblgen executable to be used:
289set(LLVM_TABLEGEN_EXE ${LLVM_TABLEGEN})
Oscar Fuentesb45a43a2008-11-09 18:53:19 +0000290
Oscar Fuentese352ca02008-11-10 01:32:14 +0000291add_subdirectory(utils/TableGen)
292
Oscar Fuentesb45a43a2008-11-09 18:53:19 +0000293if( CMAKE_CROSSCOMPILING )
Oscar Fuentese352ca02008-11-10 01:32:14 +0000294 # This adds a dependency on target `tblgen', so must go after utils/TableGen
Oscar Fuentesb45a43a2008-11-09 18:53:19 +0000295 include( CrossCompileLLVM )
296endif( CMAKE_CROSSCOMPILING )
297
Oscar Fuentesdc8d56e2008-11-15 00:24:38 +0000298add_subdirectory(include/llvm)
Oscar Fuentes8807bdd2008-09-22 18:21:51 +0000299
Oscar Fuentesa229b3c2008-09-22 01:08:49 +0000300add_subdirectory(lib/VMCore)
301add_subdirectory(lib/CodeGen)
302add_subdirectory(lib/CodeGen/SelectionDAG)
303add_subdirectory(lib/CodeGen/AsmPrinter)
304add_subdirectory(lib/Bitcode/Reader)
305add_subdirectory(lib/Bitcode/Writer)
306add_subdirectory(lib/Transforms/Utils)
307add_subdirectory(lib/Transforms/Instrumentation)
Douglas Gregor5b88b8a2010-01-04 21:58:55 +0000308add_subdirectory(lib/Transforms/InstCombine)
Oscar Fuentesa229b3c2008-09-22 01:08:49 +0000309add_subdirectory(lib/Transforms/Scalar)
310add_subdirectory(lib/Transforms/IPO)
311add_subdirectory(lib/Transforms/Hello)
312add_subdirectory(lib/Linker)
313add_subdirectory(lib/Analysis)
314add_subdirectory(lib/Analysis/IPA)
Daniel Dunbarca29e4d2009-06-23 22:01:43 +0000315add_subdirectory(lib/MC)
Daniel Dunbar4dcd3b22010-01-22 02:04:33 +0000316add_subdirectory(lib/MC/MCParser)
Chris Lattner979634b2010-07-20 18:25:19 +0000317add_subdirectory(lib/MC/MCDisassembler)
Daniel Dunbar28830b32009-09-22 07:38:44 +0000318add_subdirectory(test)
Oscar Fuentescdc95492008-09-26 04:40:32 +0000319
Douglas Gregor289dfc52009-07-20 18:30:25 +0000320add_subdirectory(utils/FileCheck)
Daniel Dunbar00dd4482009-09-24 06:23:57 +0000321add_subdirectory(utils/count)
322add_subdirectory(utils/not)
Douglas Gregor289dfc52009-07-20 18:30:25 +0000323
Oscar Fuentes7a87d662009-08-14 04:55:21 +0000324set(LLVM_ENUM_ASM_PRINTERS "")
325set(LLVM_ENUM_ASM_PARSERS "")
Daniel Dunbarf4721292009-11-25 04:30:13 +0000326set(LLVM_ENUM_DISASSEMBLERS "")
Oscar Fuentes7a87d662009-08-14 04:55:21 +0000327foreach(t ${LLVM_TARGETS_TO_BUILD})
Oscar Fuentescdc95492008-09-26 04:40:32 +0000328 message(STATUS "Targeting ${t}")
329 add_subdirectory(lib/Target/${t})
Daniel Dunbarb3ec4882009-07-15 07:04:27 +0000330 add_subdirectory(lib/Target/${t}/TargetInfo)
Oscar Fuentes070114f2008-11-14 22:21:02 +0000331 if( EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Target/${t}/AsmPrinter/CMakeLists.txt )
Oscar Fuentes7a87d662009-08-14 04:55:21 +0000332 add_subdirectory(lib/Target/${t}/AsmPrinter)
Douglas Gregor1b731d52009-06-16 20:12:29 +0000333 set(LLVM_ENUM_ASM_PRINTERS
Oscar Fuentes7a87d662009-08-14 04:55:21 +0000334 "${LLVM_ENUM_ASM_PRINTERS}LLVM_ASM_PRINTER(${t})\n")
335 endif( EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Target/${t}/AsmPrinter/CMakeLists.txt )
Daniel Dunbar71475772009-07-17 20:42:00 +0000336 if( EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Target/${t}/AsmParser/CMakeLists.txt )
Oscar Fuentes7a87d662009-08-14 04:55:21 +0000337 add_subdirectory(lib/Target/${t}/AsmParser)
Daniel Dunbar71475772009-07-17 20:42:00 +0000338 set(LLVM_ENUM_ASM_PARSERS
Oscar Fuentes7a87d662009-08-14 04:55:21 +0000339 "${LLVM_ENUM_ASM_PARSERS}LLVM_ASM_PARSER(${t})\n")
340 endif( EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Target/${t}/AsmParser/CMakeLists.txt )
Daniel Dunbarf4721292009-11-25 04:30:13 +0000341 if( EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Target/${t}/Disassembler/CMakeLists.txt )
342 add_subdirectory(lib/Target/${t}/Disassembler)
343 set(LLVM_ENUM_DISASSEMBLERS
344 "${LLVM_ENUM_DISASSEMBLERS}LLVM_DISASSEMBLER(${t})\n")
345 endif( EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Target/${t}/Disassembler/CMakeLists.txt )
Oscar Fuentes8160d282009-08-16 05:16:43 +0000346 set(CURRENT_LLVM_TARGET)
Oscar Fuentescdc95492008-09-26 04:40:32 +0000347endforeach(t)
348
Douglas Gregor1b731d52009-06-16 20:12:29 +0000349# Produce llvm/Config/AsmPrinters.def
350configure_file(
351 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/AsmPrinters.def.in
352 ${LLVM_BINARY_DIR}/include/llvm/Config/AsmPrinters.def
353 )
354
Daniel Dunbar71475772009-07-17 20:42:00 +0000355# Produce llvm/Config/AsmParsers.def
356configure_file(
357 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/AsmParsers.def.in
358 ${LLVM_BINARY_DIR}/include/llvm/Config/AsmParsers.def
359 )
360
Daniel Dunbarf4721292009-11-25 04:30:13 +0000361# Produce llvm/Config/Disassemblers.def
362configure_file(
363 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/Disassemblers.def.in
364 ${LLVM_BINARY_DIR}/include/llvm/Config/Disassemblers.def
365 )
366
Oscar Fuentesa229b3c2008-09-22 01:08:49 +0000367add_subdirectory(lib/ExecutionEngine)
368add_subdirectory(lib/ExecutionEngine/Interpreter)
369add_subdirectory(lib/ExecutionEngine/JIT)
370add_subdirectory(lib/Target)
371add_subdirectory(lib/AsmParser)
Oscar Fuentesa229b3c2008-09-22 01:08:49 +0000372add_subdirectory(lib/Archive)
373
Oscar Fuentesafbe9752009-03-06 01:16:52 +0000374add_subdirectory(projects)
Oscar Fuentesa229b3c2008-09-22 01:08:49 +0000375
Oscar Fuentesacfd9ad2009-08-16 20:56:30 +0000376option(LLVM_BUILD_TOOLS "Build LLVM tool programs." ON)
Oscar Fuentes0c2443a2009-11-23 00:21:43 +0000377add_subdirectory(tools)
Oscar Fuentesacfd9ad2009-08-16 20:56:30 +0000378
Daniel Dunbar06d8c242009-11-18 17:42:22 +0000379option(LLVM_BUILD_EXAMPLES "Build LLVM example programs." OFF)
Oscar Fuentes0c2443a2009-11-23 00:21:43 +0000380add_subdirectory(examples)
Oscar Fuentes64c99622008-10-22 02:56:07 +0000381
Oscar Fuentes6997c642009-10-27 19:57:29 +0000382install(DIRECTORY include/
383 DESTINATION include
384 FILES_MATCHING
Oscar Fuentes15716f62009-10-30 11:42:08 +0000385 PATTERN "*.def"
Oscar Fuentes6997c642009-10-27 19:57:29 +0000386 PATTERN "*.h"
387 PATTERN "*.td"
Oscar Fuentes08875d12009-10-27 20:04:22 +0000388 PATTERN "*.inc"
Oscar Fuentes64c99622008-10-22 02:56:07 +0000389 PATTERN ".svn" EXCLUDE
Oscar Fuentes64c99622008-10-22 02:56:07 +0000390 )
391
Oscar Fuentes6997c642009-10-27 19:57:29 +0000392install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
393 DESTINATION include
394 FILES_MATCHING
395 PATTERN "*.def"
396 PATTERN "*.h"
397 PATTERN "*.gen"
Oscar Fuentes08875d12009-10-27 20:04:22 +0000398 PATTERN "*.inc"
Oscar Fuentes6997c642009-10-27 19:57:29 +0000399 # Exclude include/llvm/CMakeFiles/intrinsics_gen.dir, matched by "*.def"
400 PATTERN "CMakeFiles" EXCLUDE
401 PATTERN ".svn" EXCLUDE
Oscar Fuentes64c99622008-10-22 02:56:07 +0000402 )
403
404# TODO: make and install documentation.