]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: add findndctl and finddaxctl function
authorYin Congmin <congmin.yin@intel.com>
Fri, 13 May 2022 12:47:07 +0000 (20:47 +0800)
committerYin Congmin <congmin.yin@intel.com>
Tue, 12 Jul 2022 02:32:57 +0000 (10:32 +0800)
In order to support the character device of pmem usage in bluestore via
libpmem built by Ceph itself, we need to enable daxctl and ndctl
dependency. add the installation of ndctl and find it. the version of
ndctl and daxctl library requires >63. "apt-get install" meet the version
under ubuntu focal.

the installation of ndctl-devel in ceph.spec.in has not been verified.

Signed-off-by: Yin Congmin <congmin.yin@intel.com>
ceph.spec.in
cmake/modules/Finddaxctl.cmake [new file with mode: 0644]
cmake/modules/Findndctl.cmake [new file with mode: 0644]
debian/control
src/CMakeLists.txt

index 718731c88e9e8788bd195873c5abb928df021cf0..2664dda5b33bc2bc478497726fe21ade783663e6 100644 (file)
@@ -295,8 +295,10 @@ BuildRequires:  nlohmann_json-devel
 BuildRequires:  libevent-devel
 %endif
 %if 0%{with system_pmdk}
+BuildRequires:  ndctl-devel >= 63
+BuildRequires:  daxctl-devel >= 63
 BuildRequires:  libpmem-devel
-BuildRequires:  libpmemobj-devel
+BuildRequires:  libpmemobj-devel >= 1.8
 %endif
 %if 0%{with system_arrow}
 BuildRequires:  arrow-devel
