Added xxhash dependency

This commit is contained in:
emeric
2025-03-09 15:11:41 +01:00
parent 38fde8bae0
commit 744abefc8b
9 changed files with 108 additions and 4 deletions
+2 -1
View File
@@ -23,7 +23,8 @@ ARG LMS_BUILD_PACKAGES=" \
taglib-dev \ taglib-dev \
stb \ stb \
wt-dev \ wt-dev \
gtest-dev" gtest-dev \
xxhash-dev"
COPY --from=xx / / COPY --from=xx / /
+2 -1
View File
@@ -13,7 +13,8 @@ ARG BUILD_PACKAGES="\
make \ make \
pkgconfig \ pkgconfig \
taglib \ taglib \
wt" wt \
xxhash"
RUN pacman -Syu --noconfirm RUN pacman -Syu --noconfirm
RUN pacman -S --noconfirm ${BUILD_PACKAGES} RUN pacman -S --noconfirm ${BUILD_PACKAGES}
+2 -1
View File
@@ -32,7 +32,8 @@ ARG BUILD_PACKAGES=" \
libconfig-dev \ libconfig-dev \
utfcpp \ utfcpp \
sqlite-dev \ sqlite-dev \
gtest-dev" gtest-dev \
xxhash-dev"
RUN apk add --no-cache --update ${BUILD_PACKAGES} RUN apk add --no-cache --update ${BUILD_PACKAGES}
+1 -1
View File
@@ -37,7 +37,7 @@ __Notes__:
* a C++20 compiler is needed * a C++20 compiler is needed
* ffmpeg version 4 minimum is required * ffmpeg version 4 minimum is required
```sh ```sh
apt-get install g++ cmake libboost-program-options-dev libboost-system-dev libavutil-dev libavformat-dev libstb-dev libconfig++-dev ffmpeg libtag1-dev libpam0g-dev libgtest-dev libarchive-dev apt-get install g++ cmake libboost-program-options-dev libboost-system-dev libavutil-dev libavformat-dev libstb-dev libconfig++-dev ffmpeg libtag1-dev libpam0g-dev libgtest-dev libarchive-dev libxxhash-dev
``` ```
__Notes__: __Notes__:
* libpam0g-dev is optional (only for using PAM authentication) * libpam0g-dev is optional (only for using PAM authentication)
+3
View File
@@ -1,5 +1,6 @@
pkg_check_modules(Config++ REQUIRED IMPORTED_TARGET libconfig++) pkg_check_modules(Config++ REQUIRED IMPORTED_TARGET libconfig++)
pkg_check_modules(Archive REQUIRED IMPORTED_TARGET libarchive) pkg_check_modules(Archive REQUIRED IMPORTED_TARGET libarchive)
pkg_check_modules(XXHASH REQUIRED IMPORTED_TARGET libxxhash)
add_library(lmscore STATIC add_library(lmscore STATIC
impl/http/Client.cpp impl/http/Client.cpp
@@ -21,6 +22,7 @@ add_library(lmscore STATIC
impl/TraceLogger.cpp impl/TraceLogger.cpp
impl/UUID.cpp impl/UUID.cpp
impl/WtLogger.cpp impl/WtLogger.cpp
impl/XxHash3.cpp
) )
target_include_directories(lmscore INTERFACE target_include_directories(lmscore INTERFACE
@@ -34,6 +36,7 @@ target_include_directories(lmscore PRIVATE
target_link_libraries(lmscore PRIVATE target_link_libraries(lmscore PRIVATE
PkgConfig::Config++ PkgConfig::Config++
PkgConfig::Archive PkgConfig::Archive
PkgConfig::XXHASH
) )
target_link_libraries(lmscore PUBLIC target_link_libraries(lmscore PUBLIC
+31
View File
@@ -0,0 +1,31 @@
/*
* Copyright (C) 2025 Emeric Poupon
*
* This file is part of LMS.
*
* LMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
*/
#include "core/XxHash3.hpp"
#define XXH_INLINE_ALL
#include <xxhash.h>
namespace lms::core
{
std::uint64_t xxHash3_64(std::span<const std::byte> buf)
{
return XXH3_64bits(buf.data(), buf.size());
}
} // namespace lms::core
+29
View File
@@ -0,0 +1,29 @@
/*
* Copyright (C) 2025 Emeric Poupon
*
* This file is part of LMS.
*
* LMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <cstddef>
#include <cstdint>
#include <span>
namespace lms::core
{
std::uint64_t xxHash3_64(std::span<const std::byte> buf);
} // namespace lms::core
+1
View File
@@ -11,6 +11,7 @@ add_executable(test-core
TraceLogger.cpp TraceLogger.cpp
Utils.cpp Utils.cpp
UUID.cpp UUID.cpp
XxHash3.cpp
) )
target_link_libraries(test-core PRIVATE target_link_libraries(test-core PRIVATE
+37
View File
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2025 Emeric Poupon
*
* This file is part of LMS.
*
* LMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
*/
#include <gtest/gtest.h>
#include "core/XxHash3.hpp"
namespace lms::core
{
TEST(Xxhash3_64, basic)
{
std::vector<std::byte> buffer;
buffer.resize(1024);
for (std::size_t i{}; i < buffer.size(); ++i)
buffer[i] = static_cast<std::byte>(i);
const std::uint64_t hash{ xxHash3_64(buffer) };
EXPECT_EQ(hash, 12137474952470826274ULL);
}
} // namespace lms::core