-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
77 lines (56 loc) · 2.2 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
cmake_minimum_required(VERSION 2.8.4)
Project(BabelFlow)
set(CMAKE_VERBOSE_MAKEFILE TRUE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMake")
set(RUNTIME_TYPE "MPI" CACHE STRING "Runtime Controller (MPI, CHARM, LEGION)")
set_property(CACHE RUNTIME_TYPE PROPERTY STRINGS MPI CHARM LEGION)
if(${RUNTIME_TYPE} MATCHES "MPI")
set(ENABLE_MPI TRUE)
set(ENABLE_CHARM FALSE)
set(ENABLE_LEGION FALSE)
message("Using MPI Runtime Controller")
elseif(${RUNTIME_TYPE} MATCHES "CHARM")
set(ENABLE_CHARM TRUE)
set(ENABLE_MPI FALSE)
set(ENABLE_LEGION FALSE)
message("Using Charm++ Runtime Controller")
elseif(${RUNTIME_TYPE} MATCHES "LEGION")
set(ENABLE_CHARM FALSE)
set(ENABLE_MPI FALSE)
set(ENABLE_LEGION TRUE)
message("Using Legion Runtime Controller")
endif()
if (ENABLE_CHARM)
find_package(Charm REQUIRED)
set(CMAKE_C_COMPILER ${CHARM_COMPILER})
set(CMAKE_CXX_COMPILER ${CHARM_COMPILER})
set(BABELFLOW_INCLUDE_PATH ${CMAKE_CURRENT_BINARY_DIR}/src/charm)
elseif(ENABLE_MPI)
if(CMAKE_GENERATOR STREQUAL Xcode)
set(APPLE_CXX_COMPILER mpicxx)
endif()
find_package(MPI REQUIRED)
include_directories(${MPI_C_INCLUDE_PATH})
set(CMAKE_CXX_COMPILER ${MPI_CXX_COMPILER})
set(CMAKE_C_COMPILER ${MPI_C_COMPILER})
set(BABELFLOW_INCLUDE_PATH ${MPI_CXX_INCLUDE_PATH})
set(BABELFLOW_LIBRARIES ${MPI_CXX_LIBRARIES})
elseif(ENABLE_LEGION)
endif()
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set (CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/" CACHE PATH "default install path" FORCE )
endif()
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
add_subdirectory(src)
add_subdirectory(examples)
export(PACKAGE BabelFlow)
install(FILES CMake/FindBabelFlow.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/BabelFlow)