diff --git a/cmake/modules/Finddaxctl.cmake b/cmake/modules/Finddaxctl.cmake
new file mode 100644 (file)
index 0000000..fbe5804
--- /dev/null
@@ -0,0 +1,42 @@
+# - Find libdaxctl
+# Find the daxctl libraries and includes
+#
+# daxctl_INCLUDE_DIR - where to find libdaxctl.h etc.
+# daxctl_LIBRARIES - List of libraries when using daxctl.
+# daxctl_FOUND - True if daxctl found.
+
+find_path(daxctl_INCLUDE_DIR daxctl/libdaxctl.h)
+
+if(daxctl_INCLUDE_DIR AND EXISTS "${daxctl_INCLUDE_DIR}/libdaxctl.h")
+  foreach(ver "MAJOR" "MINOR" "RELEASE")
+    file(STRINGS "${daxctl_INCLUDE_DIR}/libdaxctl.h" daxctl_VER_${ver}_LINE
+      REGEX "^#define[ \t]+daxctl_VERSION_${ver}[ \t]+[0-9]+[ \t]+.*$")
+    string(REGEX REPLACE "^#define[ \t]+daxctl_VERSION_${ver}[ \t]+([0-9]+)[ \t]+.*$"
+      "\\1" daxctl_VERSION_${ver} "${daxctl_VER_${ver}_LINE}")
+    unset(${daxctl_VER_${ver}_LINE})
+  endforeach()
+  set(daxctl_VERSION_STRING
+    "${daxctl_VERSION_MAJOR}.${daxctl_VERSION_MINOR}.${daxctl_VERSION_RELEASE}")
+endif()
+
+find_library(daxctl_LIBRARY daxctl)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(daxctl
+  REQUIRED_VARS daxctl_LIBRARY daxctl_INCLUDE_DIR
+  VERSION_VAR daxctl_VERSION_STRING)
+
+mark_as_advanced(daxctl_INCLUDE_DIR daxctl_LIBRARY)
+
+if(daxctl_FOUND)
+  set(daxctl_INCLUDE_DIRS ${daxctl_INCLUDE_DIR})
+  set(daxctl_LIBRARIES ${daxctl_LIBRARY})
+  if(NOT (TARGET daxctl::daxctl))
+    add_library(daxctl::daxctl UNKNOWN IMPORTED)
+    set_target_properties(daxctl::daxctl PROPERTIES
+      INTERFACE_INCLUDE_DIRECTORIES "${daxctl_INCLUDE_DIRS}"
+      IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+      IMPORTED_LOCATION "${daxctl_LIBRARIES}"
+      VERSION "${daxctl_VERSION_STRING}")
+  endif()
+endif()
diff --git a/cmake/modules/Findndctl.cmake b/cmake/modules/Findndctl.cmake
new file mode 100644 (file)
index 0000000..12afa17
--- /dev/null
@@ -0,0 +1,42 @@
+# - Find libndctl
+# Find the ndctl libraries and includes
+#
+# ndctl_INCLUDE_DIR - where to find libndctl.h etc.
+# ndctl_LIBRARIES - List of libraries when using ndctl.
+# ndctl_FOUND - True if ndctl found.
+
+find_path(ndctl_INCLUDE_DIR ndctl/libndctl.h)
+
+if(ndctl_INCLUDE_DIR AND EXISTS "${ndctl_INCLUDE_DIR}/libndctl.h")
+  foreach(ver "MAJOR" "MINOR" "RELEASE")
+    file(STRINGS "${ndctl_INCLUDE_DIR}/libndctl.h" ndctl_VER_${ver}_LINE
+      REGEX "^#define[ \t]+ndctl_VERSION_${ver}[ \t]+[0-9]+[ \t]+.*$")
+    string(REGEX REPLACE "^#define[ \t]+ndctl_VERSION_${ver}[ \t]+([0-9]+)[ \t]+.*$"
+      "\\1" ndctl_VERSION_${ver} "${ndctl_VER_${ver}_LINE}")
+    unset(${ndctl_VER_${ver}_LINE})
+  endforeach()
+  set(ndctl_VERSION_STRING
+    "${ndctl_VERSION_MAJOR}.${ndctl_VERSION_MINOR}.${ndctl_VERSION_RELEASE}")
+endif()
+
+find_library(ndctl_LIBRARY ndctl)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(ndctl
+  REQUIRED_VARS ndctl_LIBRARY ndctl_INCLUDE_DIR
+  VERSION_VAR ndctl_VERSION_STRING)
+
+mark_as_advanced(ndctl_INCLUDE_DIR ndctl_LIBRARY)
+
+if(ndctl_FOUND)
+  set(ndctl_INCLUDE_DIRS ${ndctl_INCLUDE_DIR})
+  set(ndctl_LIBRARIES ${ndctl_LIBRARY})
+  if(NOT (TARGET ndctl::ndctl))
+    add_library(ndctl::ndctl UNKNOWN IMPORTED)
+    set_target_properties(ndctl::ndctl PROPERTIES
+      INTERFACE_INCLUDE_DIRECTORIES "${ndctl_INCLUDE_DIRS}"
+      IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+      IMPORTED_LOCATION "${ndctl_LIBRARIES}"
+      VERSION "${ndctl_VERSION_STRING}")
+  endif()
+endif()
index 23b79088894f85d98b878ede46f40e73beef87cd..47520fffab2df0b66821ac77ea86c8531f12adc2 100644 (file)
@@ -78,6 +78,8 @@ Build-Depends: automake,
                libxmlsec1-nss <pkg.ceph.check>,
                libxmlsec1-openssl <pkg.ceph.check>,
                libxmlsec1-dev <pkg.ceph.check>,
+               libdaxctl-dev (>= 63) <pkg.ceph.pmdk>,
+               libndctl-dev (>= 63) <pkg.ceph.pmdk>,
                libpmem-dev <pkg.ceph.pmdk>,
                libpmemobj-dev (>= 1.8) <pkg.ceph.pmdk>,
                ninja-build,
index 7fa82a15ebb21aa980efcc298c7ac3df7880e93d..e9a9aeb9aec58e797da9c7716f65f1a0f3d66c69 100644 (file)
@@ -483,6 +483,8 @@ 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)