forked from hpc/mpifileutils
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
206 lines (167 loc) · 6.58 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
PROJECT(MFU)
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
IF(POLICY CMP0042)
CMAKE_POLICY(SET CMP0042 NEW)
ENDIF(POLICY CMP0042)
SET(CMAKE_MACOSX_RPATH ON)
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
# Configuration Options
OPTION(ENABLE_XATTRS "Enable code for extended attributes" ON)
MESSAGE(STATUS "ENABLE_XATTRS: ${ENABLE_XATTRS}")
IF(ENABLE_XATTRS)
ADD_DEFINITIONS(-DDCOPY_USE_XATTRS)
FIND_PACKAGE(LibAttr REQUIRED)
IF(LibAttr_FOUND)
ADD_DEFINITIONS(-DHAVE_LIBATTR)
INCLUDE_DIRECTORIES(${LibAttr_INCLUDE_DIRS})
LIST(APPEND MFU_EXTERNAL_LIBS ${LibAttr_LIBRARIES})
ENDIF(LibAttr_FOUND)
ENDIF(ENABLE_XATTRS)
OPTION(ENABLE_LUSTRE "Enable optimization and features for Lustre" OFF)
MESSAGE(STATUS "ENABLE_LUSTRE: ${ENABLE_LUSTRE}")
IF(ENABLE_LUSTRE)
ADD_DEFINITIONS(-DLUSTRE_SUPPORT)
FIND_LIBRARY(LUSTREAPI lustreapi)
IF(LUSTREAPI)
# INCLUDE_DIRECTORIES(${LUSTREAPI_INCLUDE_DIRS})
LIST(APPEND MFU_EXTERNAL_LIBS ${LUSTREAPI})
ENDIF(LUSTREAPI)
INCLUDE(CheckLibraryExists)
CHECK_LIBRARY_EXISTS(lustreapi llapi_layout_alloc ${LUSTREAPI} HAVE_LLAPI_LAYOUT)
IF(HAVE_LLAPI_LAYOUT)
ADD_DEFINITIONS(-DHAVE_LLAPI_LAYOUT)
ENDIF(HAVE_LLAPI_LAYOUT)
CHECK_LIBRARY_EXISTS(lustreapi llapi_file_create ${LUSTREAPI} HAVE_LLAPI_FILE_CREATE)
IF(HAVE_LLAPI_FILE_CREATE)
ADD_DEFINITIONS(-DHAVE_LLAPI_FILE_CREATE)
ENDIF(HAVE_LLAPI_FILE_CREATE)
CHECK_LIBRARY_EXISTS(lustreapi llapi_file_get_stripe ${LUSTREAPI} HAVE_LLAPI_FILE_GET_STRIPE)
IF(HAVE_LLAPI_FILE_GET_STRIPE)
ADD_DEFINITIONS(-DHAVE_LLAPI_FILE_GET_STRIPE)
ENDIF(HAVE_LLAPI_FILE_GET_STRIPE)
# todo investigate usage of other lustre #defs
# - LUSTRE_STAT
ENDIF(ENABLE_LUSTRE)
OPTION(ENABLE_HPSS "Enable optimization and features for HPSSFS-FUSE" OFF)
MESSAGE(STATUS "ENABLE_HPSS: ${ENABLE_HPSS}")
IF(ENABLE_HPSS)
ADD_DEFINITIONS(-DHPSS_SUPPORT)
ENDIF(ENABLE_HPSS)
OPTION(ENABLE_GPFS "Enable GFPS/Spectrum Scale support")
MESSAGE(STATUS "ENABLE_GPFS: ${ENABLE_GPFS}")
IF(ENABLE_GPFS)
FIND_PACKAGE(GPFS REQUIRED)
INCLUDE_DIRECTORIES(${GPFS_INCLUDE_DIRS})
LIST(APPEND MFU_EXTERNAL_LIBS ${GPFS_LIBRARIES})
ADD_DEFINITIONS(-DGPFS_SUPPORT)
ENDIF(ENABLE_GPFS)
OPTION(ENABLE_EXPERIMENTAL "Build experimental tools" OFF)
MESSAGE(STATUS "ENABLE_EXPERIMENTAL: ${ENABLE_EXPERIMENTAL}")
## HEADERS
INCLUDE(CheckIncludeFile)
CHECK_INCLUDE_FILE(byteswap.h HAVE_BYTESWAP_H)
if(HAVE_BYTESWAP_H)
ADD_DEFINITIONS(-DHAVE_BYTESWAP_H)
ELSE(HAVE_BYTESWAP_H)
MESSAGE(SEND_ERROR "byteswap.h is required")
ENDIF(HAVE_BYTESWAP_H)
# Dependencies
## MPI
INCLUDE(SetupMPI)
INCLUDE_DIRECTORIES(${MPI_C_INCLUDE_PATH})
LIST(APPEND MFU_EXTERNAL_LIBS ${MPI_C_LIBRARIES})
## DTCMP
FIND_PACKAGE(DTCMP REQUIRED)
INCLUDE_DIRECTORIES(${DTCMP_INCLUDE_DIRS})
LIST(APPEND MFU_EXTERNAL_LIBS ${DTCMP_LIBRARIES})
## LIBARCHIVE
OPTION(ENABLE_LIBARCHIVE "Enable usage of libarchive and corresponding tools" ON)
MESSAGE(STATUS "ENABLE_LIBARCHIVE: ${ENABLE_LIBARCHIVE}")
# TODO how would we pass a version from spack?
# libarchive 3.1.2 is available on some systems,
# but pick a newer libarchive to avoid bug with files starting with "._",
# which is misinterpretted as a MacOS extension on Linuxlibarchive 3.1.2
IF(ENABLE_LIBARCHIVE)
FIND_PACKAGE(LibArchive 3.5.1 REQUIRED)
INCLUDE_DIRECTORIES(${LibArchive_INCLUDE_DIRS})
LIST(APPEND MFU_EXTERNAL_LIBS ${LibArchive_LIBRARIES})
ADD_DEFINITIONS(-DLIBARCHIVE_SUPPORT)
ENDIF(ENABLE_LIBARCHIVE)
## hdf5
OPTION(ENABLE_HDF5 "Enable HDF5 library")
MESSAGE(STATUS "ENABLE_HDF5: ${ENABLE_HDF5}")
IF(ENABLE_HDF5)
FIND_PACKAGE(HDF5 REQUIRED)
INCLUDE_DIRECTORIES(${HDF5_INCLUDE_DIRS})
LIST(APPEND MFU_EXTERNAL_LIBS ${HDF5_LIBRARIES})
ADD_DEFINITIONS(-DHDF5_SUPPORT)
ADD_DEFINITIONS(-DHDF5_BIN_DIR=\"${HDF5_BIN_DIR}\")
ENDIF(ENABLE_HDF5)
OPTION(ENABLE_DAOS "Enable DAOS support")
MESSAGE(STATUS "ENABLE_DAOS: ${ENABLE_DAOS}")
IF(ENABLE_DAOS)
SET(CMAKE_EXE_LINKER_FLAGS -luuid)
FIND_PACKAGE(DAOS REQUIRED)
INCLUDE_DIRECTORIES(${DAOS_INCLUDE_DIRS})
LIST(APPEND MFU_EXTERNAL_LIBS ${DAOS_LIBRARIES})
LIST(APPEND MFU_EXTERNAL_LIBS ${GURT_LIBRARIES})
LIST(APPEND MFU_EXTERNAL_LIBS ${CART_LIBRARIES})
LIST(APPEND MFU_EXTERNAL_LIBS ${DUNS_LIBRARIES})
LIST(APPEND MFU_EXTERNAL_LIBS ${DFS_LIBRARIES})
LIST(APPEND MFU_EXTERNAL_LIBS ${DAOS_COMMON_LIBRARIES})
ADD_DEFINITIONS(-DDAOS_SUPPORT)
ENDIF(ENABLE_DAOS)
## LIBCIRCLE
FIND_PACKAGE(LibCircle REQUIRED)
INCLUDE_DIRECTORIES(${LibCircle_INCLUDE_DIRS})
LIST(APPEND MFU_EXTERNAL_LIBS ${LibCircle_LIBRARIES})
## BZip2
FIND_PACKAGE(BZip2 REQUIRED)
LIST(APPEND MFU_EXTERNAL_LIBS ${BZIP2_LIBRARIES})
## libcap for checks on linux capabilities
FIND_PACKAGE(LibCap)
IF(LibCap_FOUND)
ADD_DEFINITIONS(-DHAVE_LIBCAP)
INCLUDE_DIRECTORIES(${LibCap_INCLUDE_DIRS})
LIST(APPEND MFU_EXTERNAL_LIBS ${LibCap_LIBRARIES})
ENDIF(LibCap_FOUND)
## OPENSSL for ddup
FIND_PACKAGE(OpenSSL)
# Setup Installation
INCLUDE(GNUInstallDirs)
SET(X_BINDIR ${CMAKE_INSTALL_FULL_BINDIR} CACHE INTERNAL "bin")
SET(X_DATADIR ${CMAKE_INSTALL_FULL_DATADIR} CACHE INTERNAL "share")
SET(X_INCLUDEDIR ${CMAKE_INSTALL_FULL_INCLUDEDIR} CACHE INTERNAL "include")
SET(X_LIBDIR ${CMAKE_INSTALL_FULL_LIBDIR} CACHE INTERNAL "lib")
############
# This sets an rpath to buildtime libraries in build directory
# and rewrites the rpath to the install location during install
# these lines must come before add_library and add_executable macros
############
# https://gitlab.kitware.com/cmake/community/wikis/doc/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(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
# 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}/${CMAKE_INSTALL_LIBDIR}" isSystemDir)
IF("${isSystemDir}" STREQUAL "-1")
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
ENDIF("${isSystemDir}" STREQUAL "-1")
############
# End rpath stuff
############
# Subdirectories
INCLUDE(MFU_ADD_TOOL)
# use BEFORE to place build directory first when searching for header files
# otherwise the build can use old header files from the install path instead
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/src/common)
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(test)
ADD_SUBDIRECTORY(man)