Skip to content

Commit

Permalink
Allow using system libfmt
Browse files Browse the repository at this point in the history
Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
  • Loading branch information
jeandudey committed May 29, 2023
1 parent 65fc16d commit 0399b6b
Show file tree
Hide file tree
Showing 46 changed files with 32 additions and 15 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,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)
Expand Down Expand Up @@ -228,15 +229,15 @@ 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)
add_definitions(/DAPP_DEBUG)
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}>)
Expand Down
14 changes: 14 additions & 0 deletions cmake/fmt.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# SPDX-FileCopyrightText: © 2023 Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
# SPDX-License-Identifier: GPL-3.0-or-later

find_package(fmt QUIET)

if(fmt_FOUND)
set(FMT_LIBRARY fmt::fmt)
else()
message(STATUS "Using bundled fmt library")
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)
set(FMT_LIBRARY fmt)
endif()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/3rdparty/cl.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#if defined(__APPLE__)
# include <OpenCL/cl.h>
#else
# include "3rdparty/CL/cl.h"
# include <CL/cl.h>
#endif


Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/backend/cpu/platform/lscpu_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@


#include "base/tools/String.h"
#include "3rdparty/fmt/core.h"


#include <cstdio>
#include <cctype>
#include <fmt/core.h>


namespace xmrig {
Expand Down
2 changes: 1 addition & 1 deletion src/backend/opencl/wrappers/AdlLib_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@


#include "backend/opencl/wrappers/AdlLib.h"
#include "3rdparty/fmt/core.h"
#include "backend/opencl/wrappers/OclDevice.h"


Expand All @@ -31,6 +30,7 @@
#include <string>
#include <sys/stat.h>
#include <sys/types.h>
#include <fmt/core.h>


namespace xmrig {
Expand Down
1 change: 0 additions & 1 deletion src/base/base.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/base/kernel/Process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/base/net/stratum/BaseClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
*/

#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"
#include "base/io/log/Tags.h"
#include "base/kernel/interfaces/IClientListener.h"
#include "base/net/stratum/SubmitResult.h"

#include <fmt/core.h>


namespace xmrig {

Expand Down
3 changes: 2 additions & 1 deletion src/base/net/stratum/benchmark/BenchClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion src/base/net/stratum/benchmark/BenchConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/common/LinuxMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
2 changes: 1 addition & 1 deletion src/hw/dmi/DmiMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@


#include "hw/dmi/DmiMemory.h"
#include "3rdparty/fmt/format.h"
#include "3rdparty/rapidjson/document.h"
#include "hw/dmi/DmiTools.h"


#include <algorithm>
#include <array>
#include <regex>
#include <fmt/format.h>


namespace xmrig {
Expand Down
3 changes: 2 additions & 1 deletion src/hw/dmi/DmiReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion src/hw/msr/Msr_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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>
Expand Down

0 comments on commit 0399b6b

Please sign in to comment.