Mercurial > hg > CbC > CbC_llvm
comparison CMakeLists.txt @ 83:60c9769439b8 LLVM3.7
LLVM 3.7
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 18 Feb 2015 14:55:36 +0900 |
parents | 54457678186b |
children | afa8332a0e37 |
comparison
equal
deleted
inserted
replaced
78:af83660cff7b | 83:60c9769439b8 |
---|---|
14 if(POLICY CMP0022) | 14 if(POLICY CMP0022) |
15 cmake_policy(SET CMP0022 NEW) # automatic when 2.8.12 is required | 15 cmake_policy(SET CMP0022 NEW) # automatic when 2.8.12 is required |
16 endif() | 16 endif() |
17 endif() | 17 endif() |
18 | 18 |
19 if(CMAKE_VERSION VERSION_LESS 3.1.20141117) | |
20 set(cmake_3_2_USES_TERMINAL) | |
21 else() | |
22 set(cmake_3_2_USES_TERMINAL USES_TERMINAL) | |
23 endif() | |
24 | |
19 project(LLVM) | 25 project(LLVM) |
26 | |
27 # The following only works with the Ninja generator in CMake >= 3.0. | |
28 set(LLVM_PARALLEL_COMPILE_JOBS "" CACHE STRING | |
29 "Define the maximum number of concurrent compilation jobs.") | |
30 if(LLVM_PARALLEL_COMPILE_JOBS) | |
31 set_property(GLOBAL APPEND PROPERTY JOB_POOLS compile_job_pool=${LLVM_PARALLEL_COMPILE_JOBS}) | |
32 set(CMAKE_JOB_POOL_COMPILE compile_job_pool) | |
33 endif() | |
34 | |
35 set(LLVM_PARALLEL_LINK_JOBS "" CACHE STRING | |
36 "Define the maximum number of concurrent link jobs.") | |
37 if(LLVM_PARALLEL_LINK_JOBS) | |
38 set_property(GLOBAL APPEND PROPERTY JOB_POOLS link_job_pool=${LLVM_PARALLEL_LINK_JOBS}) | |
39 set(CMAKE_JOB_POOL_LINK link_job_pool) | |
40 endif() | |
20 | 41 |
21 # Add path for custom modules | 42 # Add path for custom modules |
22 set(CMAKE_MODULE_PATH | 43 set(CMAKE_MODULE_PATH |
23 ${CMAKE_MODULE_PATH} | 44 ${CMAKE_MODULE_PATH} |
24 "${CMAKE_CURRENT_SOURCE_DIR}/cmake" | 45 "${CMAKE_CURRENT_SOURCE_DIR}/cmake" |
25 "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" | 46 "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" |
26 ) | 47 ) |
27 | 48 |
28 set(LLVM_VERSION_MAJOR 3) | 49 set(LLVM_VERSION_MAJOR 3) |
29 set(LLVM_VERSION_MINOR 6) | 50 set(LLVM_VERSION_MINOR 7) |
30 set(LLVM_VERSION_PATCH 0) | 51 set(LLVM_VERSION_PATCH 0) |
31 | 52 |
32 if (NOT PACKAGE_VERSION) | 53 if (NOT PACKAGE_VERSION) |
33 set(PACKAGE_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}svn") | 54 set(PACKAGE_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}svn") |
34 endif() | 55 endif() |
73 set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON") | 94 set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON") |
74 set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS | 95 set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS |
75 "ExecWait '$INSTDIR/tools/msbuild/install.bat'") | 96 "ExecWait '$INSTDIR/tools/msbuild/install.bat'") |
76 set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS | 97 set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS |
77 "ExecWait '$INSTDIR/tools/msbuild/uninstall.bat'") | 98 "ExecWait '$INSTDIR/tools/msbuild/uninstall.bat'") |
99 if( CMAKE_CL_64 ) | |
100 set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64") | |
101 endif() | |
78 endif() | 102 endif() |
79 include(CPack) | 103 include(CPack) |
80 | 104 |
81 # Sanity check our source directory to make sure that we are not trying to | 105 # Sanity check our source directory to make sure that we are not trying to |
82 # generate an in-tree build (unless on MSVC_IDE, where it is ok), and to make | 106 # generate an in-tree build (unless on MSVC_IDE, where it is ok), and to make |
109 endif() | 133 endif() |
110 endif() | 134 endif() |
111 | 135 |
112 string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE) | 136 string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE) |
113 | 137 |
138 set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" ) | |
139 | |
114 # They are used as destination of target generators. | 140 # They are used as destination of target generators. |
115 set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin) | 141 set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin) |
116 set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib) | 142 set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX}) |
117 if(WIN32 OR CYGWIN) | 143 if(WIN32 OR CYGWIN) |
118 # DLL platform -- put DLLs into bin. | 144 # DLL platform -- put DLLs into bin. |
119 set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) | 145 set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) |
120 else() | 146 else() |
121 set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) | 147 set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) |
128 set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/include ) # --includedir | 154 set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/include ) # --includedir |
129 set(LLVM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} ) # --prefix | 155 set(LLVM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} ) # --prefix |
130 | 156 |
131 set(LLVM_EXAMPLES_BINARY_DIR ${LLVM_BINARY_DIR}/examples) | 157 set(LLVM_EXAMPLES_BINARY_DIR ${LLVM_BINARY_DIR}/examples) |
132 set(LLVM_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include) | 158 set(LLVM_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include) |
133 set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" ) | |
134 | 159 |
135 set(LLVM_ALL_TARGETS | 160 set(LLVM_ALL_TARGETS |
136 AArch64 | 161 AArch64 |
137 ARM | 162 ARM |
138 CppBackend | 163 CppBackend |
206 option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." OFF) | 231 option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." OFF) |
207 else() | 232 else() |
208 option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON) | 233 option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON) |
209 endif() | 234 endif() |
210 | 235 |
236 option(LLVM_ENABLE_MODULES "Compile with C++ modules enabled." OFF) | |
211 option(LLVM_ENABLE_CXX1Y "Compile with C++1y enabled." OFF) | 237 option(LLVM_ENABLE_CXX1Y "Compile with C++1y enabled." OFF) |
212 option(LLVM_ENABLE_LIBCXX "Use libc++ if available." OFF) | 238 option(LLVM_ENABLE_LIBCXX "Use libc++ if available." OFF) |
213 option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON) | 239 option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON) |
214 option(LLVM_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF) | 240 option(LLVM_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF) |
215 | 241 |
299 option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF) | 325 option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF) |
300 | 326 |
301 option (LLVM_BUILD_EXTERNAL_COMPILER_RT | 327 option (LLVM_BUILD_EXTERNAL_COMPILER_RT |
302 "Build compiler-rt as an external project." OFF) | 328 "Build compiler-rt as an external project." OFF) |
303 | 329 |
330 option(LLVM_BUILD_LLVM_DYLIB "Build libllvm dynamic library" OFF) | |
331 option(LLVM_DISABLE_LLVM_DYLIB_ATEXIT "Disable llvm-shlib's atexit destructors." ON) | |
332 if(LLVM_DISABLE_LLVM_DYLIB_ATEXIT) | |
333 set(DISABLE_LLVM_DYLIB_ATEXIT 1) | |
334 endif() | |
335 | |
304 # All options referred to from HandleLLVMOptions have to be specified | 336 # All options referred to from HandleLLVMOptions have to be specified |
305 # BEFORE this include, otherwise options will not be correctly set on | 337 # BEFORE this include, otherwise options will not be correctly set on |
306 # first cmake run | 338 # first cmake run |
307 include(config-ix) | 339 include(config-ix) |
308 | 340 |
313 set(TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}") | 345 set(TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}") |
314 | 346 |
315 include(HandleLLVMOptions) | 347 include(HandleLLVMOptions) |
316 | 348 |
317 # Verify that we can find a Python 2 interpreter. Python 3 is unsupported. | 349 # Verify that we can find a Python 2 interpreter. Python 3 is unsupported. |
318 set(Python_ADDITIONAL_VERSIONS 2.7 2.6 2.5) | 350 # FIXME: We should support systems with only Python 3, but that requires work |
351 # on LLDB. | |
352 set(Python_ADDITIONAL_VERSIONS 2.7) | |
319 include(FindPythonInterp) | 353 include(FindPythonInterp) |
320 if( NOT PYTHONINTERP_FOUND ) | 354 if( NOT PYTHONINTERP_FOUND ) |
321 message(FATAL_ERROR | 355 message(FATAL_ERROR |
322 "Unable to find Python interpreter, required for builds and testing. | 356 "Unable to find Python interpreter, required for builds and testing. |
323 | 357 |
324 Please install Python or specify the PYTHON_EXECUTABLE CMake variable.") | 358 Please install Python or specify the PYTHON_EXECUTABLE CMake variable.") |
359 endif() | |
360 | |
361 if( ${PYTHON_VERSION_STRING} VERSION_LESS 2.7 ) | |
362 message(FATAL_ERROR "Python 2.7 or newer is required") | |
325 endif() | 363 endif() |
326 | 364 |
327 ###### | 365 ###### |
328 # LLVMBuild Integration | 366 # LLVMBuild Integration |
329 # | 367 # |
447 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/DataTypes.h.cmake | 485 ${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/DataTypes.h.cmake |
448 ${LLVM_INCLUDE_DIR}/llvm/Support/DataTypes.h) | 486 ${LLVM_INCLUDE_DIR}/llvm/Support/DataTypes.h) |
449 | 487 |
450 # They are not referenced. See set_output_directory(). | 488 # They are not referenced. See set_output_directory(). |
451 set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/bin ) | 489 set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/bin ) |
452 set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib ) | 490 set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} ) |
453 set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib ) | 491 set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} ) |
454 | 492 |
455 set(CMAKE_BUILD_WITH_INSTALL_RPATH ON) | 493 set(CMAKE_BUILD_WITH_INSTALL_RPATH ON) |
456 if (APPLE) | 494 if (APPLE) |
457 set(CMAKE_INSTALL_NAME_DIR "@rpath") | 495 set(CMAKE_INSTALL_NAME_DIR "@rpath") |
458 set(CMAKE_INSTALL_RPATH "@executable_path/../lib") | 496 set(CMAKE_INSTALL_RPATH "@executable_path/../lib") |
459 else(UNIX) | 497 else(UNIX) |
460 if(NOT DEFINED CMAKE_INSTALL_RPATH) | 498 if(NOT DEFINED CMAKE_INSTALL_RPATH) |
461 set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib") | 499 set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}") |
462 if (${CMAKE_SYSTEM_NAME} MATCHES FreeBSD) | 500 if (${CMAKE_SYSTEM_NAME} MATCHES FreeBSD) |
463 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,origin") | 501 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") | 502 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,origin") |
465 endif() | 503 endif() |
466 endif(NOT DEFINED CMAKE_INSTALL_RPATH) | 504 endif(NOT DEFINED CMAKE_INSTALL_RPATH) |
505 endif() | |
506 | |
507 # Work around a broken bfd ld behavior. When linking a binary with a | |
508 # foo.so library, it will try to find any library that foo.so uses and | |
509 # check its symbols. This is wasteful (the check was done when foo.so | |
510 # was created) and can fail since it is not the dynamic linker and | |
511 # doesn't know how to handle search paths correctly. | |
512 if (UNIX AND NOT APPLE) | |
513 set(CMAKE_EXE_LINKER_FLAGS | |
514 "${CMAKE_EXE_LINKER_FLAGS} -Wl,-allow-shlib-undefined") | |
467 endif() | 515 endif() |
468 | 516 |
469 set(CMAKE_INCLUDE_CURRENT_DIR ON) | 517 set(CMAKE_INCLUDE_CURRENT_DIR ON) |
470 | 518 |
471 include_directories( ${LLVM_INCLUDE_DIR} ${LLVM_MAIN_INCLUDE_DIR}) | 519 include_directories( ${LLVM_INCLUDE_DIR} ${LLVM_MAIN_INCLUDE_DIR}) |
524 endif() | 572 endif() |
525 | 573 |
526 if(LLVM_INCLUDE_TESTS) | 574 if(LLVM_INCLUDE_TESTS) |
527 add_subdirectory(utils/unittest) | 575 add_subdirectory(utils/unittest) |
528 endif() | 576 endif() |
577 | |
578 foreach( binding ${LLVM_BINDINGS_LIST} ) | |
579 if( EXISTS "${LLVM_MAIN_SRC_DIR}/bindings/${binding}/CMakeLists.txt" ) | |
580 add_subdirectory(bindings/${binding}) | |
581 endif() | |
582 endforeach() | |
529 | 583 |
530 add_subdirectory(projects) | 584 add_subdirectory(projects) |
531 | 585 |
532 if(WITH_POLLY) | 586 if(WITH_POLLY) |
533 if(NOT EXISTS ${LLVM_MAIN_SRC_DIR}/tools/polly/CMakeLists.txt) | 587 if(NOT EXISTS ${LLVM_MAIN_SRC_DIR}/tools/polly/CMakeLists.txt) |