-
Notifications
You must be signed in to change notification settings - Fork 11
/
CMakeLists.txt
171 lines (117 loc) · 5.31 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
160
161
162
163
164
165
166
167
168
169
170
171
cmake_minimum_required( VERSION 3.12 FATAL_ERROR )
find_package( ecbuild 3.7 REQUIRED HINTS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../ecbuild)
project( fdb5 LANGUAGES C CXX )
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
CHECK_TYPE_SIZE(off_t SIZEOF_OFF_T)
if ("${SIZEOF_OFF_T}" LESS 8)
MESSAGE(SEND_ERROR "Missing support for large files (off_t size < 64 bits)")
endif()
########################################################################################################################
### dependencies and options
### eckit
set( PERSISTENT_NAMESPACE "eckit" CACHE INTERNAL "" ) # needed for generating .b files for persistent support
ecbuild_find_package( NAME eckit VERSION 1.28.3 REQUIRED )
### GRIB support
ecbuild_find_package( NAME eccodes VERSION 2.10 QUIET )
ecbuild_add_option( FEATURE GRIB
DEFAULT ON
CONDITION eccodes_FOUND
DESCRIPTION "Support for GRIB via eccodes")
ecbuild_find_package( NAME metkit VERSION 1.11.22 REQUIRED )
### FDB backend in persistent memory, i.e. pmem (NVRAM)
ecbuild_add_option( FEATURE PMEMFDB # option present in fdb5_config.h
DEFAULT OFF
DESCRIPTION "Persistent memory (NVRAM) support for FDB"
REQUIRED_PACKAGES "NAME pmem" )
### FDB backend in CEPH object store (using Rados)
find_package( RADOS QUIET )
ecbuild_add_option( FEATURE RADOSFDB # option defined in fdb5_config.h
CONDITION eckit_HAVE_RADOS AND RADOS_FOUND
DEFAULT OFF
DESCRIPTION "Ceph/Rados support for FDB Store" )
### FDB backend in indexed filesystem with table-of-contents, i.e. TOC
### Supports Lustre parallel filesystem stripping control
ecbuild_add_option( FEATURE TOCFDB # option defined in fdb5_config.h
DEFAULT ON
DESCRIPTION "Filesystem TOC support for FDB" )
### support for Lustre API control of file stripping
find_package( LUSTREAPI QUIET )
ecbuild_add_option( FEATURE LUSTRE # option defined in fdb5_config.h
CONDITION LUSTREAPI_FOUND
DEFAULT ON
DESCRIPTION "Support for Lustre API control of file stripping " )
### experimental & sandbox features
ecbuild_add_option( FEATURE FDB_REMOTE
DEFAULT ON
DESCRIPTION "Support for FDB remote access" )
find_package(UUID QUIET)
find_package(DAOS QUIET)
set(_default_dummy_daos ON)
if(DAOS_FOUND)
set(_default_dummy_daos OFF)
endif()
ecbuild_add_option( FEATURE DUMMY_DAOS
DEFAULT ${_default_dummy_daos}
CONDITION UUID_FOUND
DESCRIPTION "Use dummy DAOS library emulating DAOS with a file system" )
if(HAVE_DUMMY_DAOS)
set(DAOS_LIBRARIES dummy_daos)
set(DAOS_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src/dummy_daos)
set(DAOS_FOUND TRUE)
set(DAOS_TESTS_LIBRARIES dummy_daos_tests)
set(DAOS_TESTS_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src/dummy_daos)
set(DAOS_TESTS_FOUND TRUE)
endif()
ecbuild_add_option( FEATURE DAOSFDB
CONDITION DAOS_FOUND AND UUID_FOUND
DEFAULT ON
DESCRIPTION "DAOS support for FDB Store" )
ecbuild_add_option( FEATURE DAOS_ADMIN
DEFAULT ${_default_dummy_daos}
CONDITION HAVE_DAOSFDB AND DAOS_TESTS_FOUND
DESCRIPTION "Add features for DAOS pool management. Removes need to manually create a pool for DAOS unit tests" )
# DAOS_TESTS is a daos admin library, usually not present
if(NOT HAVE_DAOS_ADMIN)
set( DAOS_TESTS_LIBRARIES "" )
set( DAOS_TESTS_INCLUDE_DIRS "" )
endif()
ecbuild_add_option( FEATURE EXPERIMENTAL
DEFAULT OFF
DESCRIPTION "Experimental features" )
ecbuild_add_option( FEATURE SANDBOX
DESCRIPTION "build the sandbox stuff"
DEFAULT OFF )
### build the tools
ecbuild_add_option( FEATURE BUILD_TOOLS
DEFAULT ON
DESCRIPTION "Build the command line tools" )
if(HAVE_BUILD_TOOLS)
set(_default_fdb_tools ON)
else()
set(_default_fdb_tools OFF)
endif()
ecbuild_add_option( FEATURE FDB_BUILD_TOOLS
DEFAULT ${_default_fdb_tools}
DESCRIPTION "Build the command line FDB tools" )
### find thread library ( preferably pthreads )
set( CMAKE_THREAD_PREFER_PTHREAD 1 )
find_package(Threads REQUIRED)
### checks
# check thread library is pthreads
if( NOT ${CMAKE_USE_PTHREADS_INIT} )
message( FATAL_ERROR "Only pthreads supported - thread library found is [${CMAKE_THREAD_LIBS_INIT}]" )
endif()
########################################################################################################################
# contents
include(cmake/compiler_warnings.cmake) # optionally handle compiler specific warnings
set( fdb5_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/src )
include_directories( ${fdb5_INCLUDE_DIRS} )
set_directory_properties( PROPERTIES COMPILE_DEFINITIONS "${ECKIT_DEFINITIONS};${ECCODES_DEFINITIONS}" )
get_directory_property( fdb5_DEFINITIONS COMPILE_DEFINITIONS )
### source files
add_subdirectory( src )
add_subdirectory( tests )
### finalize
ecbuild_install_project( NAME fdb )
ecbuild_print_summary()