-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
155 lines (141 loc) · 6.97 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
# Copyright (c) 2019 Carnegie Mellon University,
# Copyright (c) 2019 Triad National Security, LLC, as operator of
# Los Alamos National Laboratory.
# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# with the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# 3. Neither the name of CMU, TRIAD, Los Alamos National Laboratory, LANL, the
# U.S. Government, nor the names of its contributors may be used to endorse
# or promote products derived from this software without specific prior
# written permission.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# CMakeLists.txt top-level cmake file for deltafs-proto
# 16-Jun-2016 chuck@ece.cmu.edu
#
#
# configuration/build:
# - choose a build directory and "cd" to it
# - cmake [flags] directory
# - make
#
# where directory is the top-level source directory where this file resides.
#
# general cmake flags:
# -DCMAKE_INSTALL_PREFIX=/usr/local -- the prefix for installing
# -DCMAKE_BUILD_TYPE=type -- type can be DEBUG, RELEASE, ...
# -DCMAKE_PREFIX_PATH=/dir -- external packages
# -DBUILD_SHARED_LIBS=OFF -- turn ON for shared libs
# -DBUILD_TESTS=OFF -- turn ON to build tests
#
# note that CMAKE_PREFIX_PATH can be a list of directories:
# -DCMAKE_PREFIX_PATH='/dir1;/dir2;/dir3'
#
# general PDLFS config compile time options flags:
# -DPDLFS_GFLAGS=ON -- use gflags for arg parsing
# - GFLAGS_INCLUDE_DIR: optional hint for finding gflags/gflags.h
# - GFLAGS_LIBRARY_DIR: optional hint for finding gflags lib
# -DPDLFS_GLOG=ON -- use glog for logging
# -DPDLFS_SNAPPY=ON -- compile in snappy compression
# - SNAPPY_INCLUDE_DIR: optional hint for finding snappy.h
# - SNAPPY_LIBRARY_DIR: optional hint for finding snappy lib
# -DPDLFS_RADOS=ON -- compile with ceph librados
# -DPDLFS_VERBOSE=1 -- set max log verbose level
#
# DELTAFS specific compile time options flags:
# -DDELTAFS_CXX_STANDARD=11 -- CXX stardard to request
# -DDELTAFS_CXX_STANDARD_REQUIRED=OFF -- if CXX stardard must be met
# -DDELTAFS_COMMON_INTREE=OFF -- in-tree common lib (for devel)
# -DDELTAFS_MPI=OFF -- build parallel progs (for testing)
#
# note: package config files for external packages must be preinstalled in
# CMAKE_INSTALL_PATH or on CMAKE_PREFIX_PATH, except as noted.
#
#
# note: cmake 2.8.12 is considered stale, and will be deprecated.
# yet cmake 2.8.12.2 is shipped by ubuntu14.04. ubuntu14.04 won't be end of
# life until Apr 2019, though cmake 3 was later backported to ubuntu14.04
# as cmake3 (use ``sudo apt-get install cmake3'' to install).
cmake_minimum_required (VERSION 2.8.12)
project (DELTAFS-PROTO)
# add pdlfs-common cmake module directory to the path
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
"${CMAKE_CURRENT_SOURCE_DIR}/external/pdlfs-common/cmake")
# disable a subset of pdlfs modules that we don't need
set (PDLFS_SILT_ECT "OFF" CACHE BOOL "Include SILT ECT code")
set (PDLFS_MARGO_RPC "OFF" CACHE BOOL "Use Margo RPC")
set (PDLFS_MERCURY_RPC "OFF" CACHE BOOL "Use Mercury RPC")
mark_as_advanced(PDLFS_SILT_ECT PDLFS_MARGO_RPC PDLFS_MERCURY_RPC)
#
# we compile everything with -DDELTAFS_PROTO by attaching it as a property of
# the common lib. we also set the common library's name to deltafs-common
# (since we may add deltafs-proto-specific code to it) we request (but
# don't require) C++ 11 standard for possible performance improvements due
# its move semantics.
#
set (PDLFS_DFS_COMMON "ON" CACHE BOOL "Include common DFS code")
set (PDLFS_COMMON_LIBNAME "deltafs-common" CACHE
STRING "Custom name to install pdlfs-common with")
set (PDLFS_COMMON_DEFINES "DELTAFS_PROTO" CACHE
STRING "Additional defines for this version of pdlfs-common")
mark_as_advanced (PDLFS_DFS_COMMON PDLFS_COMMON_LIBNAME PDLFS_COMMON_DEFINES)
set (DELTAFS_CXX_STANDARD "11" CACHE STRING "C++ std to probe")
set (DELTAFS_CXX_STANDARD_REQUIRED "OFF" CACHE BOOL "C++ std must be met")
mark_as_advanced (DELTAFS_CXX_STANDARD DELTAFS_CXX_STANDARD_REQUIRED)
set_property (CACHE DELTAFS_CXX_STANDARD PROPERTY STRINGS "98" "11")
# note: CMAKE_CXX_STANDARD is not defined until cmake 3.1, and will be
# ignored by cmake 3.0 and before.
#
include (CheckCXXCompilerFlag)
if (CMAKE_VERSION VERSION_LESS "3.1")
set (cxxstdflag "-std=c++${DELTAFS_CXX_STANDARD}")
CHECK_CXX_COMPILER_FLAG (${cxxstdflag} flag${cxxstdflag})
if (${flag${cxxstdflag}})
add_compile_options (${cxxstdflag})
else ()
if (DELTAFS_CXX_STANDARD_REQUIRED)
message (FATAL_ERROR "Fail to enable CXX ${DELTAFS_CXX_STANDARD}")
endif ()
endif ()
else ()
set (CMAKE_CXX_STANDARD ${DELTAFS_CXX_STANDARD})
set (CMAKE_CXX_STANDARD_REQUIRED ${DELTAFS_CXX_STANDARD_REQUIRED})
endif ()
# pull in pdlfs handling of generic cmake config
include (cmake-options)
# handle all the common PDLFS options using cmake/pdlfs-options.cmake
include (pdlfs-options)
set (DELTAFS_MPI "OFF" CACHE BOOL "Build parallel tests")
#
# we build the in-tree pdlfs-common if DELTAFS_COMMON_INTREE is set,
# otherwise we look for one already built in our install or prefix path.
#
set (DELTAFS_COMMON_INTREE "OFF" CACHE BOOL
"Build in-tree common lib (mainly for devel)")
if (DELTAFS_COMMON_INTREE)
add_subdirectory (external/pdlfs-common/src)
else ()
message ("OK ${PDLFS_COMPONENT_CFG}") # XXXCDC
find_package (deltafs-common REQUIRED COMPONENTS ${PDLFS_COMPONENT_CFG})
endif ()
add_subdirectory (src)