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