mirror of
https://github.com/ceph/ceph
synced 2025-01-03 09:32:43 +00:00
cmake: add ndctl and daxctl to build pmdk
In order to enable the pmem character device, add ndctl=y to the parameter of compiling the pmdk library when WITH_BLUESTORE_PMEM is ON. Because after find_ndctl and find_daxctl are added, the dependency packages required by WITH_BLUESTORE_PMEM and WITH_RBD_RWL become more different. So separated these two. libpmem has no version required. libpmemobj required version >=1.8. Signed-off-by: Yin Congmin <congmin.yin@intel.com>
This commit is contained in:
parent
b6b24852a6
commit
eb94cda7bc
@ -1,4 +1,4 @@
|
||||
function(build_pmdk)
|
||||
function(build_pmdk enable_ndctl)
|
||||
include(FindMake)
|
||||
find_make("MAKE_EXECUTABLE" "make_cmd")
|
||||
|
||||
@ -14,6 +14,14 @@ function(build_pmdk)
|
||||
GIT_CONFIG advice.detachedHead=false)
|
||||
endif()
|
||||
|
||||
set(LIBPMEM_INTERFACE_LINK_LIBRARIES Threads::Threads)
|
||||
if(${enable_ndctl})
|
||||
set(ndctl "y")
|
||||
list(APPEND LIBPMEM_INTERFACE_LINK_LIBRARIES ndctl::ndctl daxctl::daxctl)
|
||||
else()
|
||||
set(ndctl "n")
|
||||
endif()
|
||||
|
||||
# Use debug PMDK libs in debug lib/rbd builds
|
||||
if(CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
set(PMDK_LIB_DIR "debug")
|
||||
@ -25,11 +33,7 @@ function(build_pmdk)
|
||||
ExternalProject_Add(pmdk_ext
|
||||
${source_dir_args}
|
||||
CONFIGURE_COMMAND ""
|
||||
# Explicitly built w/o NDCTL, otherwise if ndtcl is present on the
|
||||
# build system tests statically linking to librbd (which uses
|
||||
# libpmemobj) will not link (because we don't build the ndctl
|
||||
# static library here).
|
||||
BUILD_COMMAND ${make_cmd} CC=${CMAKE_C_COMPILER} EXTRA_CFLAGS=-Wno-error NDCTL_ENABLE=n BUILD_EXAMPLES=n BUILD_BENCHMARKS=n DOC=n
|
||||
BUILD_COMMAND ${make_cmd} CC=${CMAKE_C_COMPILER} EXTRA_CFLAGS=-Wno-error NDCTL_ENABLE=${ndctl} BUILD_EXAMPLES=n BUILD_BENCHMARKS=n DOC=n
|
||||
BUILD_IN_SOURCE 1
|
||||
BUILD_BYPRODUCTS "<SOURCE_DIR>/src/${PMDK_LIB_DIR}/libpmem.a" "<SOURCE_DIR>/src/${PMDK_LIB_DIR}/libpmemobj.a"
|
||||
INSTALL_COMMAND "")
|
||||
@ -48,7 +52,7 @@ function(build_pmdk)
|
||||
set_target_properties(pmdk::pmem PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${PMDK_INCLUDE}
|
||||
IMPORTED_LOCATION "${PMDK_LIB}/libpmem.a"
|
||||
INTERFACE_LINK_LIBRARIES Threads::Threads)
|
||||
INTERFACE_LINK_LIBRARIES "${LIBPMEM_INTERFACE_LINK_LIBRARIES}")
|
||||
|
||||
# libpmemobj
|
||||
add_library(pmdk::pmemobj STATIC IMPORTED GLOBAL)
|
||||
|
@ -483,8 +483,6 @@ if(WIN32)
|
||||
endif()
|
||||
|
||||
if(WITH_BLUESTORE_PMEM OR WITH_RBD_RWL)
|
||||
find_package(ndctl 63 REQUIRED)
|
||||
find_package(daxctl 63 REQUIRED)
|
||||
if(WITH_SYSTEM_PMDK)
|
||||
set(pmdk_COMPONENTS)
|
||||
if(WITH_BLUESTORE_PMEM)
|
||||
@ -496,7 +494,14 @@ if(WITH_BLUESTORE_PMEM OR WITH_RBD_RWL)
|
||||
find_package(pmdk 1.8 REQUIRED COMPONENTS ${pmdk_COMPONENTS})
|
||||
else()
|
||||
include(Buildpmdk)
|
||||
build_pmdk()
|
||||
if(WITH_BLUESTORE_PMEM)
|
||||
set(enable_ndctl ON)
|
||||
find_package(ndctl 63 REQUIRED)
|
||||
find_package(daxctl 63 REQUIRED)
|
||||
else()
|
||||
set(enable_ndctl OFF)
|
||||
endif()
|
||||
build_pmdk(${enable_ndctl})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user