| Edward O'Callaghan | d904635 | 2009-08-03 01:08:25 +0000 | [diff] [blame] | 1 | # See docs/CMake.html for instructions about how to build Compiler-RT with CMake. |
| 2 | |
| Edward O'Callaghan | 8bf1e09 | 2009-08-09 18:41:02 +0000 | [diff] [blame] | 3 | PROJECT( CompilerRT C ) |
| Edward O'Callaghan | 880cafc | 2009-08-03 02:15:06 +0000 | [diff] [blame] | 4 | CMAKE_MINIMUM_REQUIRED( VERSION 2.6 ) |
| Edward O'Callaghan | d904635 | 2009-08-03 01:08:25 +0000 | [diff] [blame] | 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 | |
| Edward O'Callaghan | 6c307f0 | 2009-08-03 05:59:48 +0000 | [diff] [blame] | 11 | SET( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules ) |
| 12 | |
| Edward O'Callaghan | 0e4ad9c | 2009-08-05 01:47:29 +0000 | [diff] [blame] | 13 | # add definitions |
| 14 | include(DefineCompilerFlags) |
| 15 | |
| Edward O'Callaghan | 6c307f0 | 2009-08-03 05:59:48 +0000 | [diff] [blame] | 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 | ) |
| Edward O'Callaghan | d904635 | 2009-08-03 01:08:25 +0000 | [diff] [blame] | 21 | |
| Daniel Dunbar | fe4eb31 | 2010-01-13 16:12:49 +0000 | [diff] [blame] | 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 ) |
| Edward O'Callaghan | 0e4ad9c | 2009-08-05 01:47:29 +0000 | [diff] [blame] | 25 | |
| Edward O'Callaghan | d4048aa | 2009-09-12 16:44:57 +0000 | [diff] [blame] | 26 | INCLUDE_DIRECTORIES( |
| 27 | ${CMAKE_CURRENT_BINARY_DIR} |
| 28 | ) |
| 29 | |
| Edward O'Callaghan | 8bf1e09 | 2009-08-09 18:41:02 +0000 | [diff] [blame] | 30 | SET( Achitectures |
| Edward O'Callaghan | 7b268dc | 2009-09-14 12:45:07 +0000 | [diff] [blame] | 31 | i386 x86_64 ppc arm |
| Edward O'Callaghan | 8bf1e09 | 2009-08-09 18:41:02 +0000 | [diff] [blame] | 32 | ) |
| 33 | |
| 34 | SET( Configurations |
| 35 | Debug Release Profile |
| 36 | ) |
| 37 | |
| Shantonu Sen | 6311a30 | 2009-09-23 16:05:25 +0000 | [diff] [blame] | 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 ) |
| Edward O'Callaghan | d904635 | 2009-08-03 01:08:25 +0000 | [diff] [blame] | 44 | |
| Shantonu Sen | 6311a30 | 2009-09-23 16:05:25 +0000 | [diff] [blame] | 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 ) |
| Daniel Dunbar | fe4eb31 | 2010-01-13 16:12:49 +0000 | [diff] [blame] | 50 | |
| Edward O'Callaghan | 0e4ad9c | 2009-08-05 01:47:29 +0000 | [diff] [blame] | 51 | ADD_SUBDIRECTORY( lib ) |
| 52 | |
| Edward O'Callaghan | 786d7d6 | 2009-10-31 21:08:10 +0000 | [diff] [blame] | 53 | # Enable Test Suit: |
| Edward O'Callaghan | e4ff347 | 2009-10-27 23:23:41 +0000 | [diff] [blame] | 54 | INCLUDE( MacroAddCheckTest ) |
| Edward O'Callaghan | cc75801 | 2009-10-17 10:19:32 +0000 | [diff] [blame] | 55 | ADD_SUBDIRECTORY( test ) |