blob: 4e6f56563b333ab3be8a062272a7d4851b5eec0b [file] [log] [blame]
Edward O'Callaghand9046352009-08-03 01:08:25 +00001# See docs/CMake.html for instructions about how to build Compiler-RT with CMake.
2
Edward O'Callaghan8bf1e092009-08-09 18:41:02 +00003PROJECT( CompilerRT C )
Edward O'Callaghan880cafc2009-08-03 02:15:06 +00004CMAKE_MINIMUM_REQUIRED( VERSION 2.6 )
Edward O'Callaghand9046352009-08-03 01:08:25 +00005
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
Edward O'Callaghan6c307f02009-08-03 05:59:48 +000011SET( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules )
12
Edward O'Callaghan0e4ad9c2009-08-05 01:47:29 +000013# add definitions
14include(DefineCompilerFlags)
15
Edward O'Callaghan6c307f02009-08-03 05:59:48 +000016# 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 )
Edward O'Callaghand9046352009-08-03 01:08:25 +000021
Edward O'Callaghan0e4ad9c2009-08-05 01:47:29 +000022INCLUDE( ConfigureChecks.cmake )
23CONFIGURE_FILE( config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
24
Edward O'Callaghand4048aa2009-09-12 16:44:57 +000025INCLUDE_DIRECTORIES(
26 ${CMAKE_CURRENT_BINARY_DIR}
27)
28
Edward O'Callaghan8bf1e092009-08-09 18:41:02 +000029SET( Achitectures
Edward O'Callaghan7b268dc2009-09-14 12:45:07 +000030 i386 x86_64 ppc arm
Edward O'Callaghan8bf1e092009-08-09 18:41:02 +000031 )
32
33SET( Configurations
34 Debug Release Profile
35 )
36
Shantonu Sen6311a302009-09-23 16:05:25 +000037# Only build Blocks Runtime if the compiler has enough support
38IF( WIN32 OR MSVC OR HAVE_OSATOMIC_COMPARE_AND_SWAP_INT OR HAVE_SYNC_BOOL_COMPARE_AND_SWAP_INT )
39 SET(BUILD_BLOCKS_RUNTIME TRUE)
40ELSE( WIN32 OR MSVC OR HAVE_OSATOMIC_COMPARE_AND_SWAP_INT OR HAVE_SYNC_BOOL_COMPARE_AND_SWAP_INT )
41 SET(BUILD_BLOCKS_RUNTIME FALSE)
42ENDIF( WIN32 OR MSVC OR HAVE_OSATOMIC_COMPARE_AND_SWAP_INT OR HAVE_SYNC_BOOL_COMPARE_AND_SWAP_INT )
Edward O'Callaghand9046352009-08-03 01:08:25 +000043
Shantonu Sen6311a302009-09-23 16:05:25 +000044IF( BUILD_BLOCKS_RUNTIME )
45 ADD_SUBDIRECTORY( BlocksRuntime )
46ELSE( BUILD_BLOCKS_RUNTIME )
47 MESSAGE(STATUS "No suitable atomic operation routines detected, skipping Blocks Runtime")
48ENDIF( BUILD_BLOCKS_RUNTIME )
49
Edward O'Callaghan0e4ad9c2009-08-05 01:47:29 +000050ADD_SUBDIRECTORY( lib )
51
52# Tests are being ignored for until the very basics are working.
Edward O'Callaghane4ff3472009-10-27 23:23:41 +000053INCLUDE( MacroAddCheckTest )
Edward O'Callaghancc758012009-10-17 10:19:32 +000054ADD_SUBDIRECTORY( test )