2017-10-13 05:00:49 +00:00
|
|
|
cmake_minimum_required(VERSION 2.8.12)
|
2014-06-23 22:32:32 +00:00
|
|
|
|
2017-10-10 11:30:42 +00:00
|
|
|
project(ceph CXX C ASM)
|
2018-05-03 17:57:34 +00:00
|
|
|
set(VERSION 13.1.0)
|
2014-06-23 22:32:32 +00:00
|
|
|
|
2018-04-18 03:53:24 +00:00
|
|
|
if(POLICY CMP0028)
|
|
|
|
cmake_policy(SET CMP0028 NEW)
|
|
|
|
endif()
|
2016-07-29 04:24:14 +00:00
|
|
|
if(POLICY CMP0046)
|
2018-04-26 08:44:07 +00:00
|
|
|
cmake_policy(SET CMP0046 NEW)
|
2016-07-29 04:24:14 +00:00
|
|
|
endif()
|
2017-11-27 04:39:41 +00:00
|
|
|
if(POLICY CMP0054)
|
|
|
|
cmake_policy(SET CMP0054 NEW)
|
|
|
|
endif()
|
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()
|
2017-04-16 05:03:52 +00:00
|
|
|
if(POLICY CMP0051)
|
2018-04-26 08:46:57 +00:00
|
|
|
cmake_policy(SET CMP0051 NEW)
|
2017-04-16 05:03:52 +00:00
|
|
|
endif()
|
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)
|
|
|
|
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)
|
2017-11-03 19:14:35 +00:00
|
|
|
include_directories(SYSTEM ${OFED_PREFIX}/include)
|
2016-07-22 04:23:32 +00:00
|
|
|
link_directories(${OFED_PREFIX}/lib)
|
|
|
|
endif()
|
2014-06-23 22:32:32 +00:00
|
|
|
|
2016-07-19 14:17:23 +00:00
|
|
|
if(FREEBSD)
|
2017-11-03 19:14:35 +00:00
|
|
|
include_directories(SYSTEM /usr/local/include)
|
2016-07-19 14:17:23 +00:00
|
|
|
link_directories(/usr/local/lib)
|
|
|
|
list(APPEND CMAKE_REQUIRED_INCLUDES /usr/local/include)
|
|
|
|
endif(FREEBSD)
|
|
|
|
|
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)
|
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)
|
2017-09-13 04:17:30 +00:00
|
|
|
if(NOT APPLE)
|
|
|
|
CHECK_FUNCTION_EXISTS(fdatasync HAVE_FDATASYNC)
|
|
|
|
endif()
|
2018-02-09 21:16:43 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(strerror_r HAVE_Strerror_R)
|
2016-05-02 22:21:32 +00:00
|
|
|
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)
|
2017-11-28 07:21:55 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(pthread_rwlockattr_setkind_np HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP)
|
2016-05-02 22:21:32 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(eventfd HAVE_EVENTFD)
|
2017-05-26 20:32:33 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(getprogname HAVE_GETPROGNAME)
|
2016-05-02 22:21:32 +00:00
|
|
|
|
2014-06-23 22:32:32 +00:00
|
|
|
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)
|
|
|
|
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)
|
2017-10-04 20:28:49 +00:00
|
|
|
CHECK_SYMBOL_EXISTS(getentropy "unistd.h" HAVE_GETENTROPY)
|
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
|
|
|
|
2017-12-09 11:27:03 +00:00
|
|
|
option(WITH_STATIC_LIBSTDCXX "Link against libstdc++ statically" OFF)
|
|
|
|
if(WITH_STATIC_LIBSTDCXX)
|
|
|
|
if(NOT CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
message(FATAL_ERROR "Please use GCC to enable WITH_STATIC_LIBSTDCXX")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2017-03-01 14:58:37 +00:00
|
|
|
option(WITH_RDMA "Enable RDMA in async messenger" ON)
|
2016-10-13 03:44:55 +00:00
|
|
|
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(blkid REQUIRED)
|
|
|
|
set(HAVE_BLKID ${BLKID_FOUND})
|
|
|
|
else()
|
|
|
|
set(HAVE_UDEV OFF)
|
|
|
|
message(STATUS "Not using udev")
|
|
|
|
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)
|
2017-10-27 17:57:55 +00:00
|
|
|
if(WITH_OPENLDAP)
|
|
|
|
find_package(OpenLdap REQUIRED)
|
|
|
|
set(HAVE_OPENLDAP ${OPENLDAP_FOUND})
|
|
|
|
endif()
|
2015-11-14 19:51:13 +00:00
|
|
|
|
2014-06-23 22:32:32 +00:00
|
|
|
option(WITH_FUSE "Fuse is here" ON)
|
2017-10-27 17:57:55 +00:00
|
|
|
if(WITH_FUSE)
|
|
|
|
find_package(fuse)
|
|
|
|
set(HAVE_LIBFUSE ${FUSE_FOUND})
|
|
|
|
endif()
|
2014-06-23 22:32:32 +00:00
|
|
|
|
2015-09-21 16:18:43 +00:00
|
|
|
option(WITH_XFS "XFS is here" ON)
|
2017-06-26 03:58:28 +00:00
|
|
|
if(WITH_XFS)
|
|
|
|
find_package(xfs)
|
|
|
|
set(HAVE_LIBXFS ${XFS_FOUND})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
option(WITH_ZFS "enable LibZFS if found" OFF)
|
|
|
|
if(WITH_ZFS)
|
|
|
|
find_package(zfs)
|
|
|
|
set(HAVE_LIBZFS ${ZFS_FOUND})
|
|
|
|
endif()
|
2015-09-21 16:18:43 +00:00
|
|
|
|
2017-11-20 04:55:54 +00:00
|
|
|
option(WITH_BLUESTORE "Bluestore OSD backend" ON)
|
|
|
|
if(WITH_BLUESTORE)
|
|
|
|
find_package(aio)
|
|
|
|
set(HAVE_LIBAIO ${AIO_FOUND})
|
|
|
|
endif()
|
|
|
|
|
2018-01-26 06:52:06 +00:00
|
|
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "i386|i686|amd64|x86_64|AMD64|aarch64")
|
2017-11-15 12:57:25 +00:00
|
|
|
option(WITH_SPDK "Enable SPDK" ON)
|
|
|
|
else()
|
|
|
|
option(WITH_SPDK "Enable SPDK" OFF)
|
|
|
|
endif()
|
2016-02-03 10:39:28 +00:00
|
|
|
if(WITH_SPDK)
|
2017-11-20 04:55:54 +00:00
|
|
|
if(NOT WITH_BLUESTORE)
|
|
|
|
message(SEND_ERROR "Please enable WITH_BLUESTORE for using SPDK")
|
|
|
|
endif()
|
2017-11-15 12:54:46 +00:00
|
|
|
include(BuildSPDK)
|
|
|
|
build_spdk()
|
2016-02-03 10:39:28 +00:00
|
|
|
set(HAVE_SPDK TRUE)
|
|
|
|
endif(WITH_SPDK)
|
|
|
|
|
2017-06-07 15:22:52 +00:00
|
|
|
option(WITH_PMEM "Enable PMEM" OFF)
|
2017-11-20 04:55:54 +00:00
|
|
|
if(WITH_PMEM)
|
2017-10-19 16:44:09 +00:00
|
|
|
set(HAVE_PMEM ON)
|
2017-11-20 04:55:54 +00:00
|
|
|
if(NOT WITH_BLUESTORE)
|
|
|
|
message(SEND_ERROR "Please enable WITH_BLUESTORE for using PMEM")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WITH_BLUESTORE)
|
|
|
|
if(NOT AIO_FOUND AND NOT WITH_SPDK AND NOT WITH_PMEM)
|
|
|
|
message(SEND_ERROR "WITH_BLUESTORE is ON, "
|
|
|
|
"but none of the bluestore backends is enabled. "
|
|
|
|
"Please install libaio, or enable WITH_SPDK or WITH_PMEM (experimental)")
|
|
|
|
endif()
|
2017-10-19 16:44:09 +00:00
|
|
|
endif()
|
2017-06-07 15:22:52 +00:00
|
|
|
|
2017-08-01 23:16:16 +00:00
|
|
|
option(WITH_BLUEFS "libbluefs library" OFF)
|
|
|
|
|
2017-12-29 04:50:20 +00:00
|
|
|
option(WITH_QATZIP "Enable QATZIP" OFF)
|
|
|
|
if(WITH_QATZIP)
|
|
|
|
find_package(qatzip REQUIRED)
|
|
|
|
set(HAVE_QATZIP ${QATZIP_FOUND})
|
|
|
|
endif(WITH_QATZIP)
|
|
|
|
|
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)
|
|
|
|
|
2017-01-05 10:59:42 +00:00
|
|
|
# KERNEL remote block storage
|
|
|
|
option(WITH_KRBD "Kernel Remote block storage is here" ON)
|
|
|
|
|
|
|
|
if(WITH_KRBD AND WITHOUT_RBD)
|
|
|
|
message(FATAL_ERROR "Cannot have WITH_KRBD with WITH_RBD.")
|
|
|
|
endif()
|
|
|
|
|
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)
|
2017-11-03 19:14:35 +00:00
|
|
|
include_directories(SYSTEM ${LEVELDB_PREFIX}/include)
|
2016-11-05 20:44:20 +00:00
|
|
|
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(snappy REQUIRED)
|
|
|
|
|
2017-12-14 20:13:23 +00:00
|
|
|
option(WITH_BROTLI "Brotli compression support" OFF)
|
|
|
|
if(WITH_BROTLI)
|
|
|
|
set(HAVE_BROTLI TRUE)
|
|
|
|
endif()
|
|
|
|
|
2017-08-15 15:58:35 +00:00
|
|
|
option(WITH_LZ4 "LZ4 compression support" ON)
|
2017-06-02 07:00:11 +00:00
|
|
|
if(WITH_LZ4)
|
2017-08-17 08:01:55 +00:00
|
|
|
find_package(LZ4 1.7 REQUIRED)
|
2017-06-02 07:00:11 +00:00
|
|
|
set(HAVE_LZ4 ${LZ4_FOUND})
|
|
|
|
endif(WITH_LZ4)
|
|
|
|
|
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})
|
2016-12-22 04:36:37 +00:00
|
|
|
set(HAVE_JEMALLOC 1)
|
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()
|
2017-02-12 14:03:56 +00:00
|
|
|
if(NOT FREEBSD)
|
|
|
|
# FreeBSD already has jemalloc as its default allocator
|
|
|
|
message(WARNING "tcmalloc and jemalloc not found, falling back to libc")
|
|
|
|
endif()
|
2015-12-31 02:06:08 +00:00
|
|
|
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-12 22:16:40 +00:00
|
|
|
|
2017-01-05 10:59:42 +00:00
|
|
|
if(WITH_LIBCEPHFS OR WITH_KRBD)
|
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
|
|
|
|
2018-01-18 01:23:14 +00:00
|
|
|
find_package(NSS REQUIRED)
|
|
|
|
find_package(NSPR REQUIRED)
|
2018-04-26 13:35:20 +00:00
|
|
|
find_package(OpenSSL REQUIRED)
|
|
|
|
# TODO: use NSS only for validation of the OpenSSL-based implementations
|
2018-01-18 01:23:14 +00:00
|
|
|
set(USE_NSS 1)
|
2018-04-26 13:35:20 +00:00
|
|
|
set(USE_OPENSSL 1)
|
|
|
|
set(CRYPTO_LIBS ${NSS_LIBRARIES} ${NSPR_LIBRARIES} ${OPENSSL_LIBRARIES})
|
|
|
|
set(SSL_LIBRARIES ${NSS_LIBRARIES} ${OPENSSL_LIBRARIES})
|
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)
|
2017-10-27 17:57:55 +00:00
|
|
|
set(HAVE_XIO ${XIO_FOUND})
|
|
|
|
endif()
|
2014-06-23 22:32:32 +00:00
|
|
|
|
2016-08-02 15:50:13 +00:00
|
|
|
option(WITH_DPDK "Enable DPDK messaging" OFF)
|
|
|
|
if(WITH_DPDK)
|
2017-10-27 17:57:55 +00:00
|
|
|
find_package(dpdk)
|
|
|
|
set(HAVE_DPDK ${DPDK_FOUND})
|
2017-11-17 05:47:52 +00:00
|
|
|
if(NOT TARGET dpdk-ext)
|
|
|
|
find_package(dpdk)
|
|
|
|
if(NOT DPDK_FOUND)
|
|
|
|
include(BuildDPDK)
|
|
|
|
build_dpdk()
|
|
|
|
endif()
|
|
|
|
endif()
|
2017-10-27 17:57:55 +00:00
|
|
|
endif()
|
2016-08-02 15:50:13 +00:00
|
|
|
|
2017-05-05 17:59:35 +00:00
|
|
|
option(WITH_BLKIN "Use blkin to emit LTTng tracepoints for Zipkin" OFF)
|
2015-08-17 18:17:23 +00:00
|
|
|
if(WITH_BLKIN)
|
2017-09-07 13:43:20 +00:00
|
|
|
set(BLKIN_LIBRARIES blkin ${LTTNGUST_LIBRARIES} lttng-ust-fork)
|
2017-11-03 19:14:35 +00:00
|
|
|
include_directories(SYSTEM src/blkin/blkin-lib)
|
2015-08-17 18:17:23 +00:00
|
|
|
endif(WITH_BLKIN)
|
|
|
|
|
2017-11-26 20:46:26 +00:00
|
|
|
option(WITH_BOOST_CONTEXT "Enable boost::asio stackful coroutines" ON)
|
|
|
|
if(WITH_BOOST_CONTEXT)
|
|
|
|
set(HAVE_BOOST_CONTEXT ON)
|
|
|
|
endif()
|
|
|
|
|
2014-06-23 22:32:32 +00:00
|
|
|
#option for RGW
|
|
|
|
option(WITH_RADOSGW "Rados Gateway is enabled" ON)
|
2017-05-11 18:27:03 +00:00
|
|
|
option(WITH_RADOSGW_FCGI_FRONTEND "Rados Gateway's FCGI frontend is enabled" OFF)
|
2017-04-28 13:56:06 +00:00
|
|
|
option(WITH_RADOSGW_BEAST_FRONTEND "Rados Gateway's Beast frontend is enabled" ON)
|
2018-02-06 22:06:11 +00:00
|
|
|
option(WITH_RADOSGW_BEAST_OPENSSL "Rados Gateway's Beast frontend uses OpenSSL" ON)
|
|
|
|
|
2016-10-13 15:35:27 +00:00
|
|
|
if(WITH_RADOSGW)
|
|
|
|
find_package(EXPAT REQUIRED)
|
2016-12-05 04:56:35 +00:00
|
|
|
if(WITH_RADOSGW_FCGI_FRONTEND)
|
|
|
|
find_package(fcgi REQUIRED)
|
|
|
|
endif()
|
2017-11-26 20:46:26 +00:00
|
|
|
if(WITH_RADOSGW_BEAST_FRONTEND AND NOT WITH_BOOST_CONTEXT)
|
|
|
|
message(WARNING "disabling WITH_RADOSGW_BEAST_FRONTEND, which depends on WITH_BOOST_CONTEXT")
|
|
|
|
set(WITH_RADOSGW_BEAST_FRONTEND OFF)
|
|
|
|
endif()
|
2017-12-04 12:28:37 +00:00
|
|
|
find_package(liboath REQUIRED)
|
2016-10-15 01:13:22 +00:00
|
|
|
|
2018-03-02 16:41:42 +00:00
|
|
|
# https://curl.haxx.se/docs/install.html mentions the
|
|
|
|
# configure flags for various ssl backends
|
|
|
|
execute_process(
|
|
|
|
COMMAND
|
|
|
|
"sh" "-c"
|
|
|
|
"curl-config --configure | grep with-ssl"
|
|
|
|
RESULT_VARIABLE NO_CURL_SSL_LINK
|
|
|
|
ERROR_VARIABLE CURL_CONFIG_ERRORS
|
|
|
|
)
|
|
|
|
if (CURL_CONFIG_ERRORS)
|
|
|
|
message(WARNING "unable to run curl-config; rgw cannot make ssl requests to external systems reliably")
|
|
|
|
endif()
|
2018-02-06 22:06:11 +00:00
|
|
|
|
|
|
|
if (WITH_RADOSGW_BEAST_FRONTEND AND WITH_RADOSGW_BEAST_OPENSSL)
|
|
|
|
find_package(OpenSSL REQUIRED)
|
|
|
|
else()
|
|
|
|
find_package(OpenSSL)
|
|
|
|
endif()
|
|
|
|
|
2016-07-11 21:54:07 +00:00
|
|
|
if (OPENSSL_FOUND)
|
2018-03-02 16:41:42 +00:00
|
|
|
if (NOT NO_CURL_SSL_LINK)
|
2018-03-02 09:41:51 +00:00
|
|
|
message(STATUS "libcurl is linked with openssl: explicitly setting locks")
|
2018-03-02 16:41:42 +00:00
|
|
|
set(WITH_CURL_OPENSSL ON)
|
|
|
|
endif() # CURL_SSL_LINK
|
2016-07-11 21:54:07 +00:00
|
|
|
execute_process(
|
|
|
|
COMMAND
|
|
|
|
"sh" "-c"
|
|
|
|
"objdump -p ${OPENSSL_SSL_LIBRARY} | sed -n 's/^ SONAME *//p'"
|
|
|
|
OUTPUT_VARIABLE LIBSSL_SONAME
|
|
|
|
ERROR_VARIABLE OBJDUMP_ERRORS
|
|
|
|
RESULT_VARIABLE OBJDUMP_RESULTS
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
if (OBJDUMP_RESULTS)
|
|
|
|
message(FATAL_ERROR "can't run objdump: ${OBJDUMP_RESULTS}")
|
|
|
|
endif()
|
|
|
|
if (NOT OBJDUMP_ERRORS STREQUAL "")
|
|
|
|
message(WARNING "message from objdump: ${OBJDUMP_ERRORS}")
|
|
|
|
endif()
|
|
|
|
execute_process(
|
|
|
|
COMMAND
|
|
|
|
"sh" "-c"
|
|
|
|
"objdump -p ${OPENSSL_CRYPTO_LIBRARY} | sed -n 's/^ SONAME *//p'"
|
|
|
|
OUTPUT_VARIABLE LIBCRYPTO_SONAME
|
|
|
|
ERROR_VARIABLE OBJDUMP_ERRORS
|
|
|
|
RESULT_VARIABLE OBJDUMP_RESULTS
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
if (OBJDUMP_RESULTS)
|
|
|
|
message(FATAL_ERROR "can't run objdump: ${OBJDUMP_RESULTS}")
|
|
|
|
endif()
|
|
|
|
if (NOT OBJDUMP_ERRORS STREQUAL "")
|
|
|
|
message(WARNING "message from objdump: ${OBJDUMP_ERRORS}")
|
|
|
|
endif()
|
|
|
|
message(STATUS "ssl soname: ${LIBSSL_SONAME}")
|
|
|
|
message(STATUS "crypto soname: ${LIBCRYPTO_SONAME}")
|
|
|
|
else()
|
|
|
|
message(WARNING "ssl not found: rgw civetweb may fail to dlopen libssl libcrypto")
|
2018-03-02 16:41:42 +00:00
|
|
|
endif() # OPENSSL_FOUND
|
2016-07-11 21:54:07 +00:00
|
|
|
endif (WITH_RADOSGW)
|
|
|
|
|
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)
|
2018-01-23 04:58:10 +00:00
|
|
|
# Please specify 3 or 3.[0-7] if you want to build with python3 support.
|
|
|
|
# FindPyhonInterp and FindPythonLibs think they belong to different families.
|
|
|
|
set(MGR_PYTHON_VERSION "2.7" CACHE
|
|
|
|
STRING "minimal required version of python runtime for running mgr plugins. ")
|
|
|
|
find_package(PythonInterp ${MGR_PYTHON_VERSION} REQUIRED)
|
|
|
|
find_package(PythonLibs ${MGR_PYTHON_VERSION} REQUIRED)
|
|
|
|
set(MGR_PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})
|
|
|
|
set(MGR_PYTHON_LIBRARIES ${PYTHON_LIBRARIES})
|
|
|
|
set(MGR_PYTHON_VERSION_MAJOR ${PYTHON_VERSION_MAJOR})
|
2017-10-27 17:57:55 +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)
|
2017-10-27 17:57:55 +00:00
|
|
|
set(HAVE_THREAD_SAFE_RES_QUERY 1 CACHE INTERNAL "Thread safe res_query supported.")
|
|
|
|
endif()
|
2015-10-16 17:12:41 +00:00
|
|
|
|
2015-12-07 18:33:32 +00:00
|
|
|
option(WITH_REENTRANT_STRSIGNAL "strsignal is reentrant" OFF)
|
|
|
|
if(WITH_REENTRANT_STRSIGNAL)
|
2017-10-27 17:57:55 +00:00
|
|
|
set(HAVE_REENTRANT_STRSIGNAL 1 CACHE INTERNAL "Reentrant strsignal is supported.")
|
|
|
|
endif()
|
2015-12-07 18:33:32 +00:00
|
|
|
|
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)
|
|
|
|
|
2016-12-05 19:58:22 +00:00
|
|
|
#option for EventTrace
|
|
|
|
option(WITH_EVENTTRACE "Event tracing support" OFF)
|
|
|
|
|
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})
|
|
|
|
|
2017-05-11 13:05:31 +00:00
|
|
|
option(WITH_OSD_INSTRUMENT_FUNCTIONS OFF)
|
|
|
|
|
2015-12-31 04:34:30 +00:00
|
|
|
#option for Babeltrace
|
2017-05-26 09:58:14 +00:00
|
|
|
option(WITH_BABELTRACE "Babeltrace libraries are enabled" ON)
|
|
|
|
if(WITH_BABELTRACE)
|
|
|
|
set(HAVE_BABELTRACE ON)
|
2015-12-31 04:34:30 +00:00
|
|
|
find_package(babeltrace REQUIRED)
|
|
|
|
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})
|
2017-05-26 09:58:14 +00:00
|
|
|
endif(WITH_BABELTRACE)
|
2015-12-31 04:34:30 +00:00
|
|
|
|
2016-05-02 22:21:32 +00:00
|
|
|
option(DEBUG_GATHER "C_Gather debugging is enabled" ON)
|
|
|
|
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)
|
|
|
|
|
2018-02-21 12:03:23 +00:00
|
|
|
# fio
|
|
|
|
option(WITH_FIO "build with fio plugin enabled" OFF)
|
|
|
|
option(WITH_SYSTEM_FIO "require and build with system fio" OFF)
|
|
|
|
if(WITH_SYSTEM_FIO)
|
2015-09-29 18:40:39 +00:00
|
|
|
find_package(fio REQUIRED)
|
2018-02-21 12:03:23 +00:00
|
|
|
elseif(WITH_FIO)
|
|
|
|
set(FIO_INCLUDE_DIR ${CMAKE_BINARY_DIR}/src/fio)
|
|
|
|
include(BuildFIO)
|
|
|
|
build_fio()
|
|
|
|
endif()
|
2015-09-29 18:40:39 +00:00
|
|
|
|
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-12-22 04:36:37 +00:00
|
|
|
# ASAN and friends
|
|
|
|
option(WITH_ASAN "build with ASAN" OFF)
|
|
|
|
option(WITH_ASAN_LEAK "explicitly enable ASAN leak detection" OFF)
|
|
|
|
|
|
|
|
if(WITH_ASAN)
|
2017-10-13 05:34:09 +00:00
|
|
|
list(APPEND SANITIZE_FLAGS "address")
|
2016-12-22 04:36:37 +00:00
|
|
|
if(WITH_ASAN_LEAK)
|
2017-10-13 05:34:09 +00:00
|
|
|
list(APPEND SANITIZE_FLAGS "leak")
|
2016-12-22 04:36:37 +00:00
|
|
|
endif()
|
2017-10-13 05:34:09 +00:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lasan")
|
2016-12-22 04:36:37 +00:00
|
|
|
if(HAVE_JEMALLOC)
|
|
|
|
message(FATAL "ASAN does not work well with JeMalloc")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
option(WITH_TSAN "build with TSAN" OFF)
|
|
|
|
if(WITH_TSAN)
|
2017-10-13 05:34:09 +00:00
|
|
|
if(WITH_ASAN AND WITH_ASAN_LEAK)
|
2016-12-22 04:36:37 +00:00
|
|
|
message(FATAL_ERROR "Cannot combine -fsanitize-leak w/-fsanitize-thread")
|
2017-10-13 05:34:09 +00:00
|
|
|
elseif(HAVE_JEMALLOC)
|
2016-12-22 04:36:37 +00:00
|
|
|
message(FATAL "TSAN does not work well with JeMalloc")
|
|
|
|
endif()
|
2017-10-13 05:34:09 +00:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie -ltsan")
|
|
|
|
list(APPEND SANITIZE_FLAGS "thread")
|
2016-12-22 04:36:37 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
option(WITH_UBSAN "build with UBSAN" OFF)
|
|
|
|
if(WITH_UBSAN)
|
|
|
|
if(HAVE_JEMALLOC)
|
|
|
|
message(FATAL "UBSAN does not work well with JeMalloc")
|
|
|
|
endif()
|
2017-10-13 05:34:09 +00:00
|
|
|
list(APPEND SANITIZE_FLAGS "undefined")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(SANITIZE_FLAGS)
|
|
|
|
string(REPLACE ";" "," SANITIZE_FLAGS "${SANITIZE_FLAGS}")
|
|
|
|
set(SANITIZE_CFLAGS "-fsanitize=${SANITIZE_FLAGS} -fno-omit-frame-pointer")
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZE_CFLAGS}")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZE_CFLAGS}")
|
2016-12-22 04:36:37 +00:00
|
|
|
endif()
|
|
|
|
|
2016-12-10 04:45:22 +00:00
|
|
|
# Rocksdb
|
|
|
|
option(WITH_SYSTEM_ROCKSDB "require and build with system rocksdb" OFF)
|
|
|
|
if (WITH_SYSTEM_ROCKSDB)
|
2017-09-19 05:36:31 +00:00
|
|
|
find_package(rocksdb 5.8 REQUIRED)
|
2016-12-10 04:45:22 +00:00
|
|
|
endif()
|
|
|
|
|
2016-09-22 15:41:53 +00:00
|
|
|
# Boost
|
|
|
|
option(WITH_SYSTEM_BOOST "require and build with system Boost" OFF)
|
|
|
|
|
2017-05-23 07:44:45 +00:00
|
|
|
# Boost::thread depends on Boost::atomic, so list it explicitly.
|
2017-04-20 07:14:02 +00:00
|
|
|
set(BOOST_COMPONENTS
|
2018-03-20 14:59:59 +00:00
|
|
|
atomic chrono thread system regex random program_options date_time iostreams)
|
2017-05-18 07:32:59 +00:00
|
|
|
set(BOOST_HEADER_COMPONENTS container)
|
|
|
|
|
2017-04-20 07:14:02 +00:00
|
|
|
if(WITH_MGR)
|
|
|
|
list(APPEND BOOST_COMPONENTS python)
|
|
|
|
endif()
|
2017-11-26 20:46:26 +00:00
|
|
|
if(WITH_BOOST_CONTEXT)
|
|
|
|
list(APPEND BOOST_COMPONENTS context coroutine)
|
|
|
|
endif()
|
2017-04-20 07:14:02 +00:00
|
|
|
|
2017-04-16 05:03:52 +00:00
|
|
|
set(Boost_USE_MULTITHREADED ON)
|
|
|
|
# require minimally the bundled version
|
|
|
|
if(WITH_SYSTEM_BOOST)
|
2016-09-22 15:41:53 +00:00
|
|
|
if(ENABLE_SHARED)
|
|
|
|
set(Boost_USE_STATIC_LIBS OFF)
|
|
|
|
else()
|
|
|
|
set(Boost_USE_STATIC_LIBS ON)
|
|
|
|
endif()
|
2018-06-04 14:27:55 +00:00
|
|
|
find_package(Boost 1.67 COMPONENTS ${BOOST_COMPONENTS} REQUIRED)
|
2016-09-22 15:41:53 +00:00
|
|
|
else()
|
|
|
|
set(BOOST_J 1 CACHE STRING
|
|
|
|
"max jobs for Boost build") # override w/-DBOOST_J=<n>
|
2017-04-20 07:14:02 +00:00
|
|
|
set(Boost_USE_STATIC_LIBS ON)
|
2017-04-16 05:03:52 +00:00
|
|
|
include(BuildBoost)
|
2018-06-04 14:27:55 +00:00
|
|
|
build_boost(1.67
|
2017-04-16 05:03:52 +00:00
|
|
|
COMPONENTS ${BOOST_COMPONENTS} ${BOOST_HEADER_COMPONENTS})
|
2017-04-16 05:04:16 +00:00
|
|
|
include_directories(BEFORE SYSTEM ${Boost_INCLUDE_DIRS})
|
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
|
|
|
|
2018-02-28 09:08:55 +00:00
|
|
|
# dashboard angular2 frontend
|
2018-03-15 08:50:22 +00:00
|
|
|
option(WITH_MGR_DASHBOARD_FRONTEND "Build the mgr/dashboard frontend using `npm`" ON)
|
2018-02-28 09:08:55 +00:00
|
|
|
|
2016-11-08 19:18:48 +00:00
|
|
|
include_directories(SYSTEM ${PROJECT_BINARY_DIR}/include)
|
2014-06-23 22:32:32 +00:00
|
|
|
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
|
2018-02-09 21:16:43 +00:00
|
|
|
execute_process(
|
|
|
|
COMMAND ./librarytest.sh ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_FLAGS}
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
OUTPUT_VARIABLE CXX_STDLIB
|
|
|
|
)
|
|
|
|
|
|
|
|
if(CXX_STDLIB STREQUAL "libstdc++" OR CXX_STDLIB STREQUAL "libc++")
|
|
|
|
message(STATUS "We are using ${CXX_STDLIB}.")
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR
|
|
|
|
"Unable to determine C++ standard library, got ${CXX_STDLIB}.")
|
|
|
|
endif()
|
|
|
|
|
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
|
|
|
|
2018-02-12 17:11:31 +00:00
|
|
|
option(WITH_SYSTEMD "install systemd target and service files" ON)
|
2016-06-30 08:01:08 +00:00
|
|
|
if(WITH_SYSTEMD)
|
|
|
|
add_subdirectory(systemd)
|
|
|
|
endif()
|
|
|
|
|
2017-11-20 07:42:09 +00:00
|
|
|
if(LINUX)
|
|
|
|
add_subdirectory(etc/sysctl)
|
|
|
|
endif()
|
2017-11-14 15:32:39 +00:00
|
|
|
|
2017-04-04 02:28:10 +00:00
|
|
|
include(CTags)
|
2017-04-07 03:55:10 +00:00
|
|
|
option(CTAG_EXCLUDES "Exclude files/directories when running ctag.")
|
|
|
|
add_tags(ctags
|
|
|
|
SRC_DIR src
|
|
|
|
TAG_FILE tags
|
|
|
|
EXCLUDE_OPTS ${CTAG_EXCLUDES}
|
2017-06-13 11:43:54 +00:00
|
|
|
EXCLUDES "*.js" "*.css")
|
2017-04-07 03:55:10 +00:00
|
|
|
add_custom_target(tags DEPENDS ctags)
|