Mercurial > hg > CbC > CbC_llvm
comparison CMakeLists.txt @ 80:67baa08a3894
update to LLVM 3.6
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 25 Sep 2014 16:56:18 +0900 |
parents | 54457678186b |
children | 60c9769439b8 |
comparison
equal
deleted
inserted
replaced
76:9e74acfe8c42 | 80:67baa08a3894 |
---|---|
1 # See docs/CMake.html for instructions about how to build LLVM with CMake. | 1 # See docs/CMake.html for instructions about how to build LLVM with CMake. |
2 | 2 |
3 cmake_minimum_required(VERSION 2.8.8) | |
4 | |
5 # FIXME: It may be removed when we use 2.8.12. | |
6 if(CMAKE_VERSION VERSION_LESS 2.8.12) | |
7 # Invalidate a couple of keywords. | |
8 set(cmake_2_8_12_INTERFACE) | |
9 set(cmake_2_8_12_PRIVATE) | |
10 else() | |
11 # Use ${cmake_2_8_12_KEYWORD} intead of KEYWORD in target_link_libraries(). | |
12 set(cmake_2_8_12_INTERFACE INTERFACE) | |
13 set(cmake_2_8_12_PRIVATE PRIVATE) | |
14 if(POLICY CMP0022) | |
15 cmake_policy(SET CMP0022 NEW) # automatic when 2.8.12 is required | |
16 endif() | |
17 endif() | |
18 | |
3 project(LLVM) | 19 project(LLVM) |
4 cmake_minimum_required(VERSION 2.8) | |
5 | 20 |
6 # Add path for custom modules | 21 # Add path for custom modules |
7 set(CMAKE_MODULE_PATH | 22 set(CMAKE_MODULE_PATH |
8 ${CMAKE_MODULE_PATH} | 23 ${CMAKE_MODULE_PATH} |
9 "${CMAKE_CURRENT_SOURCE_DIR}/cmake" | 24 "${CMAKE_CURRENT_SOURCE_DIR}/cmake" |
10 "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" | 25 "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" |
11 ) | 26 ) |
12 | 27 |
13 set(LLVM_VERSION_MAJOR 3) | 28 set(LLVM_VERSION_MAJOR 3) |
14 set(LLVM_VERSION_MINOR 5) | 29 set(LLVM_VERSION_MINOR 6) |
30 set(LLVM_VERSION_PATCH 0) | |
15 | 31 |
16 if (NOT PACKAGE_VERSION) | 32 if (NOT PACKAGE_VERSION) |
17 set(PACKAGE_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}svn") | 33 set(PACKAGE_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}svn") |
18 endif() | 34 endif() |
19 | 35 |
20 option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF) | 36 option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF) |
21 | 37 |
22 option(LLVM_USE_FOLDERS "Enable solution folders in Visual Studio. Disable for Express versions." ON) | 38 option(LLVM_USE_FOLDERS "Enable solution folders in Visual Studio. Disable for Express versions." ON) |
34 endif() | 50 endif() |
35 | 51 |
36 set(PACKAGE_NAME LLVM) | 52 set(PACKAGE_NAME LLVM) |
37 set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") | 53 set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") |
38 set(PACKAGE_BUGREPORT "http://llvm.org/bugs/") | 54 set(PACKAGE_BUGREPORT "http://llvm.org/bugs/") |
55 | |
56 set(BUG_REPORT_URL "${PACKAGE_BUGREPORT}" CACHE STRING | |
57 "Default URL where bug reports are to be submitted.") | |
39 | 58 |
40 # Configure CPack. | 59 # Configure CPack. |
41 set(CPACK_PACKAGE_INSTALL_DIRECTORY "LLVM") | 60 set(CPACK_PACKAGE_INSTALL_DIRECTORY "LLVM") |
42 set(CPACK_PACKAGE_VENDOR "LLVM") | 61 set(CPACK_PACKAGE_VENDOR "LLVM") |
43 set(CPACK_PACKAGE_VERSION_MAJOR ${LLVM_VERSION_MAJOR}) | 62 set(CPACK_PACKAGE_VERSION_MAJOR ${LLVM_VERSION_MAJOR}) |
44 set(CPACK_PACKAGE_VERSION_MINOR ${LLVM_VERSION_MINOR}) | 63 set(CPACK_PACKAGE_VERSION_MINOR ${LLVM_VERSION_MINOR}) |
64 set(CPACK_PACKAGE_VERSION_PATCH ${LLVM_VERSION_PATCH}) | |
45 set(CPACK_PACKAGE_VERSION ${PACKAGE_VERSION}) | 65 set(CPACK_PACKAGE_VERSION ${PACKAGE_VERSION}) |
46 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.TXT") | 66 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.TXT") |
47 if(WIN32 AND NOT UNIX) | 67 if(WIN32 AND NOT UNIX) |
48 set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "LLVM") | 68 set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "LLVM") |
49 set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\cmake\\\\nsis_logo.bmp") | 69 set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\cmake\\\\nsis_logo.bmp") |
70 set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\cmake\\\\nsis_icon.ico") | |
71 set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\cmake\\\\nsis_icon.ico") | |
50 set(CPACK_NSIS_MODIFY_PATH "ON") | 72 set(CPACK_NSIS_MODIFY_PATH "ON") |
51 set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON") | 73 set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON") |
52 set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS | 74 set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS |
53 "ExecWait '$INSTDIR/tools/msbuild/install.bat'") | 75 "ExecWait '$INSTDIR/tools/msbuild/install.bat'") |
54 set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS | 76 set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS |
87 endif() | 109 endif() |
88 endif() | 110 endif() |
89 | 111 |
90 string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE) | 112 string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE) |
91 | 113 |
92 set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}) | 114 # They are used as destination of target generators. |
93 set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/include) | 115 set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin) |
94 set(LLVM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) | 116 set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib) |
95 set(LLVM_TOOLS_BINARY_DIR ${LLVM_BINARY_DIR}/bin) | 117 if(WIN32 OR CYGWIN) |
118 # DLL platform -- put DLLs into bin. | |
119 set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) | |
120 else() | |
121 set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) | |
122 endif() | |
123 | |
124 # Each of them corresponds to llvm-config's. | |
125 set(LLVM_TOOLS_BINARY_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) # --bindir | |
126 set(LLVM_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) # --libdir | |
127 set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR} ) # --src-root | |
128 set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/include ) # --includedir | |
129 set(LLVM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} ) # --prefix | |
130 | |
96 set(LLVM_EXAMPLES_BINARY_DIR ${LLVM_BINARY_DIR}/examples) | 131 set(LLVM_EXAMPLES_BINARY_DIR ${LLVM_BINARY_DIR}/examples) |
132 set(LLVM_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include) | |
97 set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" ) | 133 set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" ) |
98 | 134 |
99 set(LLVM_ALL_TARGETS | 135 set(LLVM_ALL_TARGETS |
100 AArch64 | 136 AArch64 |
101 ARM | 137 ARM |
122 CACHE STRING "Semicolon-separated list of experimental targets to build.") | 158 CACHE STRING "Semicolon-separated list of experimental targets to build.") |
123 | 159 |
124 option(BUILD_SHARED_LIBS | 160 option(BUILD_SHARED_LIBS |
125 "Build all libraries as shared libraries instead of static" OFF) | 161 "Build all libraries as shared libraries instead of static" OFF) |
126 | 162 |
127 option(LLVM_ENABLE_CBE_PRINTF_A "Set to ON if CBE is enabled for printf %a output" ON) | |
128 if(LLVM_ENABLE_CBE_PRINTF_A) | |
129 set(ENABLE_CBE_PRINTF_A 1) | |
130 endif() | |
131 | |
132 option(LLVM_ENABLE_TIMESTAMPS "Enable embedding timestamp information in build" ON) | 163 option(LLVM_ENABLE_TIMESTAMPS "Enable embedding timestamp information in build" ON) |
133 if(LLVM_ENABLE_TIMESTAMPS) | 164 if(LLVM_ENABLE_TIMESTAMPS) |
134 set(ENABLE_TIMESTAMPS 1) | 165 set(ENABLE_TIMESTAMPS 1) |
135 endif() | 166 endif() |
136 | 167 |
164 set(LLVM_TARGETS_TO_BUILD | 195 set(LLVM_TARGETS_TO_BUILD |
165 ${LLVM_TARGETS_TO_BUILD} | 196 ${LLVM_TARGETS_TO_BUILD} |
166 ${LLVM_EXPERIMENTAL_TARGETS_TO_BUILD}) | 197 ${LLVM_EXPERIMENTAL_TARGETS_TO_BUILD}) |
167 list(REMOVE_DUPLICATES LLVM_TARGETS_TO_BUILD) | 198 list(REMOVE_DUPLICATES LLVM_TARGETS_TO_BUILD) |
168 | 199 |
169 set(llvm_builded_incs_dir ${LLVM_BINARY_DIR}/include/llvm) | |
170 | |
171 include(AddLLVMDefinitions) | 200 include(AddLLVMDefinitions) |
172 | 201 |
173 option(LLVM_ENABLE_PIC "Build Position-Independent Code" ON) | 202 option(LLVM_ENABLE_PIC "Build Position-Independent Code" ON) |
174 | 203 |
175 # MSVC has a gazillion warnings with this. | 204 # MSVC has a gazillion warnings with this. |
176 if( MSVC ) | 205 if( MSVC ) |
177 option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." OFF) | 206 option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." OFF) |
178 else( MSVC ) | 207 else() |
179 option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON) | 208 option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON) |
180 endif() | 209 endif() |
181 | 210 |
182 option(LLVM_ENABLE_CXX11 "Compile with C++11 enabled." OFF) | 211 option(LLVM_ENABLE_CXX1Y "Compile with C++1y enabled." OFF) |
212 option(LLVM_ENABLE_LIBCXX "Use libc++ if available." OFF) | |
183 option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON) | 213 option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON) |
184 option(LLVM_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF) | 214 option(LLVM_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF) |
185 | 215 |
186 if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" ) | 216 if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" ) |
187 option(LLVM_ENABLE_ASSERTIONS "Enable assertions" OFF) | 217 option(LLVM_ENABLE_ASSERTIONS "Enable assertions" OFF) |
188 else() | 218 else() |
189 option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON) | 219 option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON) |
190 endif() | 220 endif() |
221 | |
222 option(LLVM_FORCE_USE_OLD_HOST_TOOLCHAIN | |
223 "Set to ON to force using an old, unsupported host toolchain." OFF) | |
191 | 224 |
192 option(LLVM_USE_INTEL_JITEVENTS | 225 option(LLVM_USE_INTEL_JITEVENTS |
193 "Use Intel JIT API to inform Intel(R) VTune(TM) Amplifier XE 2011 about JIT code" | 226 "Use Intel JIT API to inform Intel(R) VTune(TM) Amplifier XE 2011 about JIT code" |
194 OFF) | 227 OFF) |
195 | 228 |
205 "Use opagent JIT interface to inform OProfile about JIT code" OFF) | 238 "Use opagent JIT interface to inform OProfile about JIT code" OFF) |
206 | 239 |
207 # If enabled, verify we are on a platform that supports oprofile. | 240 # If enabled, verify we are on a platform that supports oprofile. |
208 if( LLVM_USE_OPROFILE ) | 241 if( LLVM_USE_OPROFILE ) |
209 if( NOT CMAKE_SYSTEM_NAME MATCHES "Linux" ) | 242 if( NOT CMAKE_SYSTEM_NAME MATCHES "Linux" ) |
210 message(FATAL_ERROR "OProfile support is available on Linux only.") | 243 message(FATAL_ERROR "OProfile support is available on Linux only.") |
211 endif( NOT CMAKE_SYSTEM_NAME MATCHES "Linux" ) | 244 endif( NOT CMAKE_SYSTEM_NAME MATCHES "Linux" ) |
212 endif( LLVM_USE_OPROFILE ) | 245 endif( LLVM_USE_OPROFILE ) |
213 | 246 |
214 set(LLVM_USE_SANITIZER "" CACHE STRING | 247 set(LLVM_USE_SANITIZER "" CACHE STRING |
215 "Define the sanitizer used to build binaries and tests.") | 248 "Define the sanitizer used to build binaries and tests.") |
216 | 249 |
217 option(LLVM_USE_SPLIT_DWARF | 250 option(LLVM_USE_SPLIT_DWARF |
218 "Use -gsplit-dwarf when compiling llvm." OFF) | 251 "Use -gsplit-dwarf when compiling llvm." OFF) |
252 | |
253 option(WITH_POLLY "Build LLVM with Polly" ON) | |
254 option(LINK_POLLY_INTO_TOOLS "Static link Polly into tools" OFF) | |
219 | 255 |
220 # Define an option controlling whether we should build for 32-bit on 64-bit | 256 # Define an option controlling whether we should build for 32-bit on 64-bit |
221 # platforms, where supported. | 257 # platforms, where supported. |
222 if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 ) | 258 if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 ) |
223 # TODO: support other platforms and toolchains. | 259 # TODO: support other platforms and toolchains. |
243 # This is primarily to support building smaller or faster project files. | 279 # This is primarily to support building smaller or faster project files. |
244 option(LLVM_INCLUDE_TOOLS "Generate build targets for the LLVM tools." ON) | 280 option(LLVM_INCLUDE_TOOLS "Generate build targets for the LLVM tools." ON) |
245 option(LLVM_BUILD_TOOLS | 281 option(LLVM_BUILD_TOOLS |
246 "Build the LLVM tools. If OFF, just generate build targets." ON) | 282 "Build the LLVM tools. If OFF, just generate build targets." ON) |
247 | 283 |
284 option(LLVM_INCLUDE_UTILS "Generate build targets for the LLVM utils." ON) | |
285 | |
248 option(LLVM_BUILD_RUNTIME | 286 option(LLVM_BUILD_RUNTIME |
249 "Build the LLVM runtime libraries." ON) | 287 "Build the LLVM runtime libraries." ON) |
250 option(LLVM_BUILD_EXAMPLES | 288 option(LLVM_BUILD_EXAMPLES |
251 "Build the LLVM example programs. If OFF, just generate build targets." OFF) | 289 "Build the LLVM example programs. If OFF, just generate build targets." OFF) |
252 option(LLVM_INCLUDE_EXAMPLES "Generate build targets for the LLVM examples" ON) | 290 option(LLVM_INCLUDE_EXAMPLES "Generate build targets for the LLVM examples" ON) |
255 "Build LLVM unit tests. If OFF, just generate build targets." OFF) | 293 "Build LLVM unit tests. If OFF, just generate build targets." OFF) |
256 option(LLVM_INCLUDE_TESTS "Generate build targets for the LLVM unit tests." ON) | 294 option(LLVM_INCLUDE_TESTS "Generate build targets for the LLVM unit tests." ON) |
257 | 295 |
258 option (LLVM_BUILD_DOCS "Build the llvm documentation." OFF) | 296 option (LLVM_BUILD_DOCS "Build the llvm documentation." OFF) |
259 option (LLVM_INCLUDE_DOCS "Generate build targets for llvm documentation." ON) | 297 option (LLVM_INCLUDE_DOCS "Generate build targets for llvm documentation." ON) |
260 option (LLVM_ENABLE_DOXYGEN "Use doxygen to generate llvm documentation." OFF) | 298 option (LLVM_ENABLE_DOXYGEN "Use doxygen to generate llvm API documentation." OFF) |
299 option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF) | |
300 | |
301 option (LLVM_BUILD_EXTERNAL_COMPILER_RT | |
302 "Build compiler-rt as an external project." OFF) | |
261 | 303 |
262 # All options referred to from HandleLLVMOptions have to be specified | 304 # All options referred to from HandleLLVMOptions have to be specified |
263 # BEFORE this include, otherwise options will not be correctly set on | 305 # BEFORE this include, otherwise options will not be correctly set on |
264 # first cmake run | 306 # first cmake run |
265 include(config-ix) | 307 include(config-ix) |
377 | 419 |
378 # Produce the target definition files, which provide a way for clients to easily | 420 # Produce the target definition files, which provide a way for clients to easily |
379 # include various classes of targets. | 421 # include various classes of targets. |
380 configure_file( | 422 configure_file( |
381 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/AsmPrinters.def.in | 423 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/AsmPrinters.def.in |
382 ${LLVM_BINARY_DIR}/include/llvm/Config/AsmPrinters.def | 424 ${LLVM_INCLUDE_DIR}/llvm/Config/AsmPrinters.def |
383 ) | 425 ) |
384 configure_file( | 426 configure_file( |
385 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/AsmParsers.def.in | 427 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/AsmParsers.def.in |
386 ${LLVM_BINARY_DIR}/include/llvm/Config/AsmParsers.def | 428 ${LLVM_INCLUDE_DIR}/llvm/Config/AsmParsers.def |
387 ) | 429 ) |
388 configure_file( | 430 configure_file( |
389 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/Disassemblers.def.in | 431 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/Disassemblers.def.in |
390 ${LLVM_BINARY_DIR}/include/llvm/Config/Disassemblers.def | 432 ${LLVM_INCLUDE_DIR}/llvm/Config/Disassemblers.def |
391 ) | 433 ) |
392 configure_file( | 434 configure_file( |
393 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/Targets.def.in | 435 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/Targets.def.in |
394 ${LLVM_BINARY_DIR}/include/llvm/Config/Targets.def | 436 ${LLVM_INCLUDE_DIR}/llvm/Config/Targets.def |
395 ) | 437 ) |
396 | 438 |
397 # Configure the three LLVM configuration header files. | 439 # Configure the three LLVM configuration header files. |
398 configure_file( | 440 configure_file( |
399 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/config.h.cmake | 441 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/config.h.cmake |
400 ${LLVM_BINARY_DIR}/include/llvm/Config/config.h) | 442 ${LLVM_INCLUDE_DIR}/llvm/Config/config.h) |
401 configure_file( | 443 configure_file( |
402 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/llvm-config.h.cmake | 444 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/llvm-config.h.cmake |
403 ${LLVM_BINARY_DIR}/include/llvm/Config/llvm-config.h) | 445 ${LLVM_INCLUDE_DIR}/llvm/Config/llvm-config.h) |
404 configure_file( | 446 configure_file( |
405 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/DataTypes.h.cmake | 447 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/DataTypes.h.cmake |
406 ${LLVM_BINARY_DIR}/include/llvm/Support/DataTypes.h) | 448 ${LLVM_INCLUDE_DIR}/llvm/Support/DataTypes.h) |
407 | 449 |
408 set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR} ) | 450 # They are not referenced. See set_output_directory(). |
451 set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/bin ) | |
409 set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib ) | 452 set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib ) |
410 set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib ) | 453 set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib ) |
411 | 454 |
455 set(CMAKE_BUILD_WITH_INSTALL_RPATH ON) | |
456 if (APPLE) | |
457 set(CMAKE_INSTALL_NAME_DIR "@rpath") | |
458 set(CMAKE_INSTALL_RPATH "@executable_path/../lib") | |
459 else(UNIX) | |
460 if(NOT DEFINED CMAKE_INSTALL_RPATH) | |
461 set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib") | |
462 if (${CMAKE_SYSTEM_NAME} MATCHES FreeBSD) | |
463 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,origin") | |
464 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,origin") | |
465 endif() | |
466 endif(NOT DEFINED CMAKE_INSTALL_RPATH) | |
467 endif() | |
468 | |
412 set(CMAKE_INCLUDE_CURRENT_DIR ON) | 469 set(CMAKE_INCLUDE_CURRENT_DIR ON) |
413 | 470 |
414 include_directories( ${LLVM_BINARY_DIR}/include ${LLVM_MAIN_INCLUDE_DIR}) | 471 include_directories( ${LLVM_INCLUDE_DIR} ${LLVM_MAIN_INCLUDE_DIR}) |
472 | |
473 # when crosscompiling import the executable targets from a file | |
474 if(CMAKE_CROSSCOMPILING) | |
475 include(CrossCompile) | |
476 endif(CMAKE_CROSSCOMPILING) | |
415 | 477 |
416 if( ${CMAKE_SYSTEM_NAME} MATCHES FreeBSD ) | 478 if( ${CMAKE_SYSTEM_NAME} MATCHES FreeBSD ) |
417 # On FreeBSD, /usr/local/* is not used by default. In order to build LLVM | 479 # On FreeBSD, /usr/local/* is not used by default. In order to build LLVM |
418 # with libxml2, iconv.h, etc., we must add /usr/local paths. | 480 # with libxml2, iconv.h, etc., we must add /usr/local paths. |
419 include_directories("/usr/local/include") | 481 include_directories("/usr/local/include") |
445 | 507 |
446 add_subdirectory(include/llvm) | 508 add_subdirectory(include/llvm) |
447 | 509 |
448 add_subdirectory(lib) | 510 add_subdirectory(lib) |
449 | 511 |
450 add_subdirectory(utils/FileCheck) | 512 if( LLVM_INCLUDE_UTILS ) |
451 add_subdirectory(utils/FileUpdate) | 513 add_subdirectory(utils/FileCheck) |
452 add_subdirectory(utils/count) | 514 add_subdirectory(utils/PerfectShuffle) |
453 add_subdirectory(utils/not) | 515 add_subdirectory(utils/count) |
454 add_subdirectory(utils/llvm-lit) | 516 add_subdirectory(utils/not) |
455 add_subdirectory(utils/yaml-bench) | 517 add_subdirectory(utils/llvm-lit) |
518 add_subdirectory(utils/yaml-bench) | |
519 else() | |
520 if ( LLVM_INCLUDE_TESTS ) | |
521 message(FATAL_ERROR "Including tests when not building utils will not work. | |
522 Either set LLVM_INCLUDE_UTILS to On, or set LLVM_INCLDE_TESTS to Off.") | |
523 endif() | |
524 endif() | |
525 | |
526 if(LLVM_INCLUDE_TESTS) | |
527 add_subdirectory(utils/unittest) | |
528 endif() | |
456 | 529 |
457 add_subdirectory(projects) | 530 add_subdirectory(projects) |
531 | |
532 if(WITH_POLLY) | |
533 if(NOT EXISTS ${LLVM_MAIN_SRC_DIR}/tools/polly/CMakeLists.txt) | |
534 set(WITH_POLLY OFF) | |
535 endif() | |
536 endif(WITH_POLLY) | |
458 | 537 |
459 if( LLVM_INCLUDE_TOOLS ) | 538 if( LLVM_INCLUDE_TOOLS ) |
460 add_subdirectory(tools) | 539 add_subdirectory(tools) |
461 endif() | 540 endif() |
462 | 541 |
464 add_subdirectory(examples) | 543 add_subdirectory(examples) |
465 endif() | 544 endif() |
466 | 545 |
467 if( LLVM_INCLUDE_TESTS ) | 546 if( LLVM_INCLUDE_TESTS ) |
468 add_subdirectory(test) | 547 add_subdirectory(test) |
469 add_subdirectory(utils/unittest) | |
470 add_subdirectory(unittests) | 548 add_subdirectory(unittests) |
471 if (MSVC) | 549 if (MSVC) |
472 # This utility is used to prevent crashing tests from calling Dr. Watson on | 550 # This utility is used to prevent crashing tests from calling Dr. Watson on |
473 # Windows. | 551 # Windows. |
474 add_subdirectory(utils/KillTheDoctor) | 552 add_subdirectory(utils/KillTheDoctor) |
494 endif() | 572 endif() |
495 | 573 |
496 add_subdirectory(cmake/modules) | 574 add_subdirectory(cmake/modules) |
497 | 575 |
498 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) | 576 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) |
499 install(DIRECTORY include/ | 577 install(DIRECTORY include/llvm include/llvm-c |
500 DESTINATION include | 578 DESTINATION include |
501 FILES_MATCHING | 579 FILES_MATCHING |
502 PATTERN "*.def" | 580 PATTERN "*.def" |
503 PATTERN "*.h" | 581 PATTERN "*.h" |
504 PATTERN "*.td" | 582 PATTERN "*.td" |
505 PATTERN "*.inc" | 583 PATTERN "*.inc" |
506 PATTERN "LICENSE.TXT" | 584 PATTERN "LICENSE.TXT" |
507 PATTERN ".svn" EXCLUDE | 585 PATTERN ".svn" EXCLUDE |
508 ) | 586 ) |
509 | 587 |
510 install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/ | 588 install(DIRECTORY ${LLVM_INCLUDE_DIR}/llvm |
511 DESTINATION include | 589 DESTINATION include |
512 FILES_MATCHING | 590 FILES_MATCHING |
513 PATTERN "*.def" | 591 PATTERN "*.def" |
514 PATTERN "*.h" | 592 PATTERN "*.h" |
515 PATTERN "*.gen" | 593 PATTERN "*.gen" |
516 PATTERN "*.inc" | 594 PATTERN "*.inc" |
517 # Exclude include/llvm/CMakeFiles/intrinsics_gen.dir, matched by "*.def" | 595 # Exclude include/llvm/CMakeFiles/intrinsics_gen.dir, matched by "*.def" |
518 PATTERN "CMakeFiles" EXCLUDE | 596 PATTERN "CMakeFiles" EXCLUDE |
597 PATTERN "config.h" EXCLUDE | |
519 PATTERN ".svn" EXCLUDE | 598 PATTERN ".svn" EXCLUDE |
520 ) | 599 ) |
521 endif() | 600 endif() |
522 | |
523 # Workaround for MSVS10 to avoid the Dialog Hell | |
524 # FIXME: This could be removed with future version of CMake. | |
525 if(MSVC_VERSION EQUAL 1600) | |
526 set(LLVM_SLN_FILENAME "${CMAKE_CURRENT_BINARY_DIR}/LLVM.sln") | |
527 if( EXISTS "${LLVM_SLN_FILENAME}" ) | |
528 file(APPEND "${LLVM_SLN_FILENAME}" "\n# This should be regenerated!\n") | |
529 endif() | |
530 endif() | |
531 |