From 1ea9d923089d538dffb067930c20e813fa57740b Mon Sep 17 00:00:00 2001 From: sekaiacg Date: Sun, 26 Jan 2025 19:37:41 +0800 Subject: [PATCH] cmake: Add xxHash support https://github.com/Cyan4973/xxHash Signed-off-by: sekaiacg --- .gitmodules | 4 ++++ build/cmake/erofs-tools/erofs_tools.cmake | 1 + build/cmake/lib/CMakeLists.txt | 6 ++++++ build/cmake/lib/liberofs.cmake | 3 ++- src/xxHash | 1 + 5 files changed, 14 insertions(+), 1 deletion(-) create mode 160000 src/xxHash diff --git a/.gitmodules b/.gitmodules index b07cacea..3a0262b8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -43,3 +43,7 @@ [submodule "src/winfsp"] path = src/winfsp url = https://github.com/winfsp/winfsp +[submodule "src/xxHash"] + path = src/xxHash + url = https://github.com/Cyan4973/xxHash.git + branch = dev diff --git a/build/cmake/erofs-tools/erofs_tools.cmake b/build/cmake/erofs-tools/erofs_tools.cmake index 7d935b3a..c338384b 100644 --- a/build/cmake/erofs-tools/erofs_tools.cmake +++ b/build/cmake/erofs-tools/erofs_tools.cmake @@ -31,6 +31,7 @@ set(common_static_link_lib z_static libzstd_static pcre2 + xxhash ${ld_end_group} ) diff --git a/build/cmake/lib/CMakeLists.txt b/build/cmake/lib/CMakeLists.txt index aae2031d..c12f1d98 100644 --- a/build/cmake/lib/CMakeLists.txt +++ b/build/cmake/lib/CMakeLists.txt @@ -18,6 +18,12 @@ elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin|CYGWIN") include(libext2_uuid.cmake) endif () +#XXHASH +set(BUILD_SHARED_LIBS OFF) +set(XXHASH_BUILD_ENABLE_INLINE_API ON) +set(XXHASH_BUILD_XXHSUM OFF) +add_subdirectory("${LIB_DIR}/xxHash/cmake_unofficial" "xxHash") + # LZ4 set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) set(LZ4_BUILD_CLI OFF) diff --git a/build/cmake/lib/liberofs.cmake b/build/cmake/lib/liberofs.cmake index b2372faa..1c7553fa 100644 --- a/build/cmake/lib/liberofs.cmake +++ b/build/cmake/lib/liberofs.cmake @@ -73,6 +73,8 @@ set(LIBEROFS_STATIC_DEFAULTS_CFLAGS "-DHAVE_LIBZSTD" "-DWITH_ANDROID" "-DEROFS_MT_ENABLED" + "-DHAVE_XXHASH_H" + "-DHAVE_XXHASH" "${DARWIN_CFLAGS}" CACHE INTERNAL "liberofs_static_defaults_cflags" ) @@ -101,7 +103,6 @@ set(liberofs_srcs "${TARGET_SRC_DIR}/uuid.c" "${TARGET_SRC_DIR}/tar.c" "${TARGET_SRC_DIR}/block_list.c" - "${TARGET_SRC_DIR}/xxhash.c" "${TARGET_SRC_DIR}/rebuild.c" "${TARGET_SRC_DIR}/diskbuf.c" "${TARGET_SRC_DIR}/uuid_unparse.c" diff --git a/src/xxHash b/src/xxHash new file mode 160000 index 00000000..e4e33f1f --- /dev/null +++ b/src/xxHash @@ -0,0 +1 @@ +Subproject commit e4e33f1f54f3a05de328a1fc5574a432ebf0c5a8