2014-06-23 22:32:32 +00:00
|
|
|
cmake_minimum_required(VERSION 2.8.11)
|
|
|
|
|
2016-05-28 08:38:09 +00:00
|
|
|
project(ceph)
|
2016-12-12 18:27:56 +00:00
|
|
|
set(VERSION 11.1.0)
|
2014-06-23 22:32:32 +00:00
|
|
|
|
2016-07-29 04:24:14 +00:00
|
|
|
if(POLICY CMP0046)
|
Ceph Accelio/RDMA Transport (XioMessenger).
XioMessenger implements a Ceph Messenger provider for Accelio,
a high-performance messaging transport by Mellanox. Current
Accelio is layered on ibverbs, and supports Infiniband, ROCE,
and other RDMA transports. Future Accelio verions will support
alternative transports (including TCP), and flexible transport
selection.
config: cluster_rdma drives messenger creation
ceph_mds ceph_mon and ceph_osd use XioMessengers for cluster
communication when cluster_rdma is set
Move XioMessenger to msg/xio.
This matches the other new Messenger locations.
test: tests for tcp and xio messengers
(Not tests only.)
buffer: add subclass for xio buffers
xio: convert to Connection::send_message interface
config: -x, --xio as aliases for client_rdma
ceph-fuse: create xio messenger if client_rdma
Find XioMessenger.h and QueueStrategy.h in msg/xio.
ceph-syn: create xio messenger if client_rdma
librados: create xio messenger if client_rdma
Find XioMessenger.h and QueueStrategy.h in msg/xio.
Restore non-abort from Xio Mon integration.
Fix xio_client send count, again.
xio: must signal cond under mutex lock
xio: dispatch strategies support ms_fast_dispatch
xio: config variable xio_port_shift
remove set_port_shift() from XioMessenger, and just use the value
from the configuration
xio: don't depend on g_ceph_context for dout
XioMessenger now uses its own cct for all logging operations
the accelio log function, however, still depends on a global
CephContext. so we maintain an extra one, separate from g_ceph_context,
in XioMessenger.cc that is initialized on first construction and a
reference is held indefinitely
script: cephfsnew to automate pool and fs creation
Use new on_ow_msg_send_complete hook.
Replaces on_msg_delivered for one-way message style.
Prototype new xio_discon behavior.
On shutdown, XioPortal threads should not exit before Accelio
finalizes all sessions.
Inline join_sessions, it needs sh_mtx held across wait loop.
Fix assert on Cond::Signal. Adds Cond2.
Avoid deadlock, xio_disconnect can deliver a session teardown event.
Also Mutex2.
(Note, Mutex2 and Cond2 are replaced by standard C++ downstream.)
Restore SimpleDispatcher Timings.
The simple_client/simple_server timings are based on a ping/pong
of messages between the client and server, unlike those of the
xio_client/server programs, which are one-way (so their corresponding
1-way bandwidth is appx. 2x what the test reports). We assert
that the results are in general comparable, because in both setups,
a fixed number of messages (def. 50) is maintained in flight.
Wrap Accelio mempool in XioPool, add stats.
To enable stat prints, set xio_trace_mempool. Currently, prints
to stdout at each 64K messages sent or received.
Restore _send_message(..).
Fix merge errors in simple_client, simple_dispatcher.
xio: fix for size in pool stats
Add in/outbound msg counters to XioPoolStats.
Pool stats are easier to read.
Pool stats are easier to read, and if enabled, print on session
teardown. This is a convenient time to view stats, and with a small
Make pool stats counters atomic.
Track requests using hook ctor/dtor.
Lockless, portal thread provides atomicity.
Adapt to recent changes on Accelio for_next
* Accelio options now of opaque type
* on_msg_err with extra direction param
* RDMA behavior now governed by 2 new options
XIO_OPTNAME_MAX_INLINE_DATA
XIO_OPTNAME_MAX_INLINE_HEADER
* Separated send and recv queue depth
xio_messenger: Change xio optname queue depth msgs
* Set 16k threshold to rdma buffers instead of send
* Change xio optname for queue depth msgs
XIO_OPTNAME_SND/RCV_QUEUE_DEPTH_MSGS
xio_messenger: Protect Accelio queue depth.
(Minimal send flow control.)
The guard is per xio_connection, and considering batches.
Increment happens only if xio_send_msg succeeded, decrement in
on_ms_ow_send_complete and on_msg_error. Note that we don't need
atomics because counters are touched only in the correct portal
thread.
Find XioMsg.h in msg/xio
Find XioMessenger.h and QueueStrategy.h in msg/xio (tests).
Adapt to 2 Accelio API changes.
1. xio_context_stop loop takes only 1 argument
2. xio_connect() now takes a structure argument, by reference
Set CMP0046 iif CMake version >= 3
Move XioMessenger to msg/xio
xio: fix for segfault on xio_connect()
No more Mutex2, Cond2.
xio: number of portal threads is configurable
xio: only create additional portals on bind()
xio: use QueueStrategy(1) as default
xio: Messenger factory accepts ms_type "xio"
xio: use ms_type instead of client,cluster_rdma
removing the ability to configure the client and cluster networks
separately in favor of a single global messenger type
--xio is now a command-line alias for --ms_type xio
all daemons now use the Messenger::create() factory function instead of
conditionally creating XioMessengers
the OSD and Monitor classes no longer need separate messengers to
deal with both tcp/rdma clients
xio: portal binding honors ms_bind_port_min,max
xio: remove xio_port_shift
port shifting is no longer necessary, because we won't create both tcp
and xio messengers for the same service
Use Accelio sglist helper macros.
xio: make xio buffer unshareable
xio: Nuke special_handling.
Replace GENERIC with MON (requested by Sage).
Signed-off-by: Casey Bodley <casey@cohortfs.com>
Signed-off-by: Vu Pham <vu@mellanox.com>
Signed-off-by: Matt Benjamin <matt@cohortfs.com>
2014-12-23 21:46:47 +00:00
|
|
|
# Tweak policies (this one disables "missing" dependency warning)
|
|
|
|
cmake_policy(SET CMP0046 OLD)
|
2016-07-29 04:24:14 +00:00
|
|
|
endif()
|
2016-02-10 05:16:34 +00:00
|
|
|
# we use LINK_PRIVATE keyword instead of PRIVATE, but do not specify the LINK_PUBLIC
|
|
|
|
# for target_link_libraries() command when PUBLIC should be used instead, it's just
|
|
|
|
# for backward compatibility with cmake 2.8.11.
|
|
|
|
if (POLICY CMP0022)
|
|
|
|
cmake_policy(SET CMP0022 OLD)
|
|
|
|
endif (POLICY CMP0022)
|
|
|
|
if (POLICY CMP0023)
|
|
|
|
cmake_policy(SET CMP0023 OLD)
|
|
|
|
endif (POLICY CMP0023)
|
2016-07-29 04:24:14 +00:00
|
|
|
if(POLICY CMP0056)
|
|
|
|
cmake_policy(SET CMP0056 NEW)
|
|
|
|
endif()
|
|
|
|
if(POLICY CMP0065)
|
|
|
|
cmake_policy(SET CMP0065 NEW)
|
|
|
|
endif()
|
2014-06-23 22:32:32 +00:00
|
|
|
|
2016-07-20 07:10:45 +00:00
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/")
|
2014-06-23 22:32:32 +00:00
|
|
|
|
2016-07-19 14:17:23 +00:00
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|
|
|
set(LINUX ON)
|
|
|
|
FIND_PACKAGE(Threads)
|
|
|
|
elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
|
|
|
set(FREEBSD ON)
|
|
|
|
FIND_PACKAGE(Threads)
|
|
|
|
elseif(APPLE)
|
|
|
|
set(OperatingSystem "Mac OS X")
|
|
|
|
else()
|
|
|
|
message(STATUS "No systemtype selected for building")
|
|
|
|
endif(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|
|
|
|
2015-12-09 17:55:30 +00:00
|
|
|
option(WITH_CCACHE "Build with ccache.")
|
|
|
|
if(WITH_CCACHE)
|
|
|
|
find_program(CCACHE_FOUND ccache)
|
|
|
|
if(CCACHE_FOUND)
|
|
|
|
message(STATUS "Building with ccache: ${CCACHE_FOUND}, CCACHE_DIR=$ENV{CCACHE_DIR}")
|
|
|
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
2016-04-10 14:37:59 +00:00
|
|
|
# ccache does not accelerate link (ld), but let it handle it. by passing it
|
|
|
|
# along with cc to python's distutils, we are able to workaround
|
|
|
|
# https://bugs.python.org/issue8027.
|
2015-12-09 17:55:30 +00:00
|
|
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
|
|
|
|
else(CCACHE_FOUND)
|
|
|
|
message(FATAL_ERROR "Can't find ccache. Is it installed?")
|
|
|
|
endif(CCACHE_FOUND)
|
|
|
|
endif(WITH_CCACHE)
|
|
|
|
|
2016-05-11 13:29:15 +00:00
|
|
|
option(WITH_MANPAGE "Build man pages." ON)
|
|
|
|
if(WITH_MANPAGE)
|
|
|
|
find_program(SPHINX_BUILD
|
|
|
|
sphinx-build)
|
|
|
|
if(NOT SPHINX_BUILD)
|
|
|
|
message(FATAL_ERROR "Can't find sphinx-build.")
|
|
|
|
endif(NOT SPHINX_BUILD)
|
|
|
|
endif(WITH_MANPAGE)
|
|
|
|
|
2016-01-12 14:39:58 +00:00
|
|
|
include_directories(
|
2014-06-23 22:32:32 +00:00
|
|
|
${PROJECT_BINARY_DIR}/src/include
|
2016-07-22 04:23:32 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/src)
|
|
|
|
|
|
|
|
if(OFED_PREFIX)
|
|
|
|
include_directories(${OFED_PREFIX}/include)
|
|
|
|
link_directories(${OFED_PREFIX}/lib)
|
|
|
|
endif()
|
2014-06-23 22:32:32 +00:00
|
|
|
|
2016-07-19 14:17:23 +00:00
|
|
|
if(FREEBSD)
|
|
|
|
include_directories(/usr/local/include)
|
|
|
|
link_directories(/usr/local/lib)
|
|
|
|
list(APPEND CMAKE_REQUIRED_INCLUDES /usr/local/include)
|
|
|
|
endif(FREEBSD)
|
|
|
|
|
2016-01-11 22:28:47 +00:00
|
|
|
#put all the libs and binaries in one place
|
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
|
|
|
|
2014-06-23 22:32:32 +00:00
|
|
|
#Check Includes
|
|
|
|
include(CheckIncludeFiles)
|
|
|
|
include(CheckIncludeFileCXX)
|
|
|
|
include(CheckFunctionExists)
|
|
|
|
|
2016-03-03 17:05:18 +00:00
|
|
|
#put all the libs and binaries in one place
|
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
|
|
|
|
2016-05-02 22:21:32 +00:00
|
|
|
|
2014-06-23 22:32:32 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(fallocate CEPH_HAVE_FALLOCATE)
|
|
|
|
CHECK_FUNCTION_EXISTS(posix_fadvise HAVE_POSIX_FADVISE)
|
|
|
|
CHECK_FUNCTION_EXISTS(posix_fallocate HAVE_POSIX_FALLOCATE)
|
2016-01-12 14:39:58 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(syncfs HAVE_SYS_SYNCFS)
|
2014-06-23 22:32:32 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(sync_file_range HAVE_SYNC_FILE_RANGE)
|
2015-10-14 00:20:33 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(mallinfo HAVE_MALLINFO)
|
2016-01-25 15:21:29 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(pwritev HAVE_PWRITEV)
|
2016-05-02 22:21:32 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(splice CEPH_HAVE_SPLICE)
|
|
|
|
CHECK_FUNCTION_EXISTS(getgrouplist HAVE_GETGROUPLIST)
|
|
|
|
CHECK_FUNCTION_EXISTS(fdatasync HAVE_FDATASYNC)
|
|
|
|
CHECK_FUNCTION_EXISTS(strerror_r HAVE_STRERROR_R)
|
|
|
|
CHECK_FUNCTION_EXISTS(name_to_handle_at HAVE_NAME_TO_HANDLE_AT)
|
|
|
|
CHECK_FUNCTION_EXISTS(pipe2 HAVE_PIPE2)
|
|
|
|
set(CMAKE_REQUIRED_LIBRARIES pthread)
|
|
|
|
CHECK_FUNCTION_EXISTS(pthread_spin_init HAVE_PTHREAD_SPINLOCK)
|
2016-06-24 17:49:42 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(pthread_set_name_np HAVE_PTHREAD_SET_NAME_NP)
|
|
|
|
CHECK_FUNCTION_EXISTS(pthread_setname_np HAVE_PTHREAD_SETNAME_NP)
|
|
|
|
CHECK_FUNCTION_EXISTS(pthread_getname_np HAVE_PTHREAD_GETNAME_NP)
|
2016-05-02 22:21:32 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(eventfd HAVE_EVENTFD)
|
|
|
|
|
2014-06-23 22:32:32 +00:00
|
|
|
CHECK_INCLUDE_FILES("inttypes.h" HAVE_INTTYPES_H)
|
|
|
|
CHECK_INCLUDE_FILES("linux/types.h" HAVE_LINUX_TYPES_H)
|
2016-05-02 22:21:32 +00:00
|
|
|
CHECK_INCLUDE_FILES("linux/version.h" HAVE_LINUX_VERSION_H)
|
2014-06-23 22:32:32 +00:00
|
|
|
CHECK_INCLUDE_FILES("stdint.h" HAVE_STDINT_H)
|
2016-05-02 22:21:32 +00:00
|
|
|
CHECK_INCLUDE_FILES("arpa/nameser_compat.h" HAVE_ARPA_NAMESER_COMPAT_H)
|
2014-06-23 22:32:32 +00:00
|
|
|
CHECK_INCLUDE_FILES("sys/mount.h" HAVE_SYS_MOUNT_H)
|
|
|
|
CHECK_INCLUDE_FILES("sys/param.h" HAVE_SYS_PARAM_H)
|
|
|
|
CHECK_INCLUDE_FILES("sys/types.h" HAVE_SYS_TYPES_H)
|
|
|
|
CHECK_INCLUDE_FILES("sys/vfs.h" HAVE_SYS_VFS_H)
|
2016-05-02 22:21:32 +00:00
|
|
|
CHECK_INCLUDE_FILES("sys/prctl.h" HAVE_SYS_PRCTL_H)
|
2016-01-18 18:47:28 +00:00
|
|
|
CHECK_INCLUDE_FILES("execinfo.h" HAVE_EXECINFO_H)
|
2016-07-19 14:17:23 +00:00
|
|
|
if(LINUX)
|
|
|
|
CHECK_INCLUDE_FILES("sched.h" HAVE_SCHED)
|
|
|
|
endif(LINUX)
|
2016-05-02 22:21:32 +00:00
|
|
|
CHECK_INCLUDE_FILES("valgrind/helgrind.h" HAVE_VALGRIND_HELGRIND_H)
|
|
|
|
|
|
|
|
include(CheckTypeSize)
|
|
|
|
set(CMAKE_EXTRA_INCLUDE_FILES "linux/types.h")
|
|
|
|
CHECK_TYPE_SIZE(__be16 __BE16)
|
|
|
|
CHECK_TYPE_SIZE(__be32 __BE32)
|
|
|
|
CHECK_TYPE_SIZE(__be64 __BE64)
|
|
|
|
CHECK_TYPE_SIZE(__le16 __LE16)
|
|
|
|
CHECK_TYPE_SIZE(__le32 __LE32)
|
|
|
|
CHECK_TYPE_SIZE(__le64 __LE64)
|
|
|
|
CHECK_TYPE_SIZE(__u8 __U8)
|
|
|
|
CHECK_TYPE_SIZE(__u16 __U16)
|
|
|
|
CHECK_TYPE_SIZE(__u32 __U32)
|
|
|
|
CHECK_TYPE_SIZE(__u64 __U64)
|
|
|
|
CHECK_TYPE_SIZE(__s8 __S8)
|
|
|
|
CHECK_TYPE_SIZE(__s16 __S16)
|
|
|
|
CHECK_TYPE_SIZE(__s32 __S32)
|
|
|
|
CHECK_TYPE_SIZE(__s64 __S64)
|
|
|
|
unset(CMAKE_EXTRA_INCLUDE_FILES)
|
2014-06-23 22:32:32 +00:00
|
|
|
|
|
|
|
include(CheckSymbolExists)
|
2015-10-16 17:12:41 +00:00
|
|
|
CHECK_SYMBOL_EXISTS(res_nquery "resolv.h" HAVE_RES_NQUERY)
|
2016-05-02 22:21:32 +00:00
|
|
|
CHECK_SYMBOL_EXISTS(F_SETPIPE_SZ "linux/fcntl.h" CEPH_HAVE_SETPIPE_SZ)
|
|
|
|
CHECK_SYMBOL_EXISTS(__func__ "" HAVE_FUNC)
|
|
|
|
CHECK_SYMBOL_EXISTS(__PRETTY_FUNCTION__ "" HAVE_PRETTY_FUNC)
|
2015-10-16 17:12:41 +00:00
|
|
|
|
2015-12-01 14:07:48 +00:00
|
|
|
include(CheckCXXSourceCompiles)
|
|
|
|
CHECK_CXX_SOURCE_COMPILES("
|
|
|
|
#include <string.h>
|
|
|
|
int main() { char x = *strerror_r(0, &x, sizeof(x)); return 0; }
|
|
|
|
" STRERROR_R_CHAR_P)
|
2016-07-13 09:13:12 +00:00
|
|
|
|
|
|
|
include(CheckStructHasMember)
|
|
|
|
CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtim.tv_nsec sys/stat.h
|
|
|
|
HAVE_STAT_ST_MTIM_TV_NSEC LANGUAGE C)
|
|
|
|
CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtimespec.tv_nsec sys/stat.h
|
|
|
|
HAVE_STAT_ST_MTIMESPEC_TV_NSEC LANGUAGE C)
|
2015-12-01 14:07:48 +00:00
|
|
|
|
2014-06-23 22:32:32 +00:00
|
|
|
set(CEPH_MAN_DIR "share/man" CACHE STRING "Install location for man pages (relative to prefix).")
|
|
|
|
|
2016-06-04 01:50:00 +00:00
|
|
|
option(ENABLE_SHARED "build shared libraries" ON)
|
|
|
|
if(ENABLE_SHARED)
|
|
|
|
set(CEPH_SHARED SHARED)
|
|
|
|
else(ENABLE_SHARED)
|
|
|
|
set(CEPH_SHARED STATIC)
|
|
|
|
endif(ENABLE_SHARED)
|
2016-06-29 07:49:26 +00:00
|
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE ${ENABLE_SHARED})
|
2016-06-04 01:50:00 +00:00
|
|
|
|
2016-10-13 03:44:55 +00:00
|
|
|
option(WITH_RDMA "Enable RDMA in async messenger" OFF)
|
|
|
|
if(WITH_RDMA)
|
|
|
|
find_package(rdma REQUIRED)
|
|
|
|
set(HAVE_RDMA ${RDMA_FOUND})
|
|
|
|
endif(WITH_RDMA)
|
|
|
|
|
2016-07-20 06:13:40 +00:00
|
|
|
find_package(Backtrace)
|
2015-10-15 02:54:05 +00:00
|
|
|
|
2016-07-19 14:17:23 +00:00
|
|
|
if(LINUX)
|
|
|
|
find_package(udev REQUIRED)
|
|
|
|
set(HAVE_UDEV ${UDEV_FOUND})
|
|
|
|
|
|
|
|
find_package(aio REQUIRED)
|
|
|
|
set(HAVE_LIBAIO ${AIO_FOUND})
|
|
|
|
|
|
|
|
find_package(blkid REQUIRED)
|
|
|
|
set(HAVE_BLKID ${BLKID_FOUND})
|
|
|
|
else()
|
|
|
|
set(HAVE_UDEV OFF)
|
|
|
|
message(STATUS "Not using udev")
|
|
|
|
set(HAVE_LIBAIO OFF)
|
|
|
|
message(STATUS "Not using AIO")
|
|
|
|
set(HAVE_BLKID OFF)
|
|
|
|
message(STATUS "Not using BLKID")
|
|
|
|
endif(LINUX)
|
2014-06-23 22:32:32 +00:00
|
|
|
|
2015-11-14 19:51:13 +00:00
|
|
|
option(WITH_OPENLDAP "OPENLDAP is here" ON)
|
|
|
|
if(${WITH_OPENLDAP})
|
|
|
|
find_package(OpenLdap REQUIRED)
|
|
|
|
set(HAVE_OPENLDAP ${OPENLDAP_FOUND})
|
|
|
|
endif(${WITH_OPENLDAP})
|
|
|
|
|
2014-06-23 22:32:32 +00:00
|
|
|
option(WITH_FUSE "Fuse is here" ON)
|
|
|
|
if(${WITH_FUSE})
|
2015-09-21 16:44:28 +00:00
|
|
|
find_package(fuse)
|
2016-01-28 06:47:07 +00:00
|
|
|
set(HAVE_LIBFUSE ${FUSE_FOUND})
|
2014-06-23 22:32:32 +00:00
|
|
|
endif(${WITH_FUSE})
|
|
|
|
|
2015-09-21 16:18:43 +00:00
|
|
|
option(WITH_XFS "XFS is here" ON)
|
|
|
|
if(${WITH_XFS})
|
|
|
|
find_package(xfs)
|
2016-05-02 22:21:32 +00:00
|
|
|
set(HAVE_LIBXFS ${XFS_FOUND})
|
2015-09-21 16:18:43 +00:00
|
|
|
endif(${WITH_XFS})
|
|
|
|
|
2016-02-03 10:39:28 +00:00
|
|
|
option(WITH_SPDK "Enable SPDK" OFF)
|
|
|
|
if(WITH_SPDK)
|
|
|
|
find_package(pciaccess REQUIRED)
|
|
|
|
find_package(dpdk REQUIRED)
|
|
|
|
set(HAVE_SPDK TRUE)
|
|
|
|
endif(WITH_SPDK)
|
|
|
|
|
2014-06-23 22:32:32 +00:00
|
|
|
# needs mds and? XXX
|
|
|
|
option(WITH_LIBCEPHFS "libcephfs client library" ON)
|
|
|
|
|
|
|
|
# key-value store
|
|
|
|
option(WITH_KVS "Key value store is here" ON)
|
|
|
|
|
|
|
|
# remote block storage
|
|
|
|
option(WITH_RBD "Remote block storage is here" ON)
|
|
|
|
|
2016-11-05 01:10:08 +00:00
|
|
|
# embedded ceph daemon static library
|
|
|
|
# NOTE: Ceph is mostly LGPL (see COPYING), which means that
|
|
|
|
# static linking brings with it restrictions. Please be sure
|
|
|
|
# to look at the LGPL license carefully before linking this library to
|
|
|
|
# your code. See http://www.gnu.org/licenses/gpl-faq.html#LGPLStaticVsDynamic.
|
|
|
|
option(WITH_EMBEDDED "build the embedded ceph daemon library" ON)
|
|
|
|
|
2014-06-23 22:32:32 +00:00
|
|
|
option(WITH_LEVELDB "LevelDB is here" ON)
|
2016-11-05 20:44:20 +00:00
|
|
|
if(WITH_LEVELDB)
|
|
|
|
if(LEVELDB_PREFIX)
|
|
|
|
include_directories(${LEVELDB_PREFIX}/include)
|
|
|
|
link_directories(${LEVELDB_PREFIX}/lib)
|
|
|
|
endif()
|
|
|
|
find_package(leveldb REQUIRED)
|
|
|
|
find_file(HAVE_LEVELDB_FILTER_POLICY leveldb/filter_policy.h PATHS ${LEVELDB_INCLUDE_DIR})
|
|
|
|
endif(WITH_LEVELDB)
|
2014-06-23 22:32:32 +00:00
|
|
|
|
|
|
|
find_package(atomic_ops REQUIRED)
|
2015-09-21 14:37:19 +00:00
|
|
|
message(STATUS "${ATOMIC_OPS_LIBRARIES}")
|
2016-05-02 22:21:32 +00:00
|
|
|
if(NOT ${ATOMIC_OPS_FOUND})
|
|
|
|
set(NO_ATOMIC_OPS 1)
|
|
|
|
endif(NOT ${ATOMIC_OPS_FOUND})
|
2015-09-21 14:37:19 +00:00
|
|
|
|
2014-06-23 22:32:32 +00:00
|
|
|
find_package(snappy REQUIRED)
|
|
|
|
|
2015-12-31 02:06:08 +00:00
|
|
|
#if allocator is set on command line make sure it matches below strings
|
|
|
|
if(ALLOCATOR)
|
2016-10-10 21:37:58 +00:00
|
|
|
if(${ALLOCATOR} MATCHES "tcmalloc(_minimal)?")
|
2016-08-10 16:12:05 +00:00
|
|
|
find_package(gperftools REQUIRED)
|
|
|
|
set(HAVE_LIBTCMALLOC ON)
|
2015-12-31 02:06:08 +00:00
|
|
|
elseif(${ALLOCATOR} STREQUAL "jemalloc")
|
|
|
|
find_package(JeMalloc REQUIRED)
|
2016-05-02 22:21:32 +00:00
|
|
|
set(HAVE_LIBJEMALLOC ${JEMALLOC_FOUND})
|
2015-12-31 02:06:08 +00:00
|
|
|
endif()
|
|
|
|
else(ALLOCATOR)
|
2016-08-10 16:12:05 +00:00
|
|
|
find_package(gperftools)
|
|
|
|
set(HAVE_LIBTCMALLOC ${GPERFTOOLS_FOUND})
|
|
|
|
if(NOT GPERFTOOLS_FOUND)
|
2016-05-02 22:21:32 +00:00
|
|
|
find_package(JeMalloc)
|
|
|
|
set(HAVE_LIBJEMALLOC ${JEMALLOC_FOUND})
|
2016-08-10 16:12:05 +00:00
|
|
|
endif(NOT GPERFTOOLS_FOUND)
|
|
|
|
if(GPERFTOOLS_FOUND)
|
2016-06-08 03:34:44 +00:00
|
|
|
set(ALLOCATOR tcmalloc)
|
|
|
|
elseif(JEMALLOC_FOUND)
|
|
|
|
set(ALLOCATOR jemalloc)
|
|
|
|
else()
|
2015-12-31 02:06:08 +00:00
|
|
|
message(WARNING "tcmalloc and jemalloc not found, falling back to libc")
|
|
|
|
set(ALLOCATOR "libc")
|
2016-08-10 16:12:05 +00:00
|
|
|
endif(GPERFTOOLS_FOUND)
|
2015-12-31 02:06:08 +00:00
|
|
|
endif(ALLOCATOR)
|
2014-06-23 22:32:32 +00:00
|
|
|
|
2016-12-07 03:41:18 +00:00
|
|
|
if(WITH_LIBCEPHFS OR WITH_RBD)
|
2016-07-19 14:17:23 +00:00
|
|
|
find_package(keyutils REQUIRED)
|
2016-12-07 03:41:18 +00:00
|
|
|
endif()
|
2015-09-21 15:08:19 +00:00
|
|
|
|
2016-07-06 17:09:35 +00:00
|
|
|
find_package(CURL REQUIRED)
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES ${CURL_INCLUDE_DIRS})
|
|
|
|
set(CMAKE_REQUIRED_LIBRARIES ${CURL_LIBRARIES})
|
2016-07-11 13:29:09 +00:00
|
|
|
CHECK_SYMBOL_EXISTS(curl_multi_wait curl/curl.h HAVE_CURL_MULTI_WAIT)
|
2015-09-21 15:50:45 +00:00
|
|
|
|
2016-06-23 18:22:30 +00:00
|
|
|
# nss or cryptopp?
|
2016-06-20 21:21:53 +00:00
|
|
|
option(WITH_NSS "Use NSS crypto and SSL implementations" ON)
|
|
|
|
if (${WITH_NSS})
|
|
|
|
find_package(NSS REQUIRED)
|
|
|
|
set(USE_NSS 1)
|
|
|
|
find_package(NSPR REQUIRED)
|
|
|
|
set(CRYPTO_LIBS ${NSS_LIBRARIES} ${NSPR_LIBRARIES})
|
|
|
|
else ()
|
|
|
|
find_package(cryptopp REQUIRED)
|
|
|
|
set(CRYPTO_LIBS ${CRYPTOPP_LIBRARIES})
|
|
|
|
set(USE_CRYPTOPP 1)
|
|
|
|
endif (${WITH_NSS})
|
|
|
|
|
|
|
|
option(WITH_SSL "SSL build selected" ON)
|
2016-07-29 04:48:51 +00:00
|
|
|
if(USE_NSS)
|
2016-06-20 21:21:53 +00:00
|
|
|
#nss
|
|
|
|
set(SSL_LIBRARIES ${NSS_LIBRARIES})
|
|
|
|
message(STATUS "SSL with NSS selected (Libs: ${SSL_LIBRARIES})")
|
2016-07-29 04:48:51 +00:00
|
|
|
else(USE_NSS)
|
2016-06-20 21:21:53 +00:00
|
|
|
#openssl
|
|
|
|
find_package(OpenSSL REQUIRED)
|
|
|
|
set(HAVE_OPENSSL ON)
|
|
|
|
set(SSL_LIBRARIES ${OPENSSL_LIBRARIES})
|
|
|
|
message(STATUS "SSL with OpenSSL selected (Libs: ${SSL_LIBRARIES})")
|
2016-07-29 04:48:51 +00:00
|
|
|
endif(USE_NSS)
|
2014-06-23 22:32:32 +00:00
|
|
|
|
2016-01-04 20:03:48 +00:00
|
|
|
option(WITH_XIO "Enable XIO messaging" OFF)
|
2014-06-23 22:32:32 +00:00
|
|
|
if(WITH_XIO)
|
2016-01-04 20:03:48 +00:00
|
|
|
find_package(xio REQUIRED)
|
2016-05-03 17:19:43 +00:00
|
|
|
set(HAVE_XIO ${XIO_FOUND})
|
2014-06-23 22:32:32 +00:00
|
|
|
endif(WITH_XIO)
|
|
|
|
|
2016-08-02 15:50:13 +00:00
|
|
|
option(WITH_DPDK "Enable DPDK messaging" OFF)
|
|
|
|
if(WITH_DPDK)
|
|
|
|
find_package(dpdk)
|
|
|
|
set(HAVE_DPDK ${DPDK_FOUND})
|
|
|
|
endif(WITH_DPDK)
|
|
|
|
|
2014-06-23 22:32:32 +00:00
|
|
|
#option for RGW
|
|
|
|
option(WITH_RADOSGW "Rados Gateway is enabled" ON)
|
2016-10-13 15:35:27 +00:00
|
|
|
if(WITH_RADOSGW)
|
|
|
|
find_package(EXPAT REQUIRED)
|
|
|
|
find_package(fcgi REQUIRED)
|
|
|
|
endif(WITH_RADOSGW)
|
2014-06-23 22:32:32 +00:00
|
|
|
|
2016-11-18 18:18:40 +00:00
|
|
|
option(WITH_RADOSGW_ASIO_FRONTEND "Rados Gateway's ASIO frontend is enabled" ON)
|
2016-10-15 01:13:22 +00:00
|
|
|
|
2015-08-03 11:48:32 +00:00
|
|
|
#option for CephFS
|
|
|
|
option(WITH_CEPHFS "CephFS is enabled" ON)
|
|
|
|
|
2016-06-30 13:04:30 +00:00
|
|
|
#option for Mgr
|
|
|
|
option(WITH_MGR "ceph-mgr is enabled" ON)
|
|
|
|
if(WITH_MGR)
|
|
|
|
set(Python_ADDITIONAL_VERSIONS 2.7)
|
|
|
|
find_package(PythonLibs 2.7 REQUIRED)
|
2016-10-26 21:36:22 +00:00
|
|
|
# Boost dependency check deferred to Boost section
|
2016-06-30 13:04:30 +00:00
|
|
|
endif(WITH_MGR)
|
|
|
|
|
2015-10-16 17:12:41 +00:00
|
|
|
option(WITH_THREAD_SAFE_RES_QUERY "res_query is thread safe" OFF)
|
|
|
|
if(WITH_THREAD_SAFE_RES_QUERY)
|
|
|
|
set(HAVE_THREAD_SAFE_RES_QUERY 1 CACHE INTERNAL "Thread safe res_query supported.")
|
|
|
|
endif(WITH_THREAD_SAFE_RES_QUERY)
|
|
|
|
|
2015-12-07 18:33:32 +00:00
|
|
|
option(WITH_REENTRANT_STRSIGNAL "strsignal is reentrant" OFF)
|
|
|
|
if(WITH_REENTRANT_STRSIGNAL)
|
|
|
|
set(HAVE_REENTRANT_STRSIGNAL 1 CACHE INTERNAL "Reentrant strsignal is supported.")
|
|
|
|
endif(WITH_REENTRANT_STRSIGNAL)
|
|
|
|
|
2015-12-31 03:58:55 +00:00
|
|
|
set(HAVE_LIBROCKSDB 1)
|
|
|
|
|
2016-01-06 11:37:49 +00:00
|
|
|
# -lz link into kv
|
2015-12-31 03:58:55 +00:00
|
|
|
find_package(ZLIB REQUIRED)
|
|
|
|
|
2015-12-31 03:01:52 +00:00
|
|
|
#option for LTTng
|
2016-10-14 17:54:38 +00:00
|
|
|
option(WITH_LTTNG "LTTng tracing is enabled" ON)
|
2015-12-31 03:01:52 +00:00
|
|
|
if(${WITH_LTTNG})
|
2016-08-30 05:33:24 +00:00
|
|
|
find_package(LTTngUST REQUIRED)
|
|
|
|
find_program(LTTNG_GEN_TP
|
|
|
|
lttng-gen-tp)
|
|
|
|
if(NOT LTTNG_GEN_TP)
|
|
|
|
message(FATAL_ERROR "Can't find lttng-gen-tp.")
|
|
|
|
endif()
|
2015-12-31 03:01:52 +00:00
|
|
|
endif(${WITH_LTTNG})
|
|
|
|
|
2015-12-31 04:34:30 +00:00
|
|
|
#option for Babeltrace
|
|
|
|
option(HAVE_BABELTRACE "Babeltrace libraries are enabled" ON)
|
|
|
|
if(${HAVE_BABELTRACE})
|
|
|
|
find_package(babeltrace REQUIRED)
|
|
|
|
set(WITH_BABELTRACE ${BABELTRACE_FOUND})
|
|
|
|
set(HAVE_BABELTRACE_BABELTRACE_H ${BABELTRACE_FOUND})
|
|
|
|
set(HAVE_BABELTRACE_CTF_EVENTS_H ${BABELTRACE_FOUND})
|
2016-05-02 22:21:32 +00:00
|
|
|
set(HAVE_BABELTRACE_CTF_ITERATOR_H ${BABELTRACE_FOUND})
|
2015-12-31 04:34:30 +00:00
|
|
|
endif(${HAVE_BABELTRACE})
|
|
|
|
|
2016-05-02 22:21:32 +00:00
|
|
|
option(DEBUG_GATHER "C_Gather debugging is enabled" ON)
|
|
|
|
option(HAVE_LIBZFS "LibZFS is enabled" OFF)
|
|
|
|
option(ENABLE_COVERAGE "Coverage is enabled" OFF)
|
|
|
|
option(PG_DEBUG_REFS "PG Ref debugging is enabled" OFF)
|
2014-06-23 22:32:32 +00:00
|
|
|
|
2016-08-23 11:32:47 +00:00
|
|
|
option(WITH_TESTS "enable the build of ceph-test package scripts/binaries" ON)
|
|
|
|
|
2015-09-29 18:40:39 +00:00
|
|
|
option(WITH_FIO "Support for fio engines" OFF)
|
|
|
|
if(WITH_FIO)
|
|
|
|
find_package(fio REQUIRED)
|
|
|
|
endif(WITH_FIO)
|
|
|
|
|
2016-07-19 14:17:23 +00:00
|
|
|
if(LINUX)
|
|
|
|
add_definitions(-D__linux__)
|
|
|
|
endif(LINUX)
|
2014-06-23 22:32:32 +00:00
|
|
|
|
2016-09-22 15:41:53 +00:00
|
|
|
# Boost
|
|
|
|
option(WITH_SYSTEM_BOOST "require and build with system Boost" OFF)
|
|
|
|
|
|
|
|
if (WITH_SYSTEM_BOOST)
|
|
|
|
if(ENABLE_SHARED)
|
|
|
|
set(Boost_USE_STATIC_LIBS OFF)
|
|
|
|
else()
|
|
|
|
set(Boost_USE_STATIC_LIBS ON)
|
|
|
|
endif()
|
|
|
|
else()
|
2016-11-08 19:18:48 +00:00
|
|
|
set(BOOST_CFLAGS "-fPIC -w") # check on arm, etc <---XXX
|
2016-09-22 15:41:53 +00:00
|
|
|
set(BOOST_J 1 CACHE STRING
|
|
|
|
"max jobs for Boost build") # override w/-DBOOST_J=<n>
|
|
|
|
message(STATUS "BUILDING Boost Libraries at j ${BOOST_J}")
|
|
|
|
# 1. prep w/required components
|
|
|
|
set(BOOST_SOURCE_DIR "${PROJECT_SOURCE_DIR}/src/boost")
|
|
|
|
set(BOOST_PREFIX "${PROJECT_BINARY_DIR}/boost")
|
|
|
|
set(BOOST_BUILD "${PROJECT_BINARY_DIR}/boost-build")
|
|
|
|
set(Boost_USE_STATIC_LIBS ON)
|
|
|
|
execute_process(COMMAND "./bootstrap.sh"
|
|
|
|
"--prefix=${BOOST_PREFIX}"
|
2016-10-26 21:36:22 +00:00
|
|
|
"--with-libraries=atomic,container,context,coroutine,coroutine2,date_time,filesystem,iostreams,program_options,python,random,regex,system,thread"
|
2016-09-22 15:41:53 +00:00
|
|
|
WORKING_DIRECTORY ${BOOST_SOURCE_DIR})
|
|
|
|
# 2. install headers
|
|
|
|
set(BOOST_ROOT "${BOOST_PREFIX}")
|
|
|
|
execute_process(COMMAND "./b2"
|
|
|
|
#"--buildid=ceph" # changes lib names--can omit for static
|
|
|
|
"--variant=release" # could override
|
|
|
|
"--link=static" # avoid library versioning issues
|
|
|
|
"--threading=multi"
|
|
|
|
"--build-dir=${BOOST_BUILD}"
|
|
|
|
"-j${BOOST_J}"
|
|
|
|
"cxxflags=${BOOST_CFLAGS}"
|
|
|
|
"headers"
|
|
|
|
WORKING_DIRECTORY ${BOOST_SOURCE_DIR})
|
|
|
|
# 3. build and install libs
|
|
|
|
execute_process(COMMAND "./b2"
|
|
|
|
#"--buildid=ceph" # changes lib names--can omit for static
|
|
|
|
"--variant=release" # could override
|
|
|
|
"--link=static" # avoid library versioning issues
|
|
|
|
"--threading=multi"
|
|
|
|
"--build-dir=${BOOST_BUILD}"
|
|
|
|
"-j${BOOST_J}"
|
|
|
|
"cxxflags=${BOOST_CFLAGS}"
|
|
|
|
"install"
|
|
|
|
WORKING_DIRECTORY ${BOOST_SOURCE_DIR})
|
|
|
|
# 4. set hints for FindBoost.cmake
|
|
|
|
set(Boost_NO_SYSTEM_PATHS ON)
|
|
|
|
include_directories(BEFORE ${BOOST_PREFIX}/include)
|
2016-10-26 21:36:22 +00:00
|
|
|
# fixup for CheckIncludeFileCXX
|
|
|
|
set(HAVE_BOOST_ASIO_COROUTINE ON)
|
2016-11-22 19:53:34 +00:00
|
|
|
|
|
|
|
set(BOOST_ROOT ${BOOST_PREFIX})
|
|
|
|
set(Boost_NO_SYSTEM_PATHS ON)
|
2016-09-22 15:41:53 +00:00
|
|
|
endif()
|
2014-06-23 22:32:32 +00:00
|
|
|
|
|
|
|
set(Boost_USE_MULTITHREADED ON)
|
2016-09-22 15:41:53 +00:00
|
|
|
|
2016-10-26 21:36:22 +00:00
|
|
|
set(BOOST_COMPONENTS
|
|
|
|
thread system regex random program_options date_time iostreams)
|
|
|
|
if(WITH_MGR)
|
|
|
|
list(APPEND BOOST_COMPONENTS python)
|
|
|
|
endif()
|
|
|
|
|
2016-09-22 15:41:53 +00:00
|
|
|
# require minimally the bundled version
|
2016-11-22 19:53:34 +00:00
|
|
|
find_package(Boost 1.61 COMPONENTS ${BOOST_COMPONENTS} REQUIRED)
|
2016-11-08 19:18:48 +00:00
|
|
|
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
|
|
|
|
include_directories(SYSTEM ${PROJECT_BINARY_DIR}/include)
|
2014-06-23 22:32:32 +00:00
|
|
|
|
2016-09-22 15:41:53 +00:00
|
|
|
if (NOT WITH_SYSTEM_BOOST)
|
|
|
|
LIST(APPEND Boost_LIBRARIES "-lz")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
CHECK_INCLUDE_FILE_CXX("boost/asio/coroutine.hpp" HAVE_BOOST_ASIO_COROUTINE)
|
|
|
|
|
2014-06-23 22:32:32 +00:00
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
|
2016-05-15 12:39:53 +00:00
|
|
|
option(WITH_SELINUX "build SELinux policy" OFF)
|
|
|
|
if(WITH_SELINUX)
|
2016-06-30 05:10:58 +00:00
|
|
|
find_file(SELINUX_MAKEFILE selinux/devel/Makefile
|
2016-05-15 12:39:53 +00:00
|
|
|
PATH /usr/share)
|
|
|
|
if(NOT SELINUX_MAKEFILE)
|
|
|
|
message(FATAL_ERROR "Can't find selinux's Makefile")
|
|
|
|
endif()
|
|
|
|
add_subdirectory(selinux)
|
|
|
|
endif(WITH_SELINUX)
|
|
|
|
|
2015-08-17 20:26:47 +00:00
|
|
|
# enables testing and creates Make check command
|
2016-07-13 13:14:30 +00:00
|
|
|
add_custom_target(tests
|
|
|
|
COMMENT "Building tests")
|
2015-08-17 20:26:47 +00:00
|
|
|
enable_testing()
|
2016-05-17 15:48:33 +00:00
|
|
|
set(CMAKE_CTEST_COMMAND ctest)
|
2016-07-13 13:14:30 +00:00
|
|
|
add_custom_target(check
|
|
|
|
COMMAND ${CMAKE_CTEST_COMMAND}
|
|
|
|
DEPENDS tests)
|
2015-08-17 20:26:47 +00:00
|
|
|
|
2014-06-23 22:32:32 +00:00
|
|
|
add_subdirectory(src)
|
2015-05-22 14:38:29 +00:00
|
|
|
|
2016-05-11 13:29:15 +00:00
|
|
|
add_subdirectory(doc)
|
|
|
|
if(WITH_MANPAGE)
|
|
|
|
add_subdirectory(man)
|
|
|
|
endif(WITH_MANPAGE)
|
2016-06-30 08:01:08 +00:00
|
|
|
|
|
|
|
option(WITH_SYSTEMD "install systemd target and service files" OFF)
|
|
|
|
if(WITH_SYSTEMD)
|
|
|
|
add_subdirectory(systemd)
|
|
|
|
endif()
|
|
|
|
|