]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cmake: rename a series of pmem libraries to pmdk
authorYin Congmin <congmin.yin@intel.com>
Sat, 25 Jun 2022 09:43:52 +0000 (17:43 +0800)
committerYin Congmin <congmin.yin@intel.com>
Mon, 27 Jun 2022 17:16:33 +0000 (01:16 +0800)
At first, libpmem was the only library. Later, pmem related libraries
such as libpmemobj and libpmem2 were gradually added. These libraries
were also integrated into one named pmdk. So rename to pmdk.

Signed-off-by: Yin Congmin <congmin.yin@intel.com>
cmake/modules/Buildpmdk.cmake [new file with mode: 0644]
cmake/modules/Buildpmem.cmake [deleted file]
cmake/modules/Findpmdk.cmake [new file with mode: 0644]
cmake/modules/Findpmem.cmake [deleted file]
src/CMakeLists.txt
src/blk/CMakeLists.txt
src/librbd/CMakeLists.txt

diff --git a/cmake/modules/Buildpmdk.cmake b/cmake/modules/Buildpmdk.cmake
new file mode 100644 (file)
index 0000000..d07ac0e
--- /dev/null
@@ -0,0 +1,60 @@
+function(build_pmdk)
+  include(FindMake)
+  find_make("MAKE_EXECUTABLE" "make_cmd")
+
+  if(EXISTS "${PROJECT_SOURCE_DIR}/src/pmdk/Makefile")
+    set(source_dir_args
+      SOURCE_DIR "${PROJECT_SOURCE_DIR}/src/pmdk")
+  else()
+    set(source_dir_args
+      SOURCE_DIR ${CMAKE_BINARY_DIR}/src/pmdk
+      GIT_REPOSITORY https://github.com/ceph/pmdk.git
+      GIT_TAG "1.10"
+      GIT_SHALLOW TRUE
+      GIT_CONFIG advice.detachedHead=false)
+  endif()
+
+  # Use debug PMDK libs in debug lib/rbd builds
+  if(CMAKE_BUILD_TYPE STREQUAL Debug)
+    set(PMDK_LIB_DIR "debug")
+  else()
+    set(PMDK_LIB_DIR "nondebug")
+  endif()
+
+  include(ExternalProject)
+  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_IN_SOURCE 1
+      BUILD_BYPRODUCTS "<SOURCE_DIR>/src/${PMDK_LIB_DIR}/libpmem.a" "<SOURCE_DIR>/src/${PMDK_LIB_DIR}/libpmemobj.a"
+      INSTALL_COMMAND "")
+  unset(make_cmd)
+
+  ExternalProject_Get_Property(pmdk_ext source_dir)
+  set(PMDK_SRC "${source_dir}/src")
+  set(PMDK_INCLUDE "${source_dir}/src/include")
+  set(PMDK_LIB "${source_dir}/src/${PMDK_LIB_DIR}")
+
+  # libpmem
+  add_library(pmdk::pmem STATIC IMPORTED GLOBAL)
+  add_dependencies(pmdk::pmem pmdk_ext)
+  file(MAKE_DIRECTORY ${PMDK_INCLUDE})
+  find_package(Threads)
+  set_target_properties(pmdk::pmem PROPERTIES
+    INTERFACE_INCLUDE_DIRECTORIES ${PMDK_INCLUDE}
+    IMPORTED_LOCATION "${PMDK_LIB}/libpmem.a"
+    INTERFACE_LINK_LIBRARIES Threads::Threads)
+
+  # libpmemobj
+  add_library(pmdk::pmemobj STATIC IMPORTED GLOBAL)
+  add_dependencies(pmdk::pmemobj pmdk_ext)
+  set_target_properties(pmdk::pmemobj PROPERTIES
+    INTERFACE_INCLUDE_DIRECTORIES ${PMDK_INCLUDE}
+    IMPORTED_LOCATION "${PMDK_LIB}/libpmemobj.a"
+    INTERFACE_LINK_LIBRARIES "pmdk::pmem;${CMAKE_THREAD_LIBS_INIT}")
+endfunction()
diff --git a/cmake/modules/Buildpmem.cmake b/cmake/modules/Buildpmem.cmake
deleted file mode 100644 (file)
index e264fab..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-function(build_pmem)
-  include(FindMake)
-  find_make("MAKE_EXECUTABLE" "make_cmd")
-
-  if(EXISTS "${PROJECT_SOURCE_DIR}/src/pmdk/Makefile")
-    set(source_dir_args
-      SOURCE_DIR "${PROJECT_SOURCE_DIR}/src/pmdk")
-  else()
-    set(source_dir_args
-      SOURCE_DIR ${CMAKE_BINARY_DIR}/src/pmdk
-      GIT_REPOSITORY https://github.com/ceph/pmdk.git
-      GIT_TAG "1.10"
-      GIT_SHALLOW TRUE
-      GIT_CONFIG advice.detachedHead=false)
-  endif()
-
-  # Use debug PMDK libs in debug lib/rbd builds
-  if(CMAKE_BUILD_TYPE STREQUAL Debug)
-    set(PMDK_LIB_DIR "debug")
-  else()
-    set(PMDK_LIB_DIR "nondebug")
-  endif()
-
-  include(ExternalProject)
-  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_IN_SOURCE 1
-      BUILD_BYPRODUCTS "<SOURCE_DIR>/src/${PMDK_LIB_DIR}/libpmem.a" "<SOURCE_DIR>/src/${PMDK_LIB_DIR}/libpmemobj.a"
-      INSTALL_COMMAND "")
-  unset(make_cmd)
-
-  ExternalProject_Get_Property(pmdk_ext source_dir)
-  set(PMDK_SRC "${source_dir}/src")
-  set(PMDK_INCLUDE "${source_dir}/src/include")
-  set(PMDK_LIB "${source_dir}/src/${PMDK_LIB_DIR}")
-
-  # libpmem
-  add_library(pmem::pmem STATIC IMPORTED GLOBAL)
-  add_dependencies(pmem::pmem pmdk_ext)
-  file(MAKE_DIRECTORY ${PMDK_INCLUDE})
-  find_package(Threads)
-  set_target_properties(pmem::pmem PROPERTIES
-    INTERFACE_INCLUDE_DIRECTORIES ${PMDK_INCLUDE}
-    IMPORTED_LOCATION "${PMDK_LIB}/libpmem.a"
-    INTERFACE_LINK_LIBRARIES Threads::Threads)
-
-  # libpmemobj
-  add_library(pmem::pmemobj STATIC IMPORTED GLOBAL)
-  add_dependencies(pmem::pmemobj pmdk_ext)
-  set_target_properties(pmem::pmemobj PROPERTIES
-    INTERFACE_INCLUDE_DIRECTORIES ${PMDK_INCLUDE}
-    IMPORTED_LOCATION "${PMDK_LIB}/libpmemobj.a"
-    INTERFACE_LINK_LIBRARIES "pmem::pmem;${CMAKE_THREAD_LIBS_INIT}")
-endfunction()
diff --git a/cmake/modules/Findpmdk.cmake b/cmake/modules/Findpmdk.cmake
new file mode 100644 (file)
index 0000000..0afce08
--- /dev/null
@@ -0,0 +1,60 @@
+# - Find pmdk
+#
+# pmdk_INCLUDE_DIRS - Where to find pmdk headers
+# pmdk_LIBRARIES - List of libraries when using pmdk.
+# pmdk_FOUND - True if pmdk found.
+
+find_package(PkgConfig QUIET REQUIRED)
+
+# all pmdk libraries depend on pmem, so always find it
+set(pmdk_FIND_COMPONENTS ${pmdk_FIND_COMPONENTS} pmem)
+list(REMOVE_DUPLICATES pmdk_FIND_COMPONENTS)
+
+foreach(component ${pmdk_FIND_COMPONENTS})
+  set(pmdk_COMPONENTS pmem pmemobj)
+  list(FIND pmdk_COMPONENTS "${component}" found)
+  if(found EQUAL -1)
+    message(FATAL_ERROR "unknown pmdk component: ${component}")
+  endif()
+  pkg_check_modules(PKG_${component} QUIET "lib${component}")
+  if(NOT pmdk_VERSION_STRING OR PKG_${component}_VERSION VERSION_LESS pmdk_VERSION_STRING)
+    set(pmdk_VERSION_STRING ${PKG_${component}_VERSION})
+  endif()
+  find_path(pmdk_${component}_INCLUDE_DIR
+    NAMES lib${component}.h
+    HINTS ${PKG_${component}_INCLUDE_DIRS})
+  find_library(pmdk_${component}_LIBRARY
+    NAMES ${component}
+    HINTS ${PKG_${component}_LIBRARY_DIRS})
+  mark_as_advanced(
+    pmdk_${component}_INCLUDE_DIR
+    pmdk_${component}_LIBRARY)
+  list(APPEND pmdk_INCLUDE_DIRS "pmdk_${component}_INCLUDE_DIR")
+  list(APPEND pmdk_LIBRARIES "pmdk_${component}_LIBRARY")
+endforeach()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(pmdk
+  REQUIRED_VARS pmdk_INCLUDE_DIRS pmdk_LIBRARIES
+  VERSION_VAR pmdk_VERSION_STRING)
+
+mark_as_advanced(
+  pmdk_INCLUDE_DIRS
+  pmdk_LIBRARIES)
+
+if(pmdk_FOUND)
+  foreach(component pmem ${pmdk_FIND_COMPONENTS})
+    if(NOT TARGET pmdk::${component})
+      add_library(pmdk::${component} UNKNOWN IMPORTED)
+      set_target_properties(pmdk::${component} PROPERTIES
+        INTERFACE_INCLUDE_DIRECTORIES "${pmdk_${component}_INCLUDE_DIR}"
+        IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+        IMPORTED_LOCATION "${pmdk_${component}_LIBRARY}")
+      # all pmdk libraries call into pmdk::pmem
+      if(NOT component STREQUAL pmem)
+        set_target_properties(pmdk::${component} PROPERTIES
+          INTERFACE_LINK_LIBRARIES pmdk::pmem)
+      endif()
+    endif()
+  endforeach()
+endif()
diff --git a/cmake/modules/Findpmem.cmake b/cmake/modules/Findpmem.cmake
deleted file mode 100644 (file)
index 6f0a03a..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-# - Find pmem
-#
-# pmem_INCLUDE_DIRS - Where to find libpmem headers
-# pmem_LIBRARIES - List of libraries when using libpmem.
-# pmem_FOUND - True if pmem found.
-
-find_package(PkgConfig QUIET REQUIRED)
-
-# all pmem libraries depend on pmem, so always find it
-set(pmem_FIND_COMPONENTS ${pmem_FIND_COMPONENTS} pmem)
-list(REMOVE_DUPLICATES pmem_FIND_COMPONENTS)
-
-foreach(component ${pmem_FIND_COMPONENTS})
-  set(pmem_COMPONENTS pmem pmemobj)
-  list(FIND pmem_COMPONENTS "${component}" found)
-  if(found EQUAL -1)
-    message(FATAL_ERROR "unknown libpmem component: ${component}")
-  endif()
-  pkg_check_modules(PKG_${component} QUIET "lib${component}")
-  if(NOT pmem_VERSION_STRING OR PKG_${component}_VERSION VERSION_LESS pmem_VERSION_STRING)
-    set(pmem_VERSION_STRING ${PKG_${component}_VERSION})
-  endif()
-  find_path(pmem_${component}_INCLUDE_DIR
-    NAMES lib${component}.h
-    HINTS ${PKG_${component}_INCLUDE_DIRS})
-  find_library(pmem_${component}_LIBRARY
-    NAMES ${component}
-    HINTS ${PKG_${component}_LIBRARY_DIRS})
-  mark_as_advanced(
-    pmem_${component}_INCLUDE_DIR
-    pmem_${component}_LIBRARY)
-  list(APPEND pmem_INCLUDE_DIRS "pmem_${component}_INCLUDE_DIR")
-  list(APPEND pmem_LIBRARIES "pmem_${component}_LIBRARY")
-endforeach()
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(pmem
-  REQUIRED_VARS pmem_INCLUDE_DIRS pmem_LIBRARIES
-  VERSION_VAR pmem_VERSION_STRING)
-
-mark_as_advanced(
-  pmem_INCLUDE_DIRS
-  pmem_LIBRARIES)
-
-if(pmem_FOUND)
-  foreach(component pmem ${pmem_FIND_COMPONENTS})
-    if(NOT TARGET pmem::${component})
-      add_library(pmem::${component} UNKNOWN IMPORTED)
-      set_target_properties(pmem::${component} PROPERTIES
-        INTERFACE_INCLUDE_DIRECTORIES "${pmem_${component}_INCLUDE_DIR}"
-        IMPORTED_LINK_INTERFACE_LANGUAGES "C"
-        IMPORTED_LOCATION "${pmem_${component}_LIBRARY}")
-      # all pmem libraries calls into pmem::pmem
-      if(NOT component STREQUAL pmem)
-        set_target_properties(pmem::${component} PROPERTIES
-          INTERFACE_LINK_LIBRARIES pmem::pmem)
-      endif()
-    endif()
-  endforeach()
-endif()
index 2dbe5a6ecccda6afe7749641505437439e9294e2..7fa82a15ebb21aa980efcc298c7ac3df7880e93d 100644 (file)
@@ -484,17 +484,17 @@ endif()
 
 if(WITH_BLUESTORE_PMEM OR WITH_RBD_RWL)
   if(WITH_SYSTEM_PMDK)
-    set(pmem_COMPONENTS)
+    set(pmdk_COMPONENTS)
     if(WITH_BLUESTORE_PMEM)
-      list(APPEND pmem_COMPONENTS pmem)
+      list(APPEND pmdk_COMPONENTS pmem)
     endif()
     if(WITH_RBD_RWL)
-      list(APPEND pmem_COMPONENTS pmemobj)
+      list(APPEND pmdk_COMPONENTS pmemobj)
     endif()
-    find_package(pmem 1.8 REQUIRED COMPONENTS ${pmem_COMPONENTS})
+    find_package(pmdk 1.8 REQUIRED COMPONENTS ${pmdk_COMPONENTS})
   else()
-    include(Buildpmem)
-    build_pmem()
+    include(Buildpmdk)
+    build_pmdk()
   endif()
 endif()
 
index 40afb84dc141fec0098766741b38f8d4c3bf8a56..629dfe2c31913a3284e4629190c97a7327ec8ff4 100644 (file)
@@ -49,7 +49,7 @@ if(WITH_BLUESTORE_PMEM)
   endif()
 
   target_link_libraries(blk
-    PRIVATE pmem::pmem)
+    PRIVATE pmdk::pmem)
 endif()
 
 if(WITH_EVENTTRACE)
index ad23f0975fdd4388fdb7101670fbf9d8205e12a0..0c33fc3e224df5c3bc6dd23b8ac62722e76e24e6 100644 (file)
@@ -14,7 +14,7 @@ add_library(rbd_types STATIC
 
 if (WITH_RBD_RWL)
   target_link_libraries(rbd_types
-    PUBLIC pmem::pmemobj)
+    PUBLIC pmdk::pmemobj)
 endif()
 
 set(librbd_internal_srcs
@@ -306,8 +306,8 @@ if(WITH_RBD_RWL OR WITH_RBD_SSD_CACHE)
 
   if(WITH_RBD_RWL)
     target_link_libraries(librbd_plugin_pwl_cache
-      PUBLIC pmem::pmemobj
-      PRIVATE pmem::pmem)
+      PUBLIC pmdk::pmemobj
+      PRIVATE pmdk::pmem)
   endif()
 
   set_target_properties(librbd_plugin_pwl_cache PROPERTIES