mirror of
https://github.com/ceph/ceph
synced 2026-08-01 22:45:39 +00:00
cmake: detect linux/blk/zoned support
* add find_package() support for detecting the existence of linux/blkzoned.h before using it. * link against Linux::ZNS for adding the compilation definition of HAVE_ZNS instead of including it in the global config.h * move the CMake option closer to where it is used for better readability. as this option takes effect only if crimson is compiled. * make WITH_ZNS an option which depends on the value of CMAKE_SYSTEM_NAME. it is hidden and off if CMAKE_SYSTEM_NAME is not "Linux". Signed-off-by: Kefu Chai <tchaikov@gmail.com>
This commit is contained in:
parent
2ec4a586a8
commit
76c35c6dd9
@ -193,12 +193,6 @@ if(WITH_ZFS)
|
||||
set(HAVE_LIBZFS ${ZFS_FOUND})
|
||||
endif()
|
||||
|
||||
option(WITH_ZNS "enable zns support" OFF)
|
||||
if (WITH_ZNS)
|
||||
# TODO: add detection, need kernel header >= 5.5
|
||||
set(HAVE_ZNS ON)
|
||||
endif()
|
||||
|
||||
option(WITH_BLUESTORE "Bluestore OSD backend" ON)
|
||||
if(WITH_BLUESTORE)
|
||||
if(LINUX)
|
||||
|
||||
18
cmake/modules/FindLinuxZNS.cmake
Normal file
18
cmake/modules/FindLinuxZNS.cmake
Normal file
@ -0,0 +1,18 @@
|
||||
# Try to find linux/blkzoned.h
|
||||
|
||||
find_path(LinuxZNS_INCLUDE_DIR NAMES
|
||||
"linux/blkzoned.h")
|
||||
|
||||
find_package_handle_standard_args(LinuxZNS
|
||||
REQUIRED_VARS
|
||||
LinuxZNS_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(
|
||||
LinuxZNS_INCLUDE_DIR)
|
||||
|
||||
if(LinuxZNS_FOUND AND NOT (TARGET Linux::ZNS))
|
||||
add_library(Linux::ZNS INTERFACE IMPORTED)
|
||||
set_target_properties(Linux::ZNS PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${LinuxZNS_INCLUDE_DIR}"
|
||||
INTERFACE_COMPILE_DEFINITIONS HAVE_ZNS=1)
|
||||
endif()
|
||||
@ -43,7 +43,10 @@ set(crimson_seastore_srcs
|
||||
${PROJECT_SOURCE_DIR}/src/os/Transaction.cc
|
||||
)
|
||||
|
||||
if(HAVE_ZNS)
|
||||
CMAKE_DEPENDENT_OPTION(WITH_ZNS "enable Linux ZNS support" OFF
|
||||
"CMAKE_SYSTEM_NAME STREQUAL Linux" OFF)
|
||||
if(WITH_ZNS)
|
||||
find_package(LinuxZNS REQUIRED)
|
||||
list(APPEND crimson_seastore_srcs
|
||||
segment_manager/zns.cc)
|
||||
endif()
|
||||
@ -53,5 +56,10 @@ add_library(crimson-seastore STATIC
|
||||
|
||||
target_link_libraries(crimson-seastore
|
||||
crimson)
|
||||
if(WITH_ZNS)
|
||||
target_link_libraries(crimson-seastore
|
||||
Linux::ZNS)
|
||||
endif()
|
||||
|
||||
set_target_properties(crimson-seastore PROPERTIES
|
||||
JOB_POOL_COMPILE heavy_compile_job_pool)
|
||||
|
||||
@ -108,9 +108,6 @@
|
||||
/* Define to 1 if you have libxfs */
|
||||
#cmakedefine HAVE_LIBXFS 1
|
||||
|
||||
/* Define to 1 if zns support enabled */
|
||||
#cmakedefine HAVE_ZNS
|
||||
|
||||
/* SPDK conditional compilation */
|
||||
#cmakedefine HAVE_SPDK
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user