mirror of
https://github.com/ceph/ceph
synced 2025-03-20 17:27:01 +00:00
cmake: Add the support to use system PMDK library
Signed-off-by: Scott Peterson <scott.d.peterson@intel.com> Signed-off-by: Xiaoyan Li <xiaoyan.li@intel.com>
This commit is contained in:
parent
4528aa2d0f
commit
4959835c07
@ -272,6 +272,9 @@ include(CMakeDependentOption)
|
|||||||
CMAKE_DEPENDENT_OPTION(WITH_BLUESTORE_PMEM "Enable PMDK libraries" OFF
|
CMAKE_DEPENDENT_OPTION(WITH_BLUESTORE_PMEM "Enable PMDK libraries" OFF
|
||||||
"WITH_BLUESTORE" OFF)
|
"WITH_BLUESTORE" OFF)
|
||||||
|
|
||||||
|
CMAKE_DEPENDENT_OPTION(WITH_SYSTEM_PMDK "Require and build with system PMDK" OFF
|
||||||
|
"WITH_BLUESTORE_PMEM" OFF)
|
||||||
|
|
||||||
if(WITH_BLUESTORE_PMEM)
|
if(WITH_BLUESTORE_PMEM)
|
||||||
set(HAVE_BLUESTORE_PMEM ON)
|
set(HAVE_BLUESTORE_PMEM ON)
|
||||||
endif()
|
endif()
|
||||||
|
45
cmake/modules/Findpmem.cmake
Normal file
45
cmake/modules/Findpmem.cmake
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# - Find pmem
|
||||||
|
#
|
||||||
|
# PMEM_INCLUDE_DIR - Where to find libpmem.h
|
||||||
|
# PMEM_LIBRARIES - List of libraries when using pmdk.
|
||||||
|
# pmem_FOUND - True if pmem found.
|
||||||
|
# PMEMOBJ_INCLUDE_DIR - Where to find libpmemobj.h
|
||||||
|
# PMEMOBJ_LIBRARIES - List of libraries when using pmdk obj.
|
||||||
|
# pmemobj_FOUND - True if pmemobj found.
|
||||||
|
|
||||||
|
find_path(PMEM_INCLUDE_DIR libpmem.h)
|
||||||
|
find_library(PMEM_LIBRARIES pmem)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(pmem
|
||||||
|
DEFAULT_MSG PMEM_LIBRARIES PMEM_INCLUDE_DIR)
|
||||||
|
|
||||||
|
mark_as_advanced(
|
||||||
|
PMEM_INCLUDE_DIR
|
||||||
|
PMEM_LIBRARIES)
|
||||||
|
|
||||||
|
if(pmem_FOUND AND NOT TARGET pmem::pmem)
|
||||||
|
add_library(pmem::pmem UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(pmem::pmem PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${PMEM_INCLUDE_DIR}"
|
||||||
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||||
|
IMPORTED_LOCATION "${PMEM_LIBRARIES}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_path(PMEMOBJ_INCLUDE_DIR libpmemobj.h)
|
||||||
|
find_library(PMEMOBJ_LIBRARIES pmemobj)
|
||||||
|
|
||||||
|
find_package_handle_standard_args(pmemobj
|
||||||
|
DEFAULT_MSG PMEMOBJ_LIBRARIES PMEMOBJ_INCLUDE_DIR)
|
||||||
|
|
||||||
|
mark_as_advanced(
|
||||||
|
PMEMOBJ_INCLUDE_DIR
|
||||||
|
PMEMOBJ_LIBRARIES)
|
||||||
|
|
||||||
|
if(pmemobj_FOUND AND NOT TARGET pmem::pmemobj)
|
||||||
|
add_library(pmem::pmemobj UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(pmem::pmemobj PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${PMEMOBJ_INCLUDE_DIR}"
|
||||||
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||||
|
IMPORTED_LOCATION "${PMEMOBJ_LIBRARIES}")
|
||||||
|
endif()
|
@ -403,6 +403,15 @@ if(WITH_DPDK)
|
|||||||
list(APPEND ceph_common_deps common_async_dpdk)
|
list(APPEND ceph_common_deps common_async_dpdk)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(WITH_BLUESTORE_PMEM)
|
||||||
|
if(WITH_SYSTEM_PMDK)
|
||||||
|
find_package(pmem REQUIRED)
|
||||||
|
else()
|
||||||
|
include(Buildpmem)
|
||||||
|
build_pmem()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
add_library(common STATIC ${ceph_common_objs})
|
add_library(common STATIC ${ceph_common_objs})
|
||||||
target_link_libraries(common ${ceph_common_deps})
|
target_link_libraries(common ${ceph_common_deps})
|
||||||
|
|
||||||
|
@ -122,8 +122,6 @@ if(WITH_BLUESTORE)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_BLUESTORE_PMEM)
|
if(WITH_BLUESTORE_PMEM)
|
||||||
include(Buildpmem)
|
|
||||||
build_pmem()
|
|
||||||
target_link_libraries(os pmem::pmem)
|
target_link_libraries(os pmem::pmem)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user