summaryrefslogtreecommitdiffstats
path: root/src/rocksdb/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'src/rocksdb/cmake')
-rw-r--r--src/rocksdb/cmake/RocksDBConfig.cmake.in54
-rw-r--r--src/rocksdb/cmake/modules/CxxFlags.cmake7
-rw-r--r--src/rocksdb/cmake/modules/FindJeMalloc.cmake29
-rw-r--r--src/rocksdb/cmake/modules/FindNUMA.cmake29
-rw-r--r--src/rocksdb/cmake/modules/FindSnappy.cmake29
-rw-r--r--src/rocksdb/cmake/modules/FindTBB.cmake33
-rw-r--r--src/rocksdb/cmake/modules/Findgflags.cmake29
-rw-r--r--src/rocksdb/cmake/modules/Findlz4.cmake29
-rw-r--r--src/rocksdb/cmake/modules/Finduring.cmake26
-rw-r--r--src/rocksdb/cmake/modules/Findzstd.cmake29
-rw-r--r--src/rocksdb/cmake/modules/ReadVersion.cmake10
11 files changed, 304 insertions, 0 deletions
diff --git a/src/rocksdb/cmake/RocksDBConfig.cmake.in b/src/rocksdb/cmake/RocksDBConfig.cmake.in
new file mode 100644
index 000000000..0bd14be11
--- /dev/null
+++ b/src/rocksdb/cmake/RocksDBConfig.cmake.in
@@ -0,0 +1,54 @@
+@PACKAGE_INIT@
+
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/modules")
+
+include(CMakeFindDependencyMacro)
+
+set(GFLAGS_USE_TARGET_NAMESPACE @GFLAGS_USE_TARGET_NAMESPACE@)
+
+if(@WITH_JEMALLOC@)
+ find_dependency(JeMalloc)
+endif()
+
+if(@WITH_GFLAGS@)
+ find_dependency(gflags CONFIG)
+ if(NOT gflags_FOUND)
+ find_dependency(gflags)
+ endif()
+endif()
+
+if(@WITH_SNAPPY@)
+ find_dependency(Snappy CONFIG)
+ if(NOT Snappy_FOUND)
+ find_dependency(Snappy)
+ endif()
+endif()
+
+if(@WITH_ZLIB@)
+ find_dependency(ZLIB)
+endif()
+
+if(@WITH_BZ2@)
+ find_dependency(BZip2)
+endif()
+
+if(@WITH_LZ4@)
+ find_dependency(lz4)
+endif()
+
+if(@WITH_ZSTD@)
+ find_dependency(zstd)
+endif()
+
+if(@WITH_NUMA@)
+ find_dependency(NUMA)
+endif()
+
+if(@WITH_TBB@)
+ find_dependency(TBB)
+endif()
+
+find_dependency(Threads)
+
+include("${CMAKE_CURRENT_LIST_DIR}/RocksDBTargets.cmake")
+check_required_components(RocksDB)
diff --git a/src/rocksdb/cmake/modules/CxxFlags.cmake b/src/rocksdb/cmake/modules/CxxFlags.cmake
new file mode 100644
index 000000000..7980cca70
--- /dev/null
+++ b/src/rocksdb/cmake/modules/CxxFlags.cmake
@@ -0,0 +1,7 @@
+macro(get_cxx_std_flags FLAGS_VARIABLE)
+ if( CMAKE_CXX_STANDARD_REQUIRED )
+ set(${FLAGS_VARIABLE} ${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION})
+ else()
+ set(${FLAGS_VARIABLE} ${CMAKE_CXX${CMAKE_CXX_STANDARD}_EXTENSION_COMPILE_OPTION})
+ endif()
+endmacro()
diff --git a/src/rocksdb/cmake/modules/FindJeMalloc.cmake b/src/rocksdb/cmake/modules/FindJeMalloc.cmake
new file mode 100644
index 000000000..f695b3ed1
--- /dev/null
+++ b/src/rocksdb/cmake/modules/FindJeMalloc.cmake
@@ -0,0 +1,29 @@
+# - Find JeMalloc library
+# Find the native JeMalloc includes and library
+#
+# JeMalloc_INCLUDE_DIRS - where to find jemalloc.h, etc.
+# JeMalloc_LIBRARIES - List of libraries when using jemalloc.
+# JeMalloc_FOUND - True if jemalloc found.
+
+find_path(JeMalloc_INCLUDE_DIRS
+ NAMES jemalloc/jemalloc.h
+ HINTS ${JEMALLOC_ROOT_DIR}/include)
+
+find_library(JeMalloc_LIBRARIES
+ NAMES jemalloc
+ HINTS ${JEMALLOC_ROOT_DIR}/lib)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(JeMalloc DEFAULT_MSG JeMalloc_LIBRARIES JeMalloc_INCLUDE_DIRS)
+
+mark_as_advanced(
+ JeMalloc_LIBRARIES
+ JeMalloc_INCLUDE_DIRS)
+
+if(JeMalloc_FOUND AND NOT (TARGET JeMalloc::JeMalloc))
+ add_library (JeMalloc::JeMalloc UNKNOWN IMPORTED)
+ set_target_properties(JeMalloc::JeMalloc
+ PROPERTIES
+ IMPORTED_LOCATION ${JeMalloc_LIBRARIES}
+ INTERFACE_INCLUDE_DIRECTORIES ${JeMalloc_INCLUDE_DIRS})
+endif()
diff --git a/src/rocksdb/cmake/modules/FindNUMA.cmake b/src/rocksdb/cmake/modules/FindNUMA.cmake
new file mode 100644
index 000000000..69b95c9b6
--- /dev/null
+++ b/src/rocksdb/cmake/modules/FindNUMA.cmake
@@ -0,0 +1,29 @@
+# - Find NUMA
+# Find the NUMA library and includes
+#
+# NUMA_INCLUDE_DIRS - where to find numa.h, etc.
+# NUMA_LIBRARIES - List of libraries when using NUMA.
+# NUMA_FOUND - True if NUMA found.
+
+find_path(NUMA_INCLUDE_DIRS
+ NAMES numa.h numaif.h
+ HINTS ${NUMA_ROOT_DIR}/include)
+
+find_library(NUMA_LIBRARIES
+ NAMES numa
+ HINTS ${NUMA_ROOT_DIR}/lib)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(NUMA DEFAULT_MSG NUMA_LIBRARIES NUMA_INCLUDE_DIRS)
+
+mark_as_advanced(
+ NUMA_LIBRARIES
+ NUMA_INCLUDE_DIRS)
+
+if(NUMA_FOUND AND NOT (TARGET NUMA::NUMA))
+ add_library (NUMA::NUMA UNKNOWN IMPORTED)
+ set_target_properties(NUMA::NUMA
+ PROPERTIES
+ IMPORTED_LOCATION ${NUMA_LIBRARIES}
+ INTERFACE_INCLUDE_DIRECTORIES ${NUMA_INCLUDE_DIRS})
+endif()
diff --git a/src/rocksdb/cmake/modules/FindSnappy.cmake b/src/rocksdb/cmake/modules/FindSnappy.cmake
new file mode 100644
index 000000000..0b0dbf861
--- /dev/null
+++ b/src/rocksdb/cmake/modules/FindSnappy.cmake
@@ -0,0 +1,29 @@
+# - Find Snappy
+# Find the snappy compression library and includes
+#
+# Snappy_INCLUDE_DIRS - where to find snappy.h, etc.
+# Snappy_LIBRARIES - List of libraries when using snappy.
+# Snappy_FOUND - True if snappy found.
+
+find_path(Snappy_INCLUDE_DIRS
+ NAMES snappy.h
+ HINTS ${snappy_ROOT_DIR}/include)
+
+find_library(Snappy_LIBRARIES
+ NAMES snappy
+ HINTS ${snappy_ROOT_DIR}/lib)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Snappy DEFAULT_MSG Snappy_LIBRARIES Snappy_INCLUDE_DIRS)
+
+mark_as_advanced(
+ Snappy_LIBRARIES
+ Snappy_INCLUDE_DIRS)
+
+if(Snappy_FOUND AND NOT (TARGET Snappy::snappy))
+ add_library (Snappy::snappy UNKNOWN IMPORTED)
+ set_target_properties(Snappy::snappy
+ PROPERTIES
+ IMPORTED_LOCATION ${Snappy_LIBRARIES}
+ INTERFACE_INCLUDE_DIRECTORIES ${Snappy_INCLUDE_DIRS})
+endif()
diff --git a/src/rocksdb/cmake/modules/FindTBB.cmake b/src/rocksdb/cmake/modules/FindTBB.cmake
new file mode 100644
index 000000000..f6861fa55
--- /dev/null
+++ b/src/rocksdb/cmake/modules/FindTBB.cmake
@@ -0,0 +1,33 @@
+# - Find TBB
+# Find the Thread Building Blocks library and includes
+#
+# TBB_INCLUDE_DIRS - where to find tbb.h, etc.
+# TBB_LIBRARIES - List of libraries when using TBB.
+# TBB_FOUND - True if TBB found.
+
+if(NOT DEFINED TBB_ROOT_DIR)
+ set(TBB_ROOT_DIR "$ENV{TBBROOT}")
+endif()
+
+find_path(TBB_INCLUDE_DIRS
+ NAMES tbb/tbb.h
+ HINTS ${TBB_ROOT_DIR}/include)
+
+find_library(TBB_LIBRARIES
+ NAMES tbb
+ HINTS ${TBB_ROOT_DIR}/lib ENV LIBRARY_PATH)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(TBB DEFAULT_MSG TBB_LIBRARIES TBB_INCLUDE_DIRS)
+
+mark_as_advanced(
+ TBB_LIBRARIES
+ TBB_INCLUDE_DIRS)
+
+if(TBB_FOUND AND NOT (TARGET TBB::TBB))
+ add_library (TBB::TBB UNKNOWN IMPORTED)
+ set_target_properties(TBB::TBB
+ PROPERTIES
+ IMPORTED_LOCATION ${TBB_LIBRARIES}
+ INTERFACE_INCLUDE_DIRECTORIES ${TBB_INCLUDE_DIRS})
+endif()
diff --git a/src/rocksdb/cmake/modules/Findgflags.cmake b/src/rocksdb/cmake/modules/Findgflags.cmake
new file mode 100644
index 000000000..786def27b
--- /dev/null
+++ b/src/rocksdb/cmake/modules/Findgflags.cmake
@@ -0,0 +1,29 @@
+# - Find gflags library
+# Find the gflags includes and library
+#
+# GFLAGS_INCLUDE_DIR - where to find gflags.h.
+# GFLAGS_LIBRARIES - List of libraries when using gflags.
+# gflags_FOUND - True if gflags found.
+
+find_path(GFLAGS_INCLUDE_DIR
+ NAMES gflags/gflags.h)
+
+find_library(GFLAGS_LIBRARIES
+ NAMES gflags)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(gflags
+ DEFAULT_MSG GFLAGS_LIBRARIES GFLAGS_INCLUDE_DIR)
+
+mark_as_advanced(
+ GFLAGS_LIBRARIES
+ GFLAGS_INCLUDE_DIR)
+
+if(gflags_FOUND AND NOT (TARGET gflags::gflags))
+ add_library(gflags::gflags UNKNOWN IMPORTED)
+ set_target_properties(gflags::gflags
+ PROPERTIES
+ IMPORTED_LOCATION ${GFLAGS_LIBRARIES}
+ INTERFACE_INCLUDE_DIRECTORIES ${GFLAGS_INCLUDE_DIR}
+ IMPORTED_LINK_INTERFACE_LANGUAGES "CXX")
+endif()
diff --git a/src/rocksdb/cmake/modules/Findlz4.cmake b/src/rocksdb/cmake/modules/Findlz4.cmake
new file mode 100644
index 000000000..7cf7d7f5f
--- /dev/null
+++ b/src/rocksdb/cmake/modules/Findlz4.cmake
@@ -0,0 +1,29 @@
+# - Find Lz4
+# Find the lz4 compression library and includes
+#
+# lz4_INCLUDE_DIRS - where to find lz4.h, etc.
+# lz4_LIBRARIES - List of libraries when using lz4.
+# lz4_FOUND - True if lz4 found.
+
+find_path(lz4_INCLUDE_DIRS
+ NAMES lz4.h
+ HINTS ${lz4_ROOT_DIR}/include)
+
+find_library(lz4_LIBRARIES
+ NAMES lz4
+ HINTS ${lz4_ROOT_DIR}/lib)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(lz4 DEFAULT_MSG lz4_LIBRARIES lz4_INCLUDE_DIRS)
+
+mark_as_advanced(
+ lz4_LIBRARIES
+ lz4_INCLUDE_DIRS)
+
+if(lz4_FOUND AND NOT (TARGET lz4::lz4))
+ add_library(lz4::lz4 UNKNOWN IMPORTED)
+ set_target_properties(lz4::lz4
+ PROPERTIES
+ IMPORTED_LOCATION ${lz4_LIBRARIES}
+ INTERFACE_INCLUDE_DIRECTORIES ${lz4_INCLUDE_DIRS})
+endif()
diff --git a/src/rocksdb/cmake/modules/Finduring.cmake b/src/rocksdb/cmake/modules/Finduring.cmake
new file mode 100644
index 000000000..8cb14cb27
--- /dev/null
+++ b/src/rocksdb/cmake/modules/Finduring.cmake
@@ -0,0 +1,26 @@
+# - Find liburing
+#
+# uring_INCLUDE_DIR - Where to find liburing.h
+# uring_LIBRARIES - List of libraries when using uring.
+# uring_FOUND - True if uring found.
+
+find_path(uring_INCLUDE_DIR
+ NAMES liburing.h)
+find_library(uring_LIBRARIES
+ NAMES liburing.a liburing)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(uring
+ DEFAULT_MSG uring_LIBRARIES uring_INCLUDE_DIR)
+
+mark_as_advanced(
+ uring_INCLUDE_DIR
+ uring_LIBRARIES)
+
+if(uring_FOUND AND NOT TARGET uring::uring)
+ add_library(uring::uring UNKNOWN IMPORTED)
+ set_target_properties(uring::uring PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${uring_INCLUDE_DIR}"
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ IMPORTED_LOCATION "${uring_LIBRARIES}")
+endif()
diff --git a/src/rocksdb/cmake/modules/Findzstd.cmake b/src/rocksdb/cmake/modules/Findzstd.cmake
new file mode 100644
index 000000000..9430821df
--- /dev/null
+++ b/src/rocksdb/cmake/modules/Findzstd.cmake
@@ -0,0 +1,29 @@
+# - Find zstd
+# Find the zstd compression library and includes
+#
+# zstd_INCLUDE_DIRS - where to find zstd.h, etc.
+# zstd_LIBRARIES - List of libraries when using zstd.
+# zstd_FOUND - True if zstd found.
+
+find_path(zstd_INCLUDE_DIRS
+ NAMES zstd.h
+ HINTS ${zstd_ROOT_DIR}/include)
+
+find_library(zstd_LIBRARIES
+ NAMES zstd
+ HINTS ${zstd_ROOT_DIR}/lib)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(zstd DEFAULT_MSG zstd_LIBRARIES zstd_INCLUDE_DIRS)
+
+mark_as_advanced(
+ zstd_LIBRARIES
+ zstd_INCLUDE_DIRS)
+
+if(zstd_FOUND AND NOT (TARGET zstd::zstd))
+ add_library (zstd::zstd UNKNOWN IMPORTED)
+ set_target_properties(zstd::zstd
+ PROPERTIES
+ IMPORTED_LOCATION ${zstd_LIBRARIES}
+ INTERFACE_INCLUDE_DIRECTORIES ${zstd_INCLUDE_DIRS})
+endif()
diff --git a/src/rocksdb/cmake/modules/ReadVersion.cmake b/src/rocksdb/cmake/modules/ReadVersion.cmake
new file mode 100644
index 000000000..ebfd7d6f9
--- /dev/null
+++ b/src/rocksdb/cmake/modules/ReadVersion.cmake
@@ -0,0 +1,10 @@
+# Read rocksdb version from version.h header file.
+
+function(get_rocksdb_version version_var)
+ file(READ "${CMAKE_CURRENT_SOURCE_DIR}/include/rocksdb/version.h" version_header_file)
+ foreach(component MAJOR MINOR PATCH)
+ string(REGEX MATCH "#define ROCKSDB_${component} ([0-9]+)" _ ${version_header_file})
+ set(ROCKSDB_VERSION_${component} ${CMAKE_MATCH_1})
+ endforeach()
+ set(${version_var} "${ROCKSDB_VERSION_MAJOR}.${ROCKSDB_VERSION_MINOR}.${ROCKSDB_VERSION_PATCH}" PARENT_SCOPE)
+endfunction()