Oscar Fuentes | fff33a3 | 2009-04-04 22:52:02 +0000 | [diff] [blame] | 1 | # See docs/CMake.html for instructions about how to build LLVM with CMake. |
| 2 | |
Cedric Venet | 6c9f3ec | 2008-10-30 21:22:00 +0000 | [diff] [blame] | 3 | project(LLVM) |
Tim Northover | 1c82f3e | 2013-02-18 11:53:37 +0000 | [diff] [blame] | 4 | cmake_minimum_required(VERSION 2.8) |
Oscar Fuentes | a229b3c | 2008-09-22 01:08:49 +0000 | [diff] [blame] | 5 | |
Oscar Fuentes | 052c23c | 2010-08-03 17:28:09 +0000 | [diff] [blame] | 6 | # Add path for custom modules |
| 7 | set(CMAKE_MODULE_PATH |
| 8 | ${CMAKE_MODULE_PATH} |
| 9 | "${CMAKE_CURRENT_SOURCE_DIR}/cmake" |
| 10 | "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" |
| 11 | ) |
| 12 | |
Dylan Noblesmith | c6c7a58 | 2012-02-13 18:48:10 +0000 | [diff] [blame] | 13 | set(LLVM_VERSION_MAJOR 3) |
NAKAMURA Takumi | a5997c4 | 2013-11-20 13:11:48 +0000 | [diff] [blame] | 14 | set(LLVM_VERSION_MINOR 5) |
Dylan Noblesmith | c6c7a58 | 2012-02-13 18:48:10 +0000 | [diff] [blame] | 15 | |
Hans Wennborg | 09d108b | 2013-11-21 22:47:21 +0000 | [diff] [blame] | 16 | if (NOT PACKAGE_VERSION) |
| 17 | set(PACKAGE_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}svn") |
| 18 | endif() |
Oscar Fuentes | 7064035 | 2010-12-20 09:47:13 +0000 | [diff] [blame] | 19 | |
Hans Wennborg | 1654627 | 2013-08-24 00:20:36 +0000 | [diff] [blame] | 20 | option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF) |
| 21 | |
Manuel Klimek | 13cfa00 | 2012-05-09 15:10:54 +0000 | [diff] [blame] | 22 | option(LLVM_USE_FOLDERS "Enable solution folders in Visual Studio. Disable for Express versions." ON) |
| 23 | if ( LLVM_USE_FOLDERS ) |
| 24 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) |
| 25 | endif() |
Oscar Fuentes | 3145e92 | 2011-02-20 22:06:10 +0000 | [diff] [blame] | 26 | |
Oscar Fuentes | 052c23c | 2010-08-03 17:28:09 +0000 | [diff] [blame] | 27 | include(VersionFromVCS) |
Oscar Fuentes | 7064035 | 2010-12-20 09:47:13 +0000 | [diff] [blame] | 28 | |
| 29 | option(LLVM_APPEND_VC_REV |
| 30 | "Append the version control system revision id to LLVM version" OFF) |
| 31 | |
| 32 | if( LLVM_APPEND_VC_REV ) |
| 33 | add_version_info_from_vcs(PACKAGE_VERSION) |
| 34 | endif() |
Oscar Fuentes | 052c23c | 2010-08-03 17:28:09 +0000 | [diff] [blame] | 35 | |
Dylan Noblesmith | 67c4970 | 2011-12-18 18:50:16 +0000 | [diff] [blame] | 36 | set(PACKAGE_NAME LLVM) |
Chris Lattner | ff2d99d | 2009-01-28 17:49:03 +0000 | [diff] [blame] | 37 | set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") |
Dylan Noblesmith | 67c4970 | 2011-12-18 18:50:16 +0000 | [diff] [blame] | 38 | set(PACKAGE_BUGREPORT "http://llvm.org/bugs/") |
Oscar Fuentes | a229b3c | 2008-09-22 01:08:49 +0000 | [diff] [blame] | 39 | |
Reid Kleckner | c974f09 | 2013-08-29 22:09:43 +0000 | [diff] [blame] | 40 | # Configure CPack. |
Hans Wennborg | 09d108b | 2013-11-21 22:47:21 +0000 | [diff] [blame] | 41 | set(CPACK_PACKAGE_INSTALL_DIRECTORY "LLVM") |
Reid Kleckner | c974f09 | 2013-08-29 22:09:43 +0000 | [diff] [blame] | 42 | set(CPACK_PACKAGE_VENDOR "LLVM") |
| 43 | set(CPACK_PACKAGE_VERSION_MAJOR ${LLVM_VERSION_MAJOR}) |
| 44 | set(CPACK_PACKAGE_VERSION_MINOR ${LLVM_VERSION_MINOR}) |
Hans Wennborg | 09d108b | 2013-11-21 22:47:21 +0000 | [diff] [blame] | 45 | set(CPACK_PACKAGE_VERSION ${PACKAGE_VERSION}) |
Reid Kleckner | c974f09 | 2013-08-29 22:09:43 +0000 | [diff] [blame] | 46 | set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.TXT") |
| 47 | if(WIN32 AND NOT UNIX) |
Hans Wennborg | 09d108b | 2013-11-21 22:47:21 +0000 | [diff] [blame] | 48 | set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "LLVM") |
Reid Kleckner | c974f09 | 2013-08-29 22:09:43 +0000 | [diff] [blame] | 49 | set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\cmake\\\\nsis_logo.bmp") |
| 50 | set(CPACK_NSIS_MODIFY_PATH "ON") |
| 51 | set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON") |
| 52 | set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS |
| 53 | "ExecWait '$INSTDIR/tools/msbuild/install.bat'") |
| 54 | set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS |
| 55 | "ExecWait '$INSTDIR/tools/msbuild/uninstall.bat'") |
| 56 | endif() |
| 57 | include(CPack) |
| 58 | |
Daniel Dunbar | ad3946a | 2011-11-04 19:04:39 +0000 | [diff] [blame] | 59 | # Sanity check our source directory to make sure that we are not trying to |
| 60 | # generate an in-tree build (unless on MSVC_IDE, where it is ok), and to make |
| 61 | # sure that we don't have any stray generated files lying around in the tree |
| 62 | # (which would end up getting picked up by header search, instead of the correct |
| 63 | # versions). |
Oscar Fuentes | a5f8356 | 2008-11-14 03:43:18 +0000 | [diff] [blame] | 64 | if( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE ) |
| 65 | message(FATAL_ERROR "In-source builds are not allowed. |
| 66 | CMake would overwrite the makefiles distributed with LLVM. |
| 67 | Please create a directory and run cmake from there, passing the path |
| 68 | to this source directory as the last argument. |
| 69 | This process created the file `CMakeCache.txt' and the directory `CMakeFiles'. |
| 70 | Please delete them.") |
| 71 | endif() |
Daniel Dunbar | ad3946a | 2011-11-04 19:04:39 +0000 | [diff] [blame] | 72 | if( NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR ) |
| 73 | file(GLOB_RECURSE |
| 74 | tablegenned_files_on_include_dir |
| 75 | "${CMAKE_CURRENT_SOURCE_DIR}/include/llvm/*.gen") |
| 76 | file(GLOB_RECURSE |
| 77 | tablegenned_files_on_lib_dir |
| 78 | "${CMAKE_CURRENT_SOURCE_DIR}/lib/Target/*.inc") |
| 79 | if( tablegenned_files_on_include_dir OR tablegenned_files_on_lib_dir) |
| 80 | message(FATAL_ERROR "Apparently there is a previous in-source build, |
| 81 | probably as the result of running `configure' and `make' on |
| 82 | ${CMAKE_CURRENT_SOURCE_DIR}. |
| 83 | This may cause problems. The suspicious files are: |
| 84 | ${tablegenned_files_on_lib_dir} |
| 85 | ${tablegenned_files_on_include_dir} |
| 86 | Please clean the source directory.") |
| 87 | endif() |
| 88 | endif() |
Oscar Fuentes | a5f8356 | 2008-11-14 03:43:18 +0000 | [diff] [blame] | 89 | |
Oscar Fuentes | 6133813 | 2009-06-03 15:11:25 +0000 | [diff] [blame] | 90 | string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE) |
| 91 | |
Oscar Fuentes | a229b3c | 2008-09-22 01:08:49 +0000 | [diff] [blame] | 92 | set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}) |
Oscar Fuentes | 2500aae | 2008-10-29 02:33:15 +0000 | [diff] [blame] | 93 | set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/include) |
Oscar Fuentes | a229b3c | 2008-09-22 01:08:49 +0000 | [diff] [blame] | 94 | set(LLVM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) |
| 95 | set(LLVM_TOOLS_BINARY_DIR ${LLVM_BINARY_DIR}/bin) |
| 96 | set(LLVM_EXAMPLES_BINARY_DIR ${LLVM_BINARY_DIR}/examples) |
NAKAMURA Takumi | 03932fb | 2013-12-16 15:05:39 +0000 | [diff] [blame^] | 97 | set(LLVM_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include) |
Oscar Fuentes | 46fed3b | 2009-06-12 02:49:53 +0000 | [diff] [blame] | 98 | set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" ) |
Oscar Fuentes | a229b3c | 2008-09-22 01:08:49 +0000 | [diff] [blame] | 99 | |
Oscar Fuentes | e9edc2c | 2008-11-10 01:47:07 +0000 | [diff] [blame] | 100 | set(LLVM_ALL_TARGETS |
Tim Northover | 43852f2 | 2013-02-04 12:32:21 +0000 | [diff] [blame] | 101 | AArch64 |
Oscar Fuentes | e9edc2c | 2008-11-10 01:47:07 +0000 | [diff] [blame] | 102 | ARM |
Oscar Fuentes | e9edc2c | 2008-11-10 01:47:07 +0000 | [diff] [blame] | 103 | CppBackend |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 104 | Hexagon |
Oscar Fuentes | e9edc2c | 2008-11-10 01:47:07 +0000 | [diff] [blame] | 105 | Mips |
Richard Pennington | 9f3bd4a | 2009-07-09 20:27:09 +0000 | [diff] [blame] | 106 | MSP430 |
Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 107 | NVPTX |
Oscar Fuentes | e9edc2c | 2008-11-10 01:47:07 +0000 | [diff] [blame] | 108 | PowerPC |
Rafael Espindola | f6474d2 | 2013-05-22 00:35:47 +0000 | [diff] [blame] | 109 | R600 |
Oscar Fuentes | e9edc2c | 2008-11-10 01:47:07 +0000 | [diff] [blame] | 110 | Sparc |
Ulrich Weigand | 92b2085 | 2013-05-06 16:23:07 +0000 | [diff] [blame] | 111 | SystemZ |
Oscar Fuentes | e9edc2c | 2008-11-10 01:47:07 +0000 | [diff] [blame] | 112 | X86 |
| 113 | XCore |
| 114 | ) |
| 115 | |
Oscar Fuentes | 465f936 | 2011-03-23 17:42:13 +0000 | [diff] [blame] | 116 | # List of targets with JIT support: |
Tim Northover | c17f3f7 | 2013-05-19 19:44:56 +0000 | [diff] [blame] | 117 | set(LLVM_TARGETS_WITH_JIT X86 PowerPC AArch64 ARM Mips SystemZ) |
Oscar Fuentes | 465f936 | 2011-03-23 17:42:13 +0000 | [diff] [blame] | 118 | |
Tim Northover | 865f4bc | 2013-04-15 11:53:05 +0000 | [diff] [blame] | 119 | set(LLVM_TARGETS_TO_BUILD "all" |
Oscar Fuentes | e9edc2c | 2008-11-10 01:47:07 +0000 | [diff] [blame] | 120 | CACHE STRING "Semicolon-separated list of targets to build, or \"all\".") |
Oscar Fuentes | a229b3c | 2008-09-22 01:08:49 +0000 | [diff] [blame] | 121 | |
Victor Oliveira | 9d4b8f5 | 2012-08-09 01:13:59 +0000 | [diff] [blame] | 122 | set(LLVM_EXPERIMENTAL_TARGETS_TO_BUILD "" |
| 123 | CACHE STRING "Semicolon-separated list of experimental targets to build.") |
| 124 | |
Dylan Noblesmith | af9be0b | 2012-02-01 14:49:39 +0000 | [diff] [blame] | 125 | option(BUILD_SHARED_LIBS |
| 126 | "Build all libraries as shared libraries instead of static" OFF) |
| 127 | |
Oscar Fuentes | c8cb58e | 2011-01-11 12:31:54 +0000 | [diff] [blame] | 128 | option(LLVM_ENABLE_CBE_PRINTF_A "Set to ON if CBE is enabled for printf %a output" ON) |
| 129 | if(LLVM_ENABLE_CBE_PRINTF_A) |
| 130 | set(ENABLE_CBE_PRINTF_A 1) |
| 131 | endif() |
| 132 | |
| 133 | option(LLVM_ENABLE_TIMESTAMPS "Enable embedding timestamp information in build" ON) |
| 134 | if(LLVM_ENABLE_TIMESTAMPS) |
| 135 | set(ENABLE_TIMESTAMPS 1) |
| 136 | endif() |
| 137 | |
Benjamin Kramer | 5651cbd | 2012-09-28 10:10:46 +0000 | [diff] [blame] | 138 | option(LLVM_ENABLE_BACKTRACES "Enable embedding backtraces on crash." ON) |
| 139 | if(LLVM_ENABLE_BACKTRACES) |
| 140 | set(ENABLE_BACKTRACES 1) |
| 141 | endif() |
| 142 | |
Daniel Dunbar | eb6c708 | 2013-08-30 20:39:21 +0000 | [diff] [blame] | 143 | option(LLVM_ENABLE_CRASH_OVERRIDES "Enable crash overrides." ON) |
| 144 | if(LLVM_ENABLE_CRASH_OVERRIDES) |
| 145 | set(ENABLE_CRASH_OVERRIDES 1) |
| 146 | endif() |
| 147 | |
Oscar Fuentes | 6495595 | 2011-01-21 15:42:54 +0000 | [diff] [blame] | 148 | option(LLVM_ENABLE_FFI "Use libffi to call external functions from the interpreter" OFF) |
| 149 | set(FFI_LIBRARY_DIR "" CACHE PATH "Additional directory, where CMake should search for libffi.so") |
| 150 | set(FFI_INCLUDE_DIR "" CACHE PATH "Additional directory, where CMake should search for ffi.h or ffi/ffi.h") |
| 151 | |
Sebastian Pop | 82622dc | 2012-08-08 18:04:45 +0000 | [diff] [blame] | 152 | set(LLVM_TARGET_ARCH "host" |
| 153 | CACHE STRING "Set target to use for LLVM JIT or use \"host\" for automatic detection.") |
Oscar Fuentes | b9a7813 | 2009-09-13 22:18:38 +0000 | [diff] [blame] | 154 | |
Chandler Carruth | f11f1e4 | 2013-08-12 09:49:17 +0000 | [diff] [blame] | 155 | option(LLVM_ENABLE_TERMINFO "Use terminfo database if available." ON) |
Chandler Carruth | cad7e5e | 2013-08-07 08:47:36 +0000 | [diff] [blame] | 156 | |
Oscar Fuentes | 366fbb7 | 2008-11-18 23:45:21 +0000 | [diff] [blame] | 157 | option(LLVM_ENABLE_THREADS "Use threads if available." ON) |
| 158 | |
Alexey Samsonov | 2fb337e | 2013-04-23 08:28:39 +0000 | [diff] [blame] | 159 | option(LLVM_ENABLE_ZLIB "Use zlib for compression/decompression if available." ON) |
| 160 | |
Oscar Fuentes | e9edc2c | 2008-11-10 01:47:07 +0000 | [diff] [blame] | 161 | if( LLVM_TARGETS_TO_BUILD STREQUAL "all" ) |
| 162 | set( LLVM_TARGETS_TO_BUILD ${LLVM_ALL_TARGETS} ) |
| 163 | endif() |
| 164 | |
Victor Oliveira | 18023e4 | 2012-08-15 22:35:36 +0000 | [diff] [blame] | 165 | set(LLVM_TARGETS_TO_BUILD |
| 166 | ${LLVM_TARGETS_TO_BUILD} |
| 167 | ${LLVM_EXPERIMENTAL_TARGETS_TO_BUILD}) |
Rafael Espindola | cf1e657 | 2013-05-22 02:45:28 +0000 | [diff] [blame] | 168 | list(REMOVE_DUPLICATES LLVM_TARGETS_TO_BUILD) |
Victor Oliveira | 18023e4 | 2012-08-15 22:35:36 +0000 | [diff] [blame] | 169 | |
Oscar Fuentes | bda403b | 2009-04-04 22:41:07 +0000 | [diff] [blame] | 170 | include(AddLLVMDefinitions) |
| 171 | |
Oscar Fuentes | 6d61f55 | 2009-08-18 15:29:35 +0000 | [diff] [blame] | 172 | option(LLVM_ENABLE_PIC "Build Position-Independent Code" ON) |
Oscar Fuentes | 073b0b1 | 2008-11-20 19:13:51 +0000 | [diff] [blame] | 173 | |
Oscar Fuentes | 1276e32 | 2011-03-01 22:31:19 +0000 | [diff] [blame] | 174 | # MSVC has a gazillion warnings with this. |
| 175 | if( MSVC ) |
| 176 | option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." OFF) |
| 177 | else( MSVC ) |
| 178 | option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON) |
| 179 | endif() |
Oscar Fuentes | f4202ba | 2011-02-03 20:57:36 +0000 | [diff] [blame] | 180 | |
Arnaud A. de Grandmaison | b697b53 | 2013-11-26 10:33:53 +0000 | [diff] [blame] | 181 | option(LLVM_ENABLE_CXX11 "Compile with C++11 enabled." OFF) |
Oscar Fuentes | 1276e32 | 2011-03-01 22:31:19 +0000 | [diff] [blame] | 182 | option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON) |
| 183 | option(LLVM_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF) |
Oscar Fuentes | f4202ba | 2011-02-03 20:57:36 +0000 | [diff] [blame] | 184 | |
Duncan Sands | 80f122f | 2013-07-17 09:34:51 +0000 | [diff] [blame] | 185 | if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" ) |
Oscar Fuentes | f4202ba | 2011-02-03 20:57:36 +0000 | [diff] [blame] | 186 | option(LLVM_ENABLE_ASSERTIONS "Enable assertions" OFF) |
| 187 | else() |
| 188 | option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON) |
Oscar Fuentes | 073b0b1 | 2008-11-20 19:13:51 +0000 | [diff] [blame] | 189 | endif() |
| 190 | |
Eli Bendersky | 5262ad2 | 2012-03-13 08:33:15 +0000 | [diff] [blame] | 191 | option(LLVM_USE_INTEL_JITEVENTS |
| 192 | "Use Intel JIT API to inform Intel(R) VTune(TM) Amplifier XE 2011 about JIT code" |
| 193 | OFF) |
| 194 | |
| 195 | if( LLVM_USE_INTEL_JITEVENTS ) |
| 196 | # Verify we are on a supported platform |
Andrew Kaylor | 5808c7d | 2012-09-28 17:35:20 +0000 | [diff] [blame] | 197 | if( NOT CMAKE_SYSTEM_NAME MATCHES "Windows" AND NOT CMAKE_SYSTEM_NAME MATCHES "Linux" ) |
Eli Bendersky | 5262ad2 | 2012-03-13 08:33:15 +0000 | [diff] [blame] | 198 | message(FATAL_ERROR |
| 199 | "Intel JIT API support is available on Linux and Windows only.") |
| 200 | endif() |
| 201 | endif( LLVM_USE_INTEL_JITEVENTS ) |
| 202 | |
| 203 | option(LLVM_USE_OPROFILE |
| 204 | "Use opagent JIT interface to inform OProfile about JIT code" OFF) |
| 205 | |
Joel Jones | 54594f2 | 2012-12-13 15:25:07 +0000 | [diff] [blame] | 206 | # If enabled, verify we are on a platform that supports oprofile. |
Eli Bendersky | 5262ad2 | 2012-03-13 08:33:15 +0000 | [diff] [blame] | 207 | if( LLVM_USE_OPROFILE ) |
| 208 | if( NOT CMAKE_SYSTEM_NAME MATCHES "Linux" ) |
| 209 | message(FATAL_ERROR "OProfile support is available on Linux only.") |
| 210 | endif( NOT CMAKE_SYSTEM_NAME MATCHES "Linux" ) |
| 211 | endif( LLVM_USE_OPROFILE ) |
| 212 | |
Alexey Samsonov | 75789a2 | 2013-03-26 07:49:46 +0000 | [diff] [blame] | 213 | set(LLVM_USE_SANITIZER "" CACHE STRING |
| 214 | "Define the sanitizer used to build binaries and tests.") |
| 215 | |
Eric Christopher | 3987806 | 2013-07-30 21:44:10 +0000 | [diff] [blame] | 216 | option(LLVM_USE_SPLIT_DWARF |
| 217 | "Use -gsplit-dwarf when compiling llvm." OFF) |
| 218 | |
Daniel Dunbar | 10fa2df | 2011-11-04 19:04:35 +0000 | [diff] [blame] | 219 | # Define an option controlling whether we should build for 32-bit on 64-bit |
| 220 | # platforms, where supported. |
| 221 | if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 ) |
| 222 | # TODO: support other platforms and toolchains. |
| 223 | option(LLVM_BUILD_32_BITS "Build 32 bits executables and libraries." OFF) |
| 224 | endif() |
| 225 | |
Daniel Dunbar | 10fa2df | 2011-11-04 19:04:35 +0000 | [diff] [blame] | 226 | # Define the default arguments to use with 'lit', and an option for the user to |
| 227 | # override. |
| 228 | set(LIT_ARGS_DEFAULT "-sv") |
| 229 | if (MSVC OR XCODE) |
| 230 | set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar") |
| 231 | endif() |
| 232 | set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit") |
| 233 | |
NAKAMURA Takumi | ba330ae | 2011-12-11 03:07:53 +0000 | [diff] [blame] | 234 | # On Win32 hosts, provide an option to specify the path to the GnuWin32 tools. |
| 235 | if( WIN32 AND NOT CYGWIN ) |
Daniel Dunbar | 10fa2df | 2011-11-04 19:04:35 +0000 | [diff] [blame] | 236 | set(LLVM_LIT_TOOLS_DIR "" CACHE PATH "Path to GnuWin32 tools") |
| 237 | endif() |
| 238 | |
Daniel Dunbar | 511e296 | 2011-11-04 19:04:37 +0000 | [diff] [blame] | 239 | # Define options to control the inclusion and default build behavior for |
Chandler Carruth | ea56494 | 2013-10-02 15:42:23 +0000 | [diff] [blame] | 240 | # components which may not strictly be necessary (tools, examples, and tests). |
Daniel Dunbar | 511e296 | 2011-11-04 19:04:37 +0000 | [diff] [blame] | 241 | # |
| 242 | # This is primarily to support building smaller or faster project files. |
| 243 | option(LLVM_INCLUDE_TOOLS "Generate build targets for the LLVM tools." ON) |
| 244 | option(LLVM_BUILD_TOOLS |
| 245 | "Build the LLVM tools. If OFF, just generate build targets." ON) |
| 246 | |
Alexey Samsonov | 693e1a5 | 2013-10-04 10:41:38 +0000 | [diff] [blame] | 247 | option(LLVM_BUILD_RUNTIME |
| 248 | "Build the LLVM runtime libraries." ON) |
Daniel Dunbar | 511e296 | 2011-11-04 19:04:37 +0000 | [diff] [blame] | 249 | option(LLVM_BUILD_EXAMPLES |
| 250 | "Build the LLVM example programs. If OFF, just generate build targets." OFF) |
| 251 | option(LLVM_INCLUDE_EXAMPLES "Generate build targets for the LLVM examples" ON) |
| 252 | |
| 253 | option(LLVM_BUILD_TESTS |
| 254 | "Build LLVM unit tests. If OFF, just generate build targets." OFF) |
| 255 | option(LLVM_INCLUDE_TESTS "Generate build targets for the LLVM unit tests." ON) |
| 256 | |
Michael Gottesman | 4d35b90 | 2013-08-24 07:25:21 +0000 | [diff] [blame] | 257 | option (LLVM_BUILD_DOCS "Build the llvm documentation." OFF) |
| 258 | option (LLVM_INCLUDE_DOCS "Generate build targets for llvm documentation." ON) |
| 259 | option (LLVM_ENABLE_DOXYGEN "Use doxygen to generate llvm documentation." OFF) |
| 260 | |
Chris Lattner | 0ab5e2c | 2011-04-15 05:18:47 +0000 | [diff] [blame] | 261 | # All options referred to from HandleLLVMOptions have to be specified |
Oscar Fuentes | 1276e32 | 2011-03-01 22:31:19 +0000 | [diff] [blame] | 262 | # BEFORE this include, otherwise options will not be correctly set on |
| 263 | # first cmake run |
| 264 | include(config-ix) |
Sebastian Pop | faeca29 | 2012-08-20 19:56:52 +0000 | [diff] [blame] | 265 | |
| 266 | # By default, we target the host, but this can be overridden at CMake |
| 267 | # invocation time. |
| 268 | set(LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_HOST_TRIPLE}" CACHE STRING |
| 269 | "Default target for which LLVM will generate code." ) |
NAKAMURA Takumi | f9573f1 | 2012-12-10 07:14:29 +0000 | [diff] [blame] | 270 | set(TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}") |
Sebastian Pop | faeca29 | 2012-08-20 19:56:52 +0000 | [diff] [blame] | 271 | |
Oscar Fuentes | 1276e32 | 2011-03-01 22:31:19 +0000 | [diff] [blame] | 272 | include(HandleLLVMOptions) |
| 273 | |
Reid Kleckner | 63784ba | 2013-06-24 13:21:16 +0000 | [diff] [blame] | 274 | # Verify that we can find a Python 2 interpreter. Python 3 is unsupported. |
Bill Wendling | 8edd8f9 | 2013-10-28 21:22:23 +0000 | [diff] [blame] | 275 | set(Python_ADDITIONAL_VERSIONS 2.7 2.6 2.5) |
Daniel Dunbar | 21079ca | 2011-11-04 23:04:05 +0000 | [diff] [blame] | 276 | include(FindPythonInterp) |
| 277 | if( NOT PYTHONINTERP_FOUND ) |
| 278 | message(FATAL_ERROR |
| 279 | "Unable to find Python interpreter, required for builds and testing. |
| 280 | |
| 281 | Please install Python or specify the PYTHON_EXECUTABLE CMake variable.") |
| 282 | endif() |
| 283 | |
Daniel Dunbar | 6437126 | 2011-11-05 06:30:03 +0000 | [diff] [blame] | 284 | ###### |
| 285 | # LLVMBuild Integration |
| 286 | # |
| 287 | # We use llvm-build to generate all the data required by the CMake based |
| 288 | # build system in one swoop: |
| 289 | # |
| 290 | # - We generate a file (a CMake fragment) in the object root which contains |
| 291 | # all the definitions that are required by CMake. |
| 292 | # |
| 293 | # - We generate the library table used by llvm-config. |
| 294 | # |
| 295 | # - We generate the dependencies for the CMake fragment, so that we will |
| 296 | # automatically reconfigure outselves. |
| 297 | |
| 298 | set(LLVMBUILDTOOL "${LLVM_MAIN_SRC_DIR}/utils/llvm-build/llvm-build") |
| 299 | set(LLVMCONFIGLIBRARYDEPENDENCIESINC |
Daniel Dunbar | ab0ad4e | 2011-12-01 20:18:09 +0000 | [diff] [blame] | 300 | "${LLVM_BINARY_DIR}/tools/llvm-config/LibraryDependencies.inc") |
Daniel Dunbar | 6437126 | 2011-11-05 06:30:03 +0000 | [diff] [blame] | 301 | set(LLVMBUILDCMAKEFRAG |
| 302 | "${LLVM_BINARY_DIR}/LLVMBuild.cmake") |
Preston Gurd | e65f4e6 | 2012-05-07 19:38:40 +0000 | [diff] [blame] | 303 | |
| 304 | # Create the list of optional components that are enabled |
| 305 | if (LLVM_USE_INTEL_JITEVENTS) |
| 306 | set(LLVMOPTIONALCOMPONENTS IntelJITEvents) |
| 307 | endif (LLVM_USE_INTEL_JITEVENTS) |
| 308 | if (LLVM_USE_OPROFILE) |
| 309 | set(LLVMOPTIONALCOMPONENTS ${LLVMOPTIONALCOMPONENTS} OProfileJIT) |
| 310 | endif (LLVM_USE_OPROFILE) |
| 311 | |
Daniel Dunbar | 6437126 | 2011-11-05 06:30:03 +0000 | [diff] [blame] | 312 | message(STATUS "Constructing LLVMBuild project information") |
| 313 | execute_process( |
| 314 | COMMAND ${PYTHON_EXECUTABLE} ${LLVMBUILDTOOL} |
Daniel Dunbar | 807c6e4 | 2011-11-10 01:16:48 +0000 | [diff] [blame] | 315 | --native-target "${LLVM_NATIVE_ARCH}" |
| 316 | --enable-targets "${LLVM_TARGETS_TO_BUILD}" |
Preston Gurd | e65f4e6 | 2012-05-07 19:38:40 +0000 | [diff] [blame] | 317 | --enable-optional-components "${LLVMOPTIONALCOMPONENTS}" |
Daniel Dunbar | 6437126 | 2011-11-05 06:30:03 +0000 | [diff] [blame] | 318 | --write-library-table ${LLVMCONFIGLIBRARYDEPENDENCIESINC} |
| 319 | --write-cmake-fragment ${LLVMBUILDCMAKEFRAG} |
Michael Gottesman | 21c6948 | 2013-08-15 04:16:12 +0000 | [diff] [blame] | 320 | OUTPUT_VARIABLE LLVMBUILDOUTPUT |
Daniel Dunbar | 6437126 | 2011-11-05 06:30:03 +0000 | [diff] [blame] | 321 | ERROR_VARIABLE LLVMBUILDERRORS |
| 322 | OUTPUT_STRIP_TRAILING_WHITESPACE |
| 323 | ERROR_STRIP_TRAILING_WHITESPACE |
| 324 | RESULT_VARIABLE LLVMBUILDRESULT) |
| 325 | |
| 326 | # On Win32, CMake doesn't properly handle piping the default output/error |
| 327 | # streams into the GUI console. So, we explicitly catch and report them. |
| 328 | if( NOT "${LLVMBUILDOUTPUT}" STREQUAL "") |
| 329 | message(STATUS "llvm-build output: ${LLVMBUILDOUTPUT}") |
| 330 | endif() |
| 331 | if( NOT "${LLVMBUILDRESULT}" STREQUAL "0" ) |
| 332 | message(FATAL_ERROR |
| 333 | "Unexpected failure executing llvm-build: ${LLVMBUILDERRORS}") |
| 334 | endif() |
| 335 | |
| 336 | # Include the generated CMake fragment. This will define properties from the |
| 337 | # LLVMBuild files in a format which is easy to consume from CMake, and will add |
| 338 | # the dependencies so that CMake will reconfigure properly when the LLVMBuild |
| 339 | # files change. |
| 340 | include(${LLVMBUILDCMAKEFRAG}) |
| 341 | |
| 342 | ###### |
| 343 | |
Daniel Dunbar | 4a2eab0 | 2011-11-04 19:04:42 +0000 | [diff] [blame] | 344 | # Configure all of the various header file fragments LLVM uses which depend on |
| 345 | # configuration variables. |
Andy Gibbs | f5dede1 | 2013-06-26 07:57:53 +0000 | [diff] [blame] | 346 | set(LLVM_ENUM_TARGETS "") |
Daniel Dunbar | 4a2eab0 | 2011-11-04 19:04:42 +0000 | [diff] [blame] | 347 | set(LLVM_ENUM_ASM_PRINTERS "") |
| 348 | set(LLVM_ENUM_ASM_PARSERS "") |
| 349 | set(LLVM_ENUM_DISASSEMBLERS "") |
| 350 | foreach(t ${LLVM_TARGETS_TO_BUILD}) |
| 351 | set( td ${LLVM_MAIN_SRC_DIR}/lib/Target/${t} ) |
Andy Gibbs | f5dede1 | 2013-06-26 07:57:53 +0000 | [diff] [blame] | 352 | |
| 353 | list(FIND LLVM_ALL_TARGETS ${t} idx) |
| 354 | list(FIND LLVM_EXPERIMENTAL_TARGETS_TO_BUILD ${t} idy) |
| 355 | if( idx LESS 0 AND idy LESS 0 ) |
| 356 | message(FATAL_ERROR "The target `${t}' does not exist. |
| 357 | It should be one of\n${LLVM_ALL_TARGETS}") |
| 358 | else() |
| 359 | set(LLVM_ENUM_TARGETS "${LLVM_ENUM_TARGETS}LLVM_TARGET(${t})\n") |
| 360 | endif() |
| 361 | |
Daniel Dunbar | 4a2eab0 | 2011-11-04 19:04:42 +0000 | [diff] [blame] | 362 | file(GLOB asmp_file "${td}/*AsmPrinter.cpp") |
| 363 | if( asmp_file ) |
| 364 | set(LLVM_ENUM_ASM_PRINTERS |
| 365 | "${LLVM_ENUM_ASM_PRINTERS}LLVM_ASM_PRINTER(${t})\n") |
| 366 | endif() |
| 367 | if( EXISTS ${td}/AsmParser/CMakeLists.txt ) |
| 368 | set(LLVM_ENUM_ASM_PARSERS |
| 369 | "${LLVM_ENUM_ASM_PARSERS}LLVM_ASM_PARSER(${t})\n") |
| 370 | endif() |
| 371 | if( EXISTS ${td}/Disassembler/CMakeLists.txt ) |
| 372 | set(LLVM_ENUM_DISASSEMBLERS |
| 373 | "${LLVM_ENUM_DISASSEMBLERS}LLVM_DISASSEMBLER(${t})\n") |
| 374 | endif() |
| 375 | endforeach(t) |
| 376 | |
| 377 | # Produce the target definition files, which provide a way for clients to easily |
| 378 | # include various classes of targets. |
| 379 | configure_file( |
| 380 | ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/AsmPrinters.def.in |
NAKAMURA Takumi | 03932fb | 2013-12-16 15:05:39 +0000 | [diff] [blame^] | 381 | ${LLVM_INCLUDE_DIR}/llvm/Config/AsmPrinters.def |
Daniel Dunbar | 4a2eab0 | 2011-11-04 19:04:42 +0000 | [diff] [blame] | 382 | ) |
| 383 | configure_file( |
| 384 | ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/AsmParsers.def.in |
NAKAMURA Takumi | 03932fb | 2013-12-16 15:05:39 +0000 | [diff] [blame^] | 385 | ${LLVM_INCLUDE_DIR}/llvm/Config/AsmParsers.def |
Daniel Dunbar | 4a2eab0 | 2011-11-04 19:04:42 +0000 | [diff] [blame] | 386 | ) |
| 387 | configure_file( |
| 388 | ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/Disassemblers.def.in |
NAKAMURA Takumi | 03932fb | 2013-12-16 15:05:39 +0000 | [diff] [blame^] | 389 | ${LLVM_INCLUDE_DIR}/llvm/Config/Disassemblers.def |
Daniel Dunbar | 4a2eab0 | 2011-11-04 19:04:42 +0000 | [diff] [blame] | 390 | ) |
| 391 | configure_file( |
| 392 | ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/Targets.def.in |
NAKAMURA Takumi | 03932fb | 2013-12-16 15:05:39 +0000 | [diff] [blame^] | 393 | ${LLVM_INCLUDE_DIR}/llvm/Config/Targets.def |
Daniel Dunbar | 4a2eab0 | 2011-11-04 19:04:42 +0000 | [diff] [blame] | 394 | ) |
| 395 | |
| 396 | # Configure the three LLVM configuration header files. |
Oscar Fuentes | f4202ba | 2011-02-03 20:57:36 +0000 | [diff] [blame] | 397 | configure_file( |
| 398 | ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/config.h.cmake |
NAKAMURA Takumi | 03932fb | 2013-12-16 15:05:39 +0000 | [diff] [blame^] | 399 | ${LLVM_INCLUDE_DIR}/llvm/Config/config.h) |
Oscar Fuentes | f4202ba | 2011-02-03 20:57:36 +0000 | [diff] [blame] | 400 | configure_file( |
| 401 | ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/llvm-config.h.cmake |
NAKAMURA Takumi | 03932fb | 2013-12-16 15:05:39 +0000 | [diff] [blame^] | 402 | ${LLVM_INCLUDE_DIR}/llvm/Config/llvm-config.h) |
Oscar Fuentes | f4202ba | 2011-02-03 20:57:36 +0000 | [diff] [blame] | 403 | configure_file( |
| 404 | ${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/DataTypes.h.cmake |
NAKAMURA Takumi | 03932fb | 2013-12-16 15:05:39 +0000 | [diff] [blame^] | 405 | ${LLVM_INCLUDE_DIR}/llvm/Support/DataTypes.h) |
Oscar Fuentes | edfc184 | 2011-01-09 14:34:39 +0000 | [diff] [blame] | 406 | |
Oscar Fuentes | a229b3c | 2008-09-22 01:08:49 +0000 | [diff] [blame] | 407 | set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR} ) |
| 408 | set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib ) |
| 409 | set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib ) |
| 410 | |
Oscar Fuentes | 210b06a | 2011-02-14 20:13:58 +0000 | [diff] [blame] | 411 | set(CMAKE_INCLUDE_CURRENT_DIR ON) |
| 412 | |
NAKAMURA Takumi | 03932fb | 2013-12-16 15:05:39 +0000 | [diff] [blame^] | 413 | include_directories( ${LLVM_INCLUDE_DIR} ${LLVM_MAIN_INCLUDE_DIR}) |
Oscar Fuentes | a229b3c | 2008-09-22 01:08:49 +0000 | [diff] [blame] | 414 | |
David Chisnall | 7945013 | 2013-02-14 15:40:44 +0000 | [diff] [blame] | 415 | if( ${CMAKE_SYSTEM_NAME} MATCHES FreeBSD ) |
| 416 | # On FreeBSD, /usr/local/* is not used by default. In order to build LLVM |
| 417 | # with libxml2, iconv.h, etc., we must add /usr/local paths. |
| 418 | include_directories("/usr/local/include") |
| 419 | link_directories("/usr/local/lib") |
| 420 | endif( ${CMAKE_SYSTEM_NAME} MATCHES FreeBSD ) |
| 421 | |
Edward O'Callaghan | 396ed2b | 2009-10-12 04:00:11 +0000 | [diff] [blame] | 422 | if( ${CMAKE_SYSTEM_NAME} MATCHES SunOS ) |
Oscar Fuentes | 2d48f65 | 2011-07-17 17:35:15 +0000 | [diff] [blame] | 423 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include llvm/Support/Solaris.h") |
Edward O'Callaghan | 396ed2b | 2009-10-12 04:00:11 +0000 | [diff] [blame] | 424 | endif( ${CMAKE_SYSTEM_NAME} MATCHES SunOS ) |
| 425 | |
Rafael Espindola | 76f9227 | 2013-04-04 01:01:32 +0000 | [diff] [blame] | 426 | # Make sure we don't get -rdynamic in every binary. For those that need it, |
| 427 | # use set_target_properties(target PROPERTIES ENABLE_EXPORTS 1) |
| 428 | set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") |
| 429 | |
Oscar Fuentes | a229b3c | 2008-09-22 01:08:49 +0000 | [diff] [blame] | 430 | include(AddLLVM) |
Oscar Fuentes | cdc9549 | 2008-09-26 04:40:32 +0000 | [diff] [blame] | 431 | include(TableGen) |
Oscar Fuentes | a229b3c | 2008-09-22 01:08:49 +0000 | [diff] [blame] | 432 | |
Michael J. Spencer | 7c3a5ee | 2010-09-11 02:13:39 +0000 | [diff] [blame] | 433 | if( MINGW ) |
Oscar Fuentes | 9bf2595 | 2011-01-07 20:31:03 +0000 | [diff] [blame] | 434 | # People report that -O3 is unreliable on MinGW. The traditional |
| 435 | # build also uses -O2 for that reason: |
| 436 | llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "-O2") |
| 437 | endif() |
| 438 | |
Oscar Fuentes | 5ed9626 | 2011-02-18 22:06:14 +0000 | [diff] [blame] | 439 | # Put this before tblgen. Else we have a circular dependence. |
Oscar Fuentes | a229b3c | 2008-09-22 01:08:49 +0000 | [diff] [blame] | 440 | add_subdirectory(lib/Support) |
Peter Collingbourne | 84c287e | 2011-10-01 16:41:13 +0000 | [diff] [blame] | 441 | add_subdirectory(lib/TableGen) |
Oscar Fuentes | 8807bdd | 2008-09-22 18:21:51 +0000 | [diff] [blame] | 442 | |
Oscar Fuentes | e352ca0 | 2008-11-10 01:32:14 +0000 | [diff] [blame] | 443 | add_subdirectory(utils/TableGen) |
| 444 | |
Oscar Fuentes | dc8d56e | 2008-11-15 00:24:38 +0000 | [diff] [blame] | 445 | add_subdirectory(include/llvm) |
Oscar Fuentes | 8807bdd | 2008-09-22 18:21:51 +0000 | [diff] [blame] | 446 | |
Oscar Fuentes | 5ed9626 | 2011-02-18 22:06:14 +0000 | [diff] [blame] | 447 | add_subdirectory(lib) |
Oscar Fuentes | cdc9549 | 2008-09-26 04:40:32 +0000 | [diff] [blame] | 448 | |
Douglas Gregor | 289dfc5 | 2009-07-20 18:30:25 +0000 | [diff] [blame] | 449 | add_subdirectory(utils/FileCheck) |
Michael J. Spencer | 01639a4 | 2010-12-09 17:54:44 +0000 | [diff] [blame] | 450 | add_subdirectory(utils/FileUpdate) |
Daniel Dunbar | 00dd448 | 2009-09-24 06:23:57 +0000 | [diff] [blame] | 451 | add_subdirectory(utils/count) |
| 452 | add_subdirectory(utils/not) |
Michael J. Spencer | 885611b | 2010-09-13 17:52:38 +0000 | [diff] [blame] | 453 | add_subdirectory(utils/llvm-lit) |
Michael J. Spencer | 22120c4 | 2012-04-03 23:09:22 +0000 | [diff] [blame] | 454 | add_subdirectory(utils/yaml-bench) |
Douglas Gregor | 289dfc5 | 2009-07-20 18:30:25 +0000 | [diff] [blame] | 455 | |
Oscar Fuentes | afbe975 | 2009-03-06 01:16:52 +0000 | [diff] [blame] | 456 | add_subdirectory(projects) |
Oscar Fuentes | a229b3c | 2008-09-22 01:08:49 +0000 | [diff] [blame] | 457 | |
Oscar Fuentes | bf03084 | 2010-09-25 20:43:06 +0000 | [diff] [blame] | 458 | if( LLVM_INCLUDE_TOOLS ) |
| 459 | add_subdirectory(tools) |
| 460 | endif() |
Oscar Fuentes | acfd9ad | 2009-08-16 20:56:30 +0000 | [diff] [blame] | 461 | |
Oscar Fuentes | bf03084 | 2010-09-25 20:43:06 +0000 | [diff] [blame] | 462 | if( LLVM_INCLUDE_EXAMPLES ) |
| 463 | add_subdirectory(examples) |
| 464 | endif() |
Oscar Fuentes | 64c9962 | 2008-10-22 02:56:07 +0000 | [diff] [blame] | 465 | |
Oscar Fuentes | bf03084 | 2010-09-25 20:43:06 +0000 | [diff] [blame] | 466 | if( LLVM_INCLUDE_TESTS ) |
| 467 | add_subdirectory(test) |
| 468 | add_subdirectory(utils/unittest) |
| 469 | add_subdirectory(unittests) |
NAKAMURA Takumi | 4bb599c | 2010-10-26 05:08:27 +0000 | [diff] [blame] | 470 | if (MSVC) |
Joel Jones | 54594f2 | 2012-12-13 15:25:07 +0000 | [diff] [blame] | 471 | # This utility is used to prevent crashing tests from calling Dr. Watson on |
Michael J. Spencer | 279362d | 2010-10-11 19:55:38 +0000 | [diff] [blame] | 472 | # Windows. |
| 473 | add_subdirectory(utils/KillTheDoctor) |
| 474 | endif() |
Chandler Carruth | 69ce665 | 2012-06-30 10:14:14 +0000 | [diff] [blame] | 475 | |
| 476 | # Add a global check rule now that all subdirectories have been traversed |
| 477 | # and we know the total set of lit testsuites. |
| 478 | get_property(LLVM_LIT_TESTSUITES GLOBAL PROPERTY LLVM_LIT_TESTSUITES) |
| 479 | get_property(LLVM_LIT_PARAMS GLOBAL PROPERTY LLVM_LIT_PARAMS) |
| 480 | get_property(LLVM_LIT_DEPENDS GLOBAL PROPERTY LLVM_LIT_DEPENDS) |
| 481 | get_property(LLVM_LIT_EXTRA_ARGS GLOBAL PROPERTY LLVM_LIT_EXTRA_ARGS) |
| 482 | add_lit_target(check-all |
| 483 | "Running all regression tests" |
| 484 | ${LLVM_LIT_TESTSUITES} |
| 485 | PARAMS ${LLVM_LIT_PARAMS} |
| 486 | DEPENDS ${LLVM_LIT_DEPENDS} |
| 487 | ARGS ${LLVM_LIT_EXTRA_ARGS} |
| 488 | ) |
Oscar Fuentes | bf03084 | 2010-09-25 20:43:06 +0000 | [diff] [blame] | 489 | endif() |
Michael J. Spencer | 10d274d | 2010-09-24 09:01:13 +0000 | [diff] [blame] | 490 | |
Michael Gottesman | 4d35b90 | 2013-08-24 07:25:21 +0000 | [diff] [blame] | 491 | if (LLVM_INCLUDE_DOCS) |
| 492 | add_subdirectory(docs) |
| 493 | endif() |
| 494 | |
Oscar Fuentes | a389c58 | 2010-08-09 03:26:43 +0000 | [diff] [blame] | 495 | add_subdirectory(cmake/modules) |
| 496 | |
Hans Wennborg | 1654627 | 2013-08-24 00:20:36 +0000 | [diff] [blame] | 497 | if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) |
| 498 | install(DIRECTORY include/ |
| 499 | DESTINATION include |
| 500 | FILES_MATCHING |
| 501 | PATTERN "*.def" |
| 502 | PATTERN "*.h" |
| 503 | PATTERN "*.td" |
| 504 | PATTERN "*.inc" |
| 505 | PATTERN "LICENSE.TXT" |
| 506 | PATTERN ".svn" EXCLUDE |
| 507 | ) |
Oscar Fuentes | 64c9962 | 2008-10-22 02:56:07 +0000 | [diff] [blame] | 508 | |
NAKAMURA Takumi | 03932fb | 2013-12-16 15:05:39 +0000 | [diff] [blame^] | 509 | install(DIRECTORY ${LLVM_INCLUDE_DIR}/ |
Hans Wennborg | 1654627 | 2013-08-24 00:20:36 +0000 | [diff] [blame] | 510 | DESTINATION include |
| 511 | FILES_MATCHING |
| 512 | PATTERN "*.def" |
| 513 | PATTERN "*.h" |
| 514 | PATTERN "*.gen" |
| 515 | PATTERN "*.inc" |
| 516 | # Exclude include/llvm/CMakeFiles/intrinsics_gen.dir, matched by "*.def" |
| 517 | PATTERN "CMakeFiles" EXCLUDE |
| 518 | PATTERN ".svn" EXCLUDE |
| 519 | ) |
| 520 | endif() |
| 521 | |
NAKAMURA Takumi | 148b62c | 2010-11-19 03:19:18 +0000 | [diff] [blame] | 522 | # Workaround for MSVS10 to avoid the Dialog Hell |
| 523 | # FIXME: This could be removed with future version of CMake. |
| 524 | if(MSVC_VERSION EQUAL 1600) |
| 525 | set(LLVM_SLN_FILENAME "${CMAKE_CURRENT_BINARY_DIR}/LLVM.sln") |
| 526 | if( EXISTS "${LLVM_SLN_FILENAME}" ) |
| 527 | file(APPEND "${LLVM_SLN_FILENAME}" "\n# This should be regenerated!\n") |
| 528 | endif() |
| 529 | endif() |
Rafael Espindola | fc0447b | 2013-10-31 22:13:41 +0000 | [diff] [blame] | 530 | |