From fb87e01986d41f28789f2596c1539f6c7d4a5ff0 Mon Sep 17 00:00:00 2001 From: SChernykh <15806605+SChernykh@users.noreply.github.com> Date: Fri, 31 May 2024 10:33:44 +0200 Subject: [PATCH] Fixed keccak_bmi.cpp compilation without RandomX --- CMakeLists.txt | 10 ++++++++++ external/src/RandomX | 2 +- src/keccak.cpp | 4 +--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a68018a..8dd9c8c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -156,6 +156,9 @@ endif() if (WITH_RANDOMX) set(HEADERS ${HEADERS} src/miner.h) set(SOURCES ${SOURCES} src/miner.cpp) +else() + set(HEADERS ${HEADERS} external/src/RandomX/src/cpu.hpp) + set(SOURCES ${SOURCES} external/src/RandomX/src/cpu.cpp) endif() if (WITH_GRPC) @@ -267,6 +270,13 @@ endif() add_definitions(/DZMQ_STATIC) +include(CheckIncludeFile) + +check_include_file(asm/hwcap.h HAVE_HWCAP) +if(HAVE_HWCAP) + add_definitions(/DHAVE_HWCAP) +endif() + include(CheckCXXSourceCompiles) check_cxx_source_compiles("int main(){ return __builtin_clzll(1);}" HAVE_BUILTIN_CLZLL) diff --git a/external/src/RandomX b/external/src/RandomX index 7ee603a..1b1f6d2 160000 --- a/external/src/RandomX +++ b/external/src/RandomX @@ -1 +1 @@ -Subproject commit 7ee603afebc063fa9c28a5350daee40be831d468 +Subproject commit 1b1f6d222d9c499b1a1ee40efa788bbcbfcb5513 diff --git a/src/keccak.cpp b/src/keccak.cpp index 96046ce..f8a2338 100644 --- a/src/keccak.cpp +++ b/src/keccak.cpp @@ -17,9 +17,7 @@ #include "common.h" #include "keccak.h" -#ifdef WITH_RANDOMX #include "RandomX/src/cpu.hpp" -#endif namespace p2pool { @@ -120,7 +118,7 @@ NOINLINE void keccakf_plain(std::array& st) void (*keccakf)(std::array&) = keccakf_plain; -#if defined(WITH_RANDOMX) && (defined(__x86_64__) || defined(_M_AMD64)) +#if defined(__x86_64__) || defined(_M_AMD64) static struct KeccakBMI_Check { KeccakBMI_Check() { if (randomx::Cpu().hasBmi()) {