summaryrefslogtreecommitdiffstats
path: root/src/compressor/zstd/CMakeLists.txt
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/compressor/zstd/CMakeLists.txt
parentInitial commit. (diff)
downloadceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz
ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/compressor/zstd/CMakeLists.txt')
-rw-r--r--src/compressor/zstd/CMakeLists.txt41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/compressor/zstd/CMakeLists.txt b/src/compressor/zstd/CMakeLists.txt
new file mode 100644
index 00000000..76709bbb
--- /dev/null
+++ b/src/compressor/zstd/CMakeLists.txt
@@ -0,0 +1,41 @@
+# zstd
+
+# libzstd - build it statically
+set(ZSTD_C_FLAGS "-fPIC -Wno-unused-variable -O3")
+
+include(ExternalProject)
+ExternalProject_Add(zstd_ext
+ SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/zstd/build/cmake
+ CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
+ -DCMAKE_C_FLAGS=${ZSTD_C_FLAGS}
+ -DCMAKE_AR=${CMAKE_AR}
+ -DCMAKE_POSITION_INDEPENDENT_CODE=${ENABLE_SHARED}
+ BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/libzstd
+ BUILD_COMMAND $(MAKE) libzstd_static
+ INSTALL_COMMAND "true")
+
+# force zstd make to be called on each time
+ExternalProject_Add_Step(zstd_ext forcebuild
+ DEPENDEES configure
+ DEPENDERS build
+ COMMAND "true"
+ ALWAYS 1)
+
+add_library(zstd STATIC IMPORTED)
+set_target_properties(zstd PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/src/zstd/lib"
+ IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/libzstd/lib/libzstd.a")
+add_dependencies(zstd zstd_ext)
+
+set(zstd_sources
+ CompressionPluginZstd.cc
+)
+
+add_library(ceph_zstd SHARED ${zstd_sources})
+target_link_libraries(ceph_zstd PRIVATE zstd)
+set_target_properties(ceph_zstd PROPERTIES
+ VERSION 2.0.0
+ SOVERSION 2
+ INSTALL_RPATH "")
+install(TARGETS ceph_zstd DESTINATION ${compressor_plugin_dir})