-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
159 lines (141 loc) · 7.77 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
project (Decaf)
cmake_minimum_required (VERSION 3.0)
option (transport_mpi "Build Decaf with MPI transport layer" ON)
option (transport_cci "Build Decaf with CCI transport layer" OFF)
option (transport_file "Build Decaf with file transport layer" OFF)
option (tess_dense "Build tessellation density estimator example" OFF)
option (build_bredala "Build Bredala libraries and examples" ON)
option (build_manala "Build Manala libraries and examples" ON)
option (build_decaf "Build the Decaf workflow system" ON)
option (build_tests "Build the tests examples" ON)
option (python "Build Python bindings" ON)
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
add_subdirectory (include/pybind11)
if(build_manala)
set (build_bredala true)
endif(build_manala)
if(build_decaf)
set (build_bredala true)
set (build_manala true)
endif(build_decaf)
# OSX flags
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
add_definitions (-DMAC_OSX)
set (CMAKE_MACOSX_RPATH on)
# --- following RPATH settings are for Sierra w/ Clang, hopefully they don't hurt other versions
# ref: https://cmake.org/Wiki/CMake_RPATH_handling
# use, i.e. don't skip, the full RPATH for the build tree
set (CMAKE_SKIP_BUILD_RPATH false)
# when building, don't use the install RPATH already (but later on when installing)
set (CMAKE_BUILD_WITH_INSTALL_RPATH false)
# set RPATH to install path
set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
set (CMAKE_INSTALL_RPATH_USE_LINK_PATH true)
# the RPATH to be used when installing, but only if it's not a system directory
list (FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
"${CMAKE_INSTALL_PREFIX}/lib"
isSystemDir)
if ("${isSystemDir}" STREQUAL "-1")
set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
endif ()
endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# C++11
set (CMAKE_CXX_STANDARD 14)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
# MPI
if (transport_mpi)
find_package (MPI REQUIRED)
if (NOT bgq)
set (transport_libraries ${transport_libraries} ${MPI_C_LIBRARIES} ${MPI_CXX_LIBRARIES})
endif ()
add_definitions (-DTRANSPORT_MPI)
set (TRANSPORT_MPI ON)
endif (transport_mpi)
#CCI
if (transport_cci)
find_package (MPI REQUIRED)
find_package (CCI REQUIRED)
set (transport_libraries ${transport_libraries} ${MPI_C_LIBRARIES} ${MPI_CXX_LIBRARIES} ${CCI_LIBRARY})
include_directories (${CCI_INCLUDE_DIR})
add_definitions (-DTRANSPORT_CCI)
set (TRANSPORT_CCI ON)
endif (transport_cci)
#FILE
#Should be used with the variable HDF5_PREFER_PARALLEL set to true
if (transport_file)
find_package (HDF5 REQUIRED)
include_directories (${HDF5_INCLUDE_DIR})
set (transport_libraries ${transport_libraries} ${HDF5_LIBRARIES})
add_definitions (-DTRANSPORT_FILE)
set (TRANSPORT_FILE ON)
endif (transport_file)
# Boost
find_package (Boost 1.59.0 COMPONENTS serialization REQUIRED)
message (STATUS "Boost libraries: " ${Boost_LIBRARIES})
# Set include directories
set (CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem")
include_directories (${Boost_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/include
SYSTEM ${MPI_INCLUDE_PATH})
# Set libraries
set (libraries
${libraries}
${transport_libraries}
${CMAKE_DL_LIBS})
set (CMAKE_LINKER_FLAGS ${CMAKE_LINKER_FLAGS} "-Wl,--export-dynamic -dynamic")
# subdirectories
add_subdirectory (src)
add_subdirectory (examples)
add_subdirectory (python)
if (python)
add_subdirectory (bindings/python)
endif (python)
if (build_tests)
add_subdirectory (tests)
endif ()
# Install the headers
if(build_bredala)
file (GLOB DEPLOY_FILES_AND_DIRS "${PROJECT_SOURCE_DIR}/include/bredala/*")
foreach (ITEM ${DEPLOY_FILES_AND_DIRS})
if (IS_DIRECTORY "${ITEM}")
list (APPEND DIRS_TO_DEPLOY "${ITEM}")
else ()
list (APPEND FILES_TO_DEPLOY "${ITEM}")
endif ()
endforeach ()
install (FILES ${FILES_TO_DEPLOY} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/bredala)
install (DIRECTORY ${DIRS_TO_DEPLOY} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/bredala)
endif(build_bredala)
if(build_manala)
file (GLOB DEPLOY_FILES_AND_DIRS "${PROJECT_SOURCE_DIR}/include/manala/*")
foreach (ITEM ${DEPLOY_FILES_AND_DIRS})
if (IS_DIRECTORY "${ITEM}")
list (APPEND DIRS_TO_DEPLOY "${ITEM}")
else ()
list (APPEND FILES_TO_DEPLOY "${ITEM}")
endif ()
endforeach ()
install (FILES ${FILES_TO_DEPLOY} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/manala)
install (DIRECTORY ${DIRS_TO_DEPLOY} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/manala)
endif(build_manala)
if(build_decaf)
file (GLOB DEPLOY_FILES_AND_DIRS "${PROJECT_SOURCE_DIR}/include/decaf/*")
foreach (ITEM ${DEPLOY_FILES_AND_DIRS})
if (IS_DIRECTORY "${ITEM}")
list (APPEND DIRS_TO_DEPLOY "${ITEM}")
else ()
list (APPEND FILES_TO_DEPLOY "${ITEM}")
endif ()
endforeach ()
install (FILES ${FILES_TO_DEPLOY} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/decaf)
install (DIRECTORY ${DIRS_TO_DEPLOY} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/decaf)
endif(build_decaf)
install ( FILES cmake/FindDecaf.cmake DESTINATION ${CMAKE_INSTALL_PREFIX}/cmake)
#Configure the config file
configure_file (include/config_decaf.h.cmakein include/config_decaf.h)
install (FILES ${CMAKE_BINARY_DIR}/include/config_decaf.h
DESTINATION ${CMAKE_INSTALL_PREFIX}/include)