endif(${WITH_FUSE})
option(WITH_XFS "XFS is here" ON)
-if(${WITH_XFS})
-find_package(xfs)
-set(HAVE_LIBXFS ${XFS_FOUND})
-endif(${WITH_XFS})
+if(WITH_XFS)
+ find_package(xfs)
+ set(HAVE_LIBXFS ${XFS_FOUND})
+endif()
+
+option(WITH_ZFS "enable LibZFS if found" OFF)
+if(WITH_ZFS)
+ find_package(zfs)
+ set(HAVE_LIBZFS ${ZFS_FOUND})
+endif()
option(WITH_SPDK "Enable SPDK" OFF)
if(WITH_SPDK)
endif(${HAVE_BABELTRACE})
option(DEBUG_GATHER "C_Gather debugging is enabled" ON)
-option(HAVE_LIBZFS "LibZFS is enabled" OFF)
option(ENABLE_COVERAGE "Coverage is enabled" OFF)
option(PG_DEBUG_REFS "PG Ref debugging is enabled" OFF)
# Try to find xfs
# Once done, this will define
#
-# XFS_FOUND - system has Profiler
-# XFS_INCLUDE_DIR - the Profiler include directories
-# XFS_LIBRARIES - link these to use Profiler
+# XFS_FOUND - system has libxfs
+# XFS_INCLUDE_DIR - the libxfs include directories
+# XFS_LIBRARIES - link these to use libxfs
if(XFS_INCLUDE_DIR AND XFS_LIBRARIES)
set(XFS_FIND_QUIETLY TRUE)
--- /dev/null
+# find libzfs or libzfslinux
+# Once done, this will define
+#
+# ZFS_FOUND - system has libzfs
+# ZFS_INCLUDE_DIR - the libzfs include directories
+# ZFS_LIBRARIES - link these to use libzfs
+
+find_package(PkgConfig)
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(ZFS QUIET libzfs)
+else()
+ find_path(ZFS_INCLUDE_DIR libzfs.h
+ HINTS
+ ENV ZFS_DIR
+ PATH_SUFFIXES libzfs)
+
+ find_library(ZFS_LIBRARIES
+ NAMES zfs
+ HINTS
+ ENV ZFS_DIR)
+ set(XFS_LIBRARIES ${LIBXFS})
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(zfs DEFAULT_MSG
+ ZFS_INCLUDE_DIRS ZFS_LIBRARIES)
+
+mark_as_advanced(ZFS_INCLUDE_DIRS XFS_LIBRARIES)
-if(HAVE_LIBXFS)
- set(libos_xfs_srcs
- filestore/XfsFileStoreBackend.cc
- fs/XFS.cc)
-endif(HAVE_LIBXFS)
-
set(libos_srcs
ObjectStore.cc
Transaction.cc
filestore/IndexManager.cc
filestore/LFNIndex.cc
filestore/WBThrottle.cc
- filestore/ZFSFileStoreBackend.cc
memstore/MemStore.cc
kstore/KStore.cc
kstore/kstore_types.cc
fs/FS.cc
- fs/aio.cc
- ${libos_xfs_srcs})
+ fs/aio.cc)
if(HAVE_LIBAIO)
list(APPEND libos_srcs
bluestore/PMEMDevice.cc)
endif(WITH_PMEM)
+if(HAVE_LIBXFS)
+ list(APPEND libos_srcs
+ filestore/XfsFileStoreBackend.cc
+ fs/XFS.cc)
+endif()
+
+if(HAVE_LIBZFS)
+ add_library(os_zfs_objs OBJECT
+ filestore/ZFSFileStoreBackend.cc
+ fs/ZFS.cc)
+ target_include_directories(os_zfs_objs PRIVATE
+ ${ZFS_INCLUDE_DIRS})
+ list(APPEND libos_srcs $<TARGET_OBJECTS:os_zfs_objs>)
+endif()
+
if(WITH_SPDK)
list(APPEND libos_srcs
bluestore/NVMEDevice.cc)
target_link_libraries(os ${PMEM_LIBRARY})
endif()
+if(HAVE_LIBZFS)
+ target_link_libraries(os ${ZFS_LIBRARIES})
+endif()
+
if(WITH_SPDK)
target_link_libraries(os
${SPDK_LIBRARIES}