This is an automated email from the ASF dual-hosted git repository.

twice pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git


The following commit(s) were added to refs/heads/unstable by this push:
     new 5ab57c3d Introduce dependency xxhash for bloomfilter (#1694)
5ab57c3d is described below

commit 5ab57c3d29c105c4d193ad740f8c880ccdb0d146
Author: Twice <[email protected]>
AuthorDate: Thu Aug 24 10:12:20 2023 +0800

    Introduce dependency xxhash for bloomfilter (#1694)
---
 CMakeLists.txt     |  2 ++
 cmake/utils.cmake  |  1 +
 cmake/xxhash.cmake | 35 +++++++++++++++++++++++++++++++++++
 3 files changed, 38 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 07d3c14b..0a2adc40 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -131,6 +131,7 @@ include(cmake/rocksdb.cmake)
 include(cmake/libevent.cmake)
 include(cmake/fmt.cmake)
 include(cmake/jsoncons.cmake)
+include(cmake/xxhash.cmake)
 
 if (ENABLE_LUAJIT)
 include(cmake/luajit.cmake)
@@ -160,6 +161,7 @@ list(APPEND EXTERNAL_LIBS tbb)
 list(APPEND EXTERNAL_LIBS jsoncons)
 list(APPEND EXTERNAL_LIBS Threads::Threads)
 list(APPEND EXTERNAL_LIBS ${Backtrace_LIBRARY})
+list(APPEND EXTERNAL_LIBS xxhash)
 
 # Add git sha to version.h
 find_package(Git REQUIRED)
diff --git a/cmake/utils.cmake b/cmake/utils.cmake
index 40773e01..c1a8594b 100644
--- a/cmake/utils.cmake
+++ b/cmake/utils.cmake
@@ -27,6 +27,7 @@ endmacro()
 
 function(FetchContent_MakeAvailableWithArgs dep)
   if(NOT ${dep}_POPULATED)
+    message("Fetching ${dep}...")
     FetchContent_Populate(${dep})
 
     foreach(arg IN LISTS ARGN)
diff --git a/cmake/xxhash.cmake b/cmake/xxhash.cmake
new file mode 100644
index 00000000..edcdfe18
--- /dev/null
+++ b/cmake/xxhash.cmake
@@ -0,0 +1,35 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+include_guard()
+
+include(cmake/utils.cmake)
+
+FetchContent_DeclareGitHubWithMirror(xxhash
+  Cyan4973/xxHash v0.8.2
+  MD5=4b793d916f9b8e4ceb984a00e356bdb2
+)
+
+FetchContent_GetProperties(xxhash)
+if(NOT xxhash_POPULATED)
+  FetchContent_Populate(xxhash)
+
+  set(BUILD_SHARED_LIBS OFF)
+  set(XXHASH_BUILD_XXHSUM OFF)
+
+  add_subdirectory(${xxhash_SOURCE_DIR}/cmake_unofficial ${xxhash_BUILD_DIR} 
EXCLUDE_FROM_ALL)
+endif()

Reply via email to