Added xxhash dependency
This commit is contained in:
@@ -23,7 +23,8 @@ ARG LMS_BUILD_PACKAGES=" \
|
||||
taglib-dev \
|
||||
stb \
|
||||
wt-dev \
|
||||
gtest-dev"
|
||||
gtest-dev \
|
||||
xxhash-dev"
|
||||
|
||||
COPY --from=xx / /
|
||||
|
||||
|
||||
@@ -13,7 +13,8 @@ ARG BUILD_PACKAGES="\
|
||||
make \
|
||||
pkgconfig \
|
||||
taglib \
|
||||
wt"
|
||||
wt \
|
||||
xxhash"
|
||||
|
||||
RUN pacman -Syu --noconfirm
|
||||
RUN pacman -S --noconfirm ${BUILD_PACKAGES}
|
||||
|
||||
+2
-1
@@ -32,7 +32,8 @@ ARG BUILD_PACKAGES=" \
|
||||
libconfig-dev \
|
||||
utfcpp \
|
||||
sqlite-dev \
|
||||
gtest-dev"
|
||||
gtest-dev \
|
||||
xxhash-dev"
|
||||
|
||||
RUN apk add --no-cache --update ${BUILD_PACKAGES}
|
||||
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ __Notes__:
|
||||
* a C++20 compiler is needed
|
||||
* ffmpeg version 4 minimum is required
|
||||
```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__:
|
||||
* libpam0g-dev is optional (only for using PAM authentication)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
pkg_check_modules(Config++ REQUIRED IMPORTED_TARGET libconfig++)
|
||||
pkg_check_modules(Archive REQUIRED IMPORTED_TARGET libarchive)
|
||||
pkg_check_modules(XXHASH REQUIRED IMPORTED_TARGET libxxhash)
|
||||
|
||||
add_library(lmscore STATIC
|
||||
impl/http/Client.cpp
|
||||
@@ -21,6 +22,7 @@ add_library(lmscore STATIC
|
||||
impl/TraceLogger.cpp
|
||||
impl/UUID.cpp
|
||||
impl/WtLogger.cpp
|
||||
impl/XxHash3.cpp
|
||||
)
|
||||
|
||||
target_include_directories(lmscore INTERFACE
|
||||
@@ -34,6 +36,7 @@ target_include_directories(lmscore PRIVATE
|
||||
target_link_libraries(lmscore PRIVATE
|
||||
PkgConfig::Config++
|
||||
PkgConfig::Archive
|
||||
PkgConfig::XXHASH
|
||||
)
|
||||
|
||||
target_link_libraries(lmscore PUBLIC
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -11,6 +11,7 @@ add_executable(test-core
|
||||
TraceLogger.cpp
|
||||
Utils.cpp
|
||||
UUID.cpp
|
||||
XxHash3.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(test-core PRIVATE
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user