mirror of
https://github.com/xmrig/xmrig.git
synced 2025-12-07 07:55:04 -05:00
Compare commits
5 Commits
0599f90aba
...
4ba4f07763
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ba4f07763 | ||
|
|
64f5bb467a | ||
|
|
5717e72367 | ||
|
|
f0f6d1666c | ||
|
|
0399b6b6bb |
@@ -32,6 +32,7 @@ option(WITH_VAES "Enable VAES instructions for Cryptonight" ON)
|
||||
option(WITH_BENCHMARK "Enable builtin RandomX benchmark and stress test" ON)
|
||||
option(WITH_SECURE_JIT "Enable secure access to JIT memory" OFF)
|
||||
option(WITH_DMI "Enable DMI/SMBIOS reader" ON)
|
||||
option(WITH_BUNDLED_FMT "Force use of bundled fmt library" ON)
|
||||
|
||||
option(BUILD_STATIC "Build static binary" OFF)
|
||||
option(ARM_V8 "Force ARMv8 (64 bit) architecture, use with caution if automatic detection fails, but you sure it may work" OFF)
|
||||
@@ -198,6 +199,7 @@ add_definitions(-D__STDC_FORMAT_MACROS -DUNICODE -D_FILE_OFFSET_BITS=64)
|
||||
find_package(UV REQUIRED)
|
||||
|
||||
include(cmake/flags.cmake)
|
||||
include(cmake/fmt.cmake)
|
||||
include(cmake/randomx.cmake)
|
||||
include(cmake/argon2.cmake)
|
||||
include(cmake/kawpow.cmake)
|
||||
@@ -229,7 +231,7 @@ include(src/hw/api/api.cmake)
|
||||
include(src/hw/dmi/dmi.cmake)
|
||||
|
||||
include_directories(src)
|
||||
include_directories(src/3rdparty)
|
||||
include_directories(src/3rdparty/CL)
|
||||
include_directories(${UV_INCLUDE_DIR})
|
||||
|
||||
if (WITH_DEBUG_LOG)
|
||||
@@ -237,7 +239,7 @@ if (WITH_DEBUG_LOG)
|
||||
endif()
|
||||
|
||||
add_executable(${CMAKE_PROJECT_NAME} ${HEADERS} ${SOURCES} ${SOURCES_OS} ${HEADERS_CRYPTO} ${SOURCES_CRYPTO} ${SOURCES_SYSLOG} ${TLS_SOURCES} ${XMRIG_ASM_SOURCES})
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME} ${XMRIG_ASM_LIBRARY} ${OPENSSL_LIBRARIES} ${UV_LIBRARIES} ${EXTRA_LIBS} ${CPUID_LIB} ${ARGON2_LIBRARY} ${ETHASH_LIBRARY} ${GHOSTRIDER_LIBRARY})
|
||||
target_link_libraries(${CMAKE_PROJECT_NAME} ${XMRIG_ASM_LIBRARY} ${OPENSSL_LIBRARIES} ${UV_LIBRARIES} ${EXTRA_LIBS} ${CPUID_LIB} ${ARGON2_LIBRARY} ${ETHASH_LIBRARY} ${GHOSTRIDER_LIBRARY} ${FMT_LIBRARY})
|
||||
|
||||
if (WIN32)
|
||||
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/bin/WinRing0/WinRing0x64.sys" $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
|
||||
|
||||
13
cmake/fmt.cmake
Normal file
13
cmake/fmt.cmake
Normal file
@@ -0,0 +1,13 @@
|
||||
# SPDX-FileCopyrightText: © 2023 Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
|
||||
if(WITH_BUNDLED_FMT)
|
||||
add_library(fmt INTERFACE)
|
||||
target_sources(fmt INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src/3rdparty/fmt/format.cc)
|
||||
target_include_directories(fmt INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src/3rdparty/fmt)
|
||||
else()
|
||||
set(FMT_LIBRARY fmt)
|
||||
find_package(fmt REQUIRED)
|
||||
set(FMT_LIBRARY fmt::fmt)
|
||||
endif()
|
||||
2
src/3rdparty/cl.h
vendored
2
src/3rdparty/cl.h
vendored
@@ -29,7 +29,7 @@
|
||||
#if defined(__APPLE__)
|
||||
# include <OpenCL/cl.h>
|
||||
#else
|
||||
# include "3rdparty/CL/cl.h"
|
||||
# include <CL/cl.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
//
|
||||
// For the license information refer to format.h.
|
||||
|
||||
#include "3rdparty/fmt/format-inl.h"
|
||||
#include "fmt/format-inl.h"
|
||||
|
||||
FMT_BEGIN_NAMESPACE
|
||||
namespace detail {
|
||||
@@ -18,11 +18,11 @@
|
||||
*/
|
||||
|
||||
#include "base/tools/String.h"
|
||||
#include "3rdparty/fmt/core.h"
|
||||
|
||||
|
||||
#include <cstdio>
|
||||
#include <cctype>
|
||||
#include <fmt/core.h>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
|
||||
#include "backend/opencl/wrappers/AdlLib.h"
|
||||
#include "3rdparty/fmt/core.h"
|
||||
#include "backend/opencl/wrappers/OclDevice.h"
|
||||
|
||||
|
||||
@@ -31,6 +30,7 @@
|
||||
#include <string>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <fmt/core.h>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
@@ -88,7 +88,6 @@ set(HEADERS_BASE
|
||||
)
|
||||
|
||||
set(SOURCES_BASE
|
||||
src/3rdparty/fmt/format.cc
|
||||
src/base/crypto/Algorithm.cpp
|
||||
src/base/crypto/Coin.cpp
|
||||
src/base/crypto/keccak.cpp
|
||||
|
||||
@@ -49,6 +49,8 @@ public:
|
||||
static inline bool isUserActive(uint64_t ms) { return idleTime() < ms; }
|
||||
static inline const String &userAgent() { return m_userAgent; }
|
||||
|
||||
static bool hasKeepalive();
|
||||
|
||||
static bool isOnBatteryPower();
|
||||
static uint64_t idleTime();
|
||||
|
||||
|
||||
@@ -55,6 +55,12 @@ char *xmrig::Platform::createUserAgent()
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::Platform::hasKeepalive()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id)
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -70,6 +70,12 @@ char *xmrig::Platform::createUserAgent()
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::Platform::hasKeepalive()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#ifndef XMRIG_FEATURE_HWLOC
|
||||
#ifdef __DragonFly__
|
||||
|
||||
|
||||
@@ -70,6 +70,12 @@ char *xmrig::Platform::createUserAgent()
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::Platform::hasKeepalive()
|
||||
{
|
||||
return winOsVersion().dwMajorVersion >= 6;
|
||||
}
|
||||
|
||||
|
||||
#ifndef XMRIG_FEATURE_HWLOC
|
||||
bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id)
|
||||
{
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
|
||||
|
||||
#include "base/kernel/Process.h"
|
||||
#include "3rdparty/fmt/core.h"
|
||||
#include "base/tools/Chrono.h"
|
||||
#include "version.h"
|
||||
|
||||
#include <fmt/core.h>
|
||||
|
||||
#ifdef XMRIG_OS_WIN
|
||||
# ifdef _MSC_VER
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
|
||||
#include "base/net/stratum/BaseClient.h"
|
||||
#include "3rdparty/fmt/core.h"
|
||||
#include "3rdparty/rapidjson/document.h"
|
||||
#include "base/io/Env.h"
|
||||
#include "base/io/log/Log.h"
|
||||
@@ -25,6 +24,8 @@
|
||||
#include "base/kernel/interfaces/IClientListener.h"
|
||||
#include "base/net/stratum/SubmitResult.h"
|
||||
|
||||
#include <fmt/core.h>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "base/tools/Cvt.h"
|
||||
#include "base/tools/cryptonote/BlobReader.h"
|
||||
#include "net/JobResult.h"
|
||||
#include "base/kernel/Platform.h"
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
@@ -567,9 +568,9 @@ void xmrig::Client::connect(const sockaddr *addr)
|
||||
uv_tcp_init(uv_default_loop(), m_socket);
|
||||
uv_tcp_nodelay(m_socket, 1);
|
||||
|
||||
# ifndef WIN32
|
||||
uv_tcp_keepalive(m_socket, 1, 60);
|
||||
# endif
|
||||
if (Platform::hasKeepalive()) {
|
||||
uv_tcp_keepalive(m_socket, 1, 60);
|
||||
}
|
||||
|
||||
uv_tcp_connect(req, m_socket, addr, onConnect);
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "base/tools/Timer.h"
|
||||
#include "base/tools/cryptonote/Signatures.h"
|
||||
#include "net/JobResult.h"
|
||||
#include "base/kernel/Platform.h"
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_TLS
|
||||
@@ -358,9 +359,9 @@ void xmrig::DaemonClient::onResolved(const DnsRecords &records, int status, cons
|
||||
uv_tcp_init(uv_default_loop(), s);
|
||||
uv_tcp_nodelay(s, 1);
|
||||
|
||||
# ifndef WIN32
|
||||
uv_tcp_keepalive(s, 1, 60);
|
||||
# endif
|
||||
if (Platform::hasKeepalive()) {
|
||||
uv_tcp_keepalive(s, 1, 60);
|
||||
}
|
||||
|
||||
if (m_pool.zmq_port() > 0) {
|
||||
delete m_ZMQSocket;
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
|
||||
#include "base/net/stratum/benchmark/BenchClient.h"
|
||||
#include "3rdparty/fmt/core.h"
|
||||
#include "3rdparty/rapidjson/document.h"
|
||||
#include "backend/common/benchmark/BenchState.h"
|
||||
#include "backend/common/interfaces/IBackend.h"
|
||||
@@ -39,6 +38,8 @@
|
||||
# include "hw/dmi/DmiReader.h"
|
||||
#endif
|
||||
|
||||
#include <fmt/core.h>
|
||||
|
||||
|
||||
xmrig::BenchClient::BenchClient(const std::shared_ptr<BenchConfig> &benchmark, IClientListener* listener) :
|
||||
m_listener(listener),
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
*/
|
||||
|
||||
#include "base/net/stratum/benchmark/BenchConfig.h"
|
||||
#include "3rdparty/fmt/core.h"
|
||||
#include "3rdparty/rapidjson/document.h"
|
||||
#include "base/io/json/Json.h"
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <fmt/core.h>
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
*/
|
||||
|
||||
#include "crypto/common/LinuxMemory.h"
|
||||
#include "3rdparty/fmt/core.h"
|
||||
#include "crypto/common/VirtualMemory.h"
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <fmt/core.h>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
|
||||
#include "hw/dmi/DmiMemory.h"
|
||||
#include "3rdparty/fmt/format.h"
|
||||
#include "3rdparty/rapidjson/document.h"
|
||||
#include "hw/dmi/DmiTools.h"
|
||||
|
||||
@@ -28,6 +27,7 @@
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <regex>
|
||||
#include <fmt/format.h>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
@@ -19,10 +19,11 @@
|
||||
*/
|
||||
|
||||
#include "hw/dmi/DmiReader.h"
|
||||
#include "3rdparty/fmt/core.h"
|
||||
#include "3rdparty/rapidjson/document.h"
|
||||
#include "hw/dmi/DmiTools.h"
|
||||
|
||||
#include <fmt/core.h>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
|
||||
#include "hw/msr/Msr.h"
|
||||
#include "3rdparty/fmt/core.h"
|
||||
#include "backend/cpu/Cpu.h"
|
||||
#include "base/io/log/Log.h"
|
||||
|
||||
@@ -29,6 +28,7 @@
|
||||
#include <cstdio>
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <fmt/core.h>
|
||||
#include <fstream>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
Reference in New Issue
Block a user