Shih-wei Liao | 77ed614 | 2010-04-07 12:21:42 -0700 | [diff] [blame] | 1 | # See docs/CMake.html for instructions about how to build Compiler-RT with CMake. |
| 2 | |
| 3 | PROJECT( CompilerRT C ) |
| 4 | CMAKE_MINIMUM_REQUIRED( VERSION 2.6 ) |
| 5 | |
| 6 | set(PACKAGE_NAME compiler-rt) |
| 7 | set(PACKAGE_VERSION 1.0svn) |
| 8 | set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") |
| 9 | set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu") |
| 10 | |
| 11 | SET( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules ) |
| 12 | |
| 13 | # add definitions |
| 14 | include(DefineCompilerFlags) |
| 15 | |
| 16 | # Disallow in-source build |
| 17 | INCLUDE( MacroEnsureOutOfSourceBuild ) |
| 18 | MACRO_ENSURE_OUT_OF_SOURCE_BUILD( |
| 19 | "${PROJECT_NAME} requires an out of source build. Please create a separate build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there." |
| 20 | ) |
| 21 | |
| 22 | INCLUDE( ${CMAKE_SOURCE_DIR}/cmake/ConfigureChecks.cmake ) |
| 23 | CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/cmake/config.h.cmake |
| 24 | ${CMAKE_CURRENT_BINARY_DIR}/config.h ) |
| 25 | |
| 26 | INCLUDE_DIRECTORIES( |
| 27 | ${CMAKE_CURRENT_BINARY_DIR} |
| 28 | ) |
| 29 | |
| 30 | SET( Achitectures |
| 31 | i386 x86_64 ppc arm |
| 32 | ) |
| 33 | |
| 34 | SET( Configurations |
| 35 | Debug Release Profile |
| 36 | ) |
| 37 | |
| 38 | # Only build Blocks Runtime if the compiler has enough support |
| 39 | IF( WIN32 OR MSVC OR HAVE_OSATOMIC_COMPARE_AND_SWAP_INT OR HAVE_SYNC_BOOL_COMPARE_AND_SWAP_INT ) |
| 40 | SET(BUILD_BLOCKS_RUNTIME TRUE) |
| 41 | ELSE( WIN32 OR MSVC OR HAVE_OSATOMIC_COMPARE_AND_SWAP_INT OR HAVE_SYNC_BOOL_COMPARE_AND_SWAP_INT ) |
| 42 | SET(BUILD_BLOCKS_RUNTIME FALSE) |
| 43 | ENDIF( WIN32 OR MSVC OR HAVE_OSATOMIC_COMPARE_AND_SWAP_INT OR HAVE_SYNC_BOOL_COMPARE_AND_SWAP_INT ) |
| 44 | |
| 45 | IF( BUILD_BLOCKS_RUNTIME ) |
| 46 | ADD_SUBDIRECTORY( BlocksRuntime ) |
| 47 | ELSE( BUILD_BLOCKS_RUNTIME ) |
| 48 | MESSAGE(STATUS "No suitable atomic operation routines detected, skipping Blocks Runtime") |
| 49 | ENDIF( BUILD_BLOCKS_RUNTIME ) |
| 50 | |
| 51 | ADD_SUBDIRECTORY( lib ) |
| 52 | |
| 53 | # Enable Test Suit: |
| 54 | INCLUDE( MacroAddCheckTest ) |
| 55 | ADD_SUBDIRECTORY( test ) |