2020-12-11 16:17:54 +00:00
|
|
|
cmake_minimum_required(VERSION 2.8.12)
|
2017-06-04 17:52:21 +00:00
|
|
|
project(xmrig)
|
2017-05-03 07:53:51 +00:00
|
|
|
|
2019-08-15 17:31:29 +00:00
|
|
|
option(WITH_HWLOC "Enable hwloc support" ON)
|
|
|
|
option(WITH_CN_LITE "Enable CryptoNight-Lite algorithms family" ON)
|
|
|
|
option(WITH_CN_HEAVY "Enable CryptoNight-Heavy algorithms family" ON)
|
|
|
|
option(WITH_CN_PICO "Enable CryptoNight-Pico algorithm" ON)
|
2021-04-17 12:53:42 +00:00
|
|
|
option(WITH_CN_FEMTO "Enable CryptoNight-UPX2 algorithm" ON)
|
2019-08-15 17:31:29 +00:00
|
|
|
option(WITH_RANDOMX "Enable RandomX algorithms family" ON)
|
|
|
|
option(WITH_ARGON2 "Enable Argon2 algorithms family" ON)
|
2020-02-29 21:41:24 +00:00
|
|
|
option(WITH_ASTROBWT "Enable AstroBWT algorithms family" ON)
|
2020-05-24 21:57:41 +00:00
|
|
|
option(WITH_KAWPOW "Enable KawPow algorithms family" ON)
|
2021-11-13 19:12:15 +00:00
|
|
|
option(WITH_GHOSTRIDER "Enable GhostRider algorithm" ON)
|
2019-08-15 17:31:29 +00:00
|
|
|
option(WITH_HTTP "Enable HTTP protocol support (client/server)" ON)
|
2019-03-02 06:12:38 +00:00
|
|
|
option(WITH_DEBUG_LOG "Enable debug log output" OFF)
|
|
|
|
option(WITH_TLS "Enable OpenSSL support" ON)
|
|
|
|
option(WITH_ASM "Enable ASM PoW implementations" ON)
|
2019-12-27 18:45:54 +00:00
|
|
|
option(WITH_MSR "Enable MSR mod & 1st-gen Ryzen fix" ON)
|
2019-12-30 09:04:07 +00:00
|
|
|
option(WITH_ENV_VARS "Enable environment variables support in config file" ON)
|
2019-07-25 04:24:27 +00:00
|
|
|
option(WITH_EMBEDDED_CONFIG "Enable internal embedded JSON config" OFF)
|
2019-09-13 09:55:44 +00:00
|
|
|
option(WITH_OPENCL "Enable OpenCL backend" ON)
|
2021-09-30 15:15:36 +00:00
|
|
|
set(WITH_OPENCL_VERSION 200 CACHE STRING "Target OpenCL version")
|
|
|
|
set_property(CACHE WITH_OPENCL_VERSION PROPERTY STRINGS 120 200 210 220)
|
2019-10-23 09:37:56 +00:00
|
|
|
option(WITH_CUDA "Enable CUDA backend" ON)
|
2019-10-30 08:33:06 +00:00
|
|
|
option(WITH_NVML "Enable NVML (NVIDIA Management Library) support (only if CUDA backend enabled)" ON)
|
2020-02-14 16:37:44 +00:00
|
|
|
option(WITH_ADL "Enable ADL (AMD Display Library) or sysfs support (only if OpenCL backend enabled)" ON)
|
2019-08-26 23:31:40 +00:00
|
|
|
option(WITH_STRICT_CACHE "Enable strict checks for OpenCL cache" ON)
|
2019-09-06 04:43:02 +00:00
|
|
|
option(WITH_INTERLEAVE_DEBUG_LOG "Enable debug log for threads interleave" OFF)
|
2020-09-12 21:07:52 +00:00
|
|
|
option(WITH_PROFILING "Enable profiling for developers" OFF)
|
2020-10-01 04:00:08 +00:00
|
|
|
option(WITH_SSE4_1 "Enable SSE 4.1 for Blake2" ON)
|
2020-10-15 19:18:07 +00:00
|
|
|
option(WITH_BENCHMARK "Enable builtin RandomX benchmark and stress test" ON)
|
2020-12-11 16:17:54 +00:00
|
|
|
option(WITH_SECURE_JIT "Enable secure access to JIT memory" OFF)
|
2021-01-21 17:12:34 +00:00
|
|
|
option(WITH_DMI "Enable DMI/SMBIOS reader" ON)
|
2019-07-25 04:24:27 +00:00
|
|
|
|
2019-03-02 06:12:38 +00:00
|
|
|
option(BUILD_STATIC "Build static binary" OFF)
|
|
|
|
option(ARM_TARGET "Force use specific ARM target 8 or 7" 0)
|
2019-07-25 04:24:27 +00:00
|
|
|
option(HWLOC_DEBUG "Enable hwloc debug helpers and log" OFF)
|
2017-06-24 23:04:59 +00:00
|
|
|
|
2019-07-23 23:35:42 +00:00
|
|
|
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
|
|
|
|
|
|
|
|
2017-06-24 23:04:59 +00:00
|
|
|
include (CheckIncludeFile)
|
2017-11-06 00:11:35 +00:00
|
|
|
include (cmake/cpu.cmake)
|
2019-12-08 06:30:26 +00:00
|
|
|
include (cmake/os.cmake)
|
2019-03-15 19:07:26 +00:00
|
|
|
include (src/base/base.cmake)
|
2019-07-02 15:56:28 +00:00
|
|
|
include (src/backend/backend.cmake)
|
2017-06-24 23:04:59 +00:00
|
|
|
|
|
|
|
|
2017-04-15 06:02:08 +00:00
|
|
|
set(HEADERS
|
2019-03-15 19:07:26 +00:00
|
|
|
"${HEADERS_BASE}"
|
2019-03-28 19:31:56 +00:00
|
|
|
"${HEADERS_BASE_HTTP}"
|
2019-07-02 15:56:28 +00:00
|
|
|
"${HEADERS_BACKEND}"
|
2017-06-04 17:52:21 +00:00
|
|
|
src/App.h
|
2019-04-05 15:14:01 +00:00
|
|
|
src/core/config/Config_default.h
|
|
|
|
src/core/config/Config_platform.h
|
2019-04-06 11:32:24 +00:00
|
|
|
src/core/config/Config.h
|
|
|
|
src/core/config/ConfigTransform.h
|
2019-03-30 14:27:54 +00:00
|
|
|
src/core/config/usage.h
|
2018-03-27 07:01:38 +00:00
|
|
|
src/core/Controller.h
|
2019-07-16 15:10:50 +00:00
|
|
|
src/core/Miner.h
|
2021-09-20 15:29:04 +00:00
|
|
|
src/core/Taskbar.h
|
2019-07-06 08:22:19 +00:00
|
|
|
src/net/interfaces/IJobResultListener.h
|
2017-06-11 07:58:46 +00:00
|
|
|
src/net/JobResult.h
|
2019-07-06 08:22:19 +00:00
|
|
|
src/net/JobResults.h
|
2017-06-04 17:52:21 +00:00
|
|
|
src/net/Network.h
|
2017-06-28 03:17:02 +00:00
|
|
|
src/net/strategies/DonateStrategy.h
|
2017-06-07 22:16:45 +00:00
|
|
|
src/Summary.h
|
2017-06-12 13:19:07 +00:00
|
|
|
src/version.h
|
2017-04-15 06:02:08 +00:00
|
|
|
)
|
|
|
|
|
2017-06-08 01:20:10 +00:00
|
|
|
set(HEADERS_CRYPTO
|
2019-10-07 05:36:40 +00:00
|
|
|
src/backend/common/interfaces/IMemoryPool.h
|
2019-06-04 12:20:33 +00:00
|
|
|
src/crypto/cn/asm/CryptonightR_template.h
|
|
|
|
src/crypto/cn/c_blake256.h
|
|
|
|
src/crypto/cn/c_groestl.h
|
|
|
|
src/crypto/cn/c_jh.h
|
|
|
|
src/crypto/cn/c_skein.h
|
2020-04-23 05:34:26 +00:00
|
|
|
src/crypto/cn/CnAlgo.h
|
2019-07-16 21:33:11 +00:00
|
|
|
src/crypto/cn/CnCtx.h
|
2019-06-13 15:08:52 +00:00
|
|
|
src/crypto/cn/CnHash.h
|
2019-06-04 12:20:33 +00:00
|
|
|
src/crypto/cn/CryptoNight_monero.h
|
|
|
|
src/crypto/cn/CryptoNight_test.h
|
|
|
|
src/crypto/cn/CryptoNight.h
|
|
|
|
src/crypto/cn/groestl_tables.h
|
|
|
|
src/crypto/cn/hash.h
|
|
|
|
src/crypto/cn/skein_port.h
|
|
|
|
src/crypto/cn/soft_aes.h
|
2019-12-08 16:17:39 +00:00
|
|
|
src/crypto/common/HugePagesInfo.h
|
2019-10-07 05:36:40 +00:00
|
|
|
src/crypto/common/MemoryPool.h
|
2019-07-11 09:15:51 +00:00
|
|
|
src/crypto/common/Nonce.h
|
2019-06-02 13:57:49 +00:00
|
|
|
src/crypto/common/portable/mm_malloc.h
|
|
|
|
src/crypto/common/VirtualMemory.h
|
2017-06-08 01:20:10 +00:00
|
|
|
)
|
|
|
|
|
2017-11-26 19:23:23 +00:00
|
|
|
if (XMRIG_ARM)
|
2019-06-04 12:20:33 +00:00
|
|
|
set(HEADERS_CRYPTO "${HEADERS_CRYPTO}" src/crypto/cn/CryptoNight_arm.h)
|
2017-11-06 00:11:35 +00:00
|
|
|
else()
|
2019-06-04 12:20:33 +00:00
|
|
|
set(HEADERS_CRYPTO "${HEADERS_CRYPTO}" src/crypto/cn/CryptoNight_x86.h)
|
2017-11-06 00:11:35 +00:00
|
|
|
endif()
|
|
|
|
|
2017-04-15 06:02:08 +00:00
|
|
|
set(SOURCES
|
2019-03-15 19:07:26 +00:00
|
|
|
"${SOURCES_BASE}"
|
2019-03-28 19:31:56 +00:00
|
|
|
"${SOURCES_BASE_HTTP}"
|
2019-07-02 15:56:28 +00:00
|
|
|
"${SOURCES_BACKEND}"
|
2017-06-04 17:52:21 +00:00
|
|
|
src/App.cpp
|
2019-03-30 14:27:54 +00:00
|
|
|
src/core/config/Config.cpp
|
2019-04-05 15:14:01 +00:00
|
|
|
src/core/config/ConfigTransform.cpp
|
2018-03-27 07:01:38 +00:00
|
|
|
src/core/Controller.cpp
|
2019-07-16 15:10:50 +00:00
|
|
|
src/core/Miner.cpp
|
2021-09-20 15:29:04 +00:00
|
|
|
src/core/Taskbar.cpp
|
2019-07-06 08:22:19 +00:00
|
|
|
src/net/JobResults.cpp
|
2017-06-04 17:52:21 +00:00
|
|
|
src/net/Network.cpp
|
2017-06-28 03:17:02 +00:00
|
|
|
src/net/strategies/DonateStrategy.cpp
|
2017-06-07 22:16:45 +00:00
|
|
|
src/Summary.cpp
|
2017-06-04 17:52:21 +00:00
|
|
|
src/xmrig.cpp
|
2017-04-15 06:02:08 +00:00
|
|
|
)
|
|
|
|
|
2017-06-08 01:20:10 +00:00
|
|
|
set(SOURCES_CRYPTO
|
2019-06-04 12:20:33 +00:00
|
|
|
src/crypto/cn/c_blake256.c
|
2019-06-13 15:08:52 +00:00
|
|
|
src/crypto/cn/c_groestl.c
|
2019-06-04 12:20:33 +00:00
|
|
|
src/crypto/cn/c_jh.c
|
|
|
|
src/crypto/cn/c_skein.c
|
2019-07-16 21:33:11 +00:00
|
|
|
src/crypto/cn/CnCtx.cpp
|
2019-06-13 15:08:52 +00:00
|
|
|
src/crypto/cn/CnHash.cpp
|
2019-12-08 16:17:39 +00:00
|
|
|
src/crypto/common/HugePagesInfo.cpp
|
2019-10-07 05:36:40 +00:00
|
|
|
src/crypto/common/MemoryPool.cpp
|
2019-07-11 09:15:51 +00:00
|
|
|
src/crypto/common/Nonce.cpp
|
2019-07-26 08:29:06 +00:00
|
|
|
src/crypto/common/VirtualMemory.cpp
|
2017-06-08 01:20:10 +00:00
|
|
|
)
|
|
|
|
|
2021-11-13 19:12:15 +00:00
|
|
|
if (CMAKE_C_COMPILER_ID MATCHES GNU)
|
|
|
|
set_source_files_properties(src/crypto/cn/CnHash.cpp PROPERTIES COMPILE_FLAGS "-Ofast -fno-tree-vectorize")
|
|
|
|
endif()
|
|
|
|
|
2019-10-07 05:36:40 +00:00
|
|
|
if (WITH_HWLOC)
|
2019-10-07 13:39:04 +00:00
|
|
|
list(APPEND HEADERS_CRYPTO
|
|
|
|
src/crypto/common/NUMAMemoryPool.h
|
|
|
|
)
|
|
|
|
|
2019-10-07 05:36:40 +00:00
|
|
|
list(APPEND SOURCES_CRYPTO
|
2019-10-07 13:39:04 +00:00
|
|
|
src/crypto/common/NUMAMemoryPool.cpp
|
|
|
|
src/crypto/common/VirtualMemory_hwloc.cpp
|
2019-10-07 05:36:40 +00:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2019-12-08 06:30:26 +00:00
|
|
|
if (XMRIG_OS_WIN)
|
|
|
|
list(APPEND SOURCES_OS
|
2017-06-04 17:52:21 +00:00
|
|
|
res/app.rc
|
2017-06-13 10:20:15 +00:00
|
|
|
src/App_win.cpp
|
2019-06-02 12:43:56 +00:00
|
|
|
src/crypto/common/VirtualMemory_win.cpp
|
2017-06-04 17:52:21 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
set(EXTRA_LIBS ws2_32 psapi iphlpapi userenv)
|
2019-12-08 06:30:26 +00:00
|
|
|
elseif (XMRIG_OS_APPLE)
|
|
|
|
list(APPEND SOURCES_OS
|
2017-06-14 16:13:02 +00:00
|
|
|
src/App_unix.cpp
|
2019-06-02 12:43:56 +00:00
|
|
|
src/crypto/common/VirtualMemory_unix.cpp
|
2017-06-14 16:13:02 +00:00
|
|
|
)
|
2021-02-20 06:18:31 +00:00
|
|
|
|
2020-08-11 21:52:26 +00:00
|
|
|
find_library(IOKIT_LIBRARY IOKit)
|
2021-02-20 06:18:31 +00:00
|
|
|
find_library(CORESERVICES_LIBRARY CoreServices)
|
|
|
|
set(EXTRA_LIBS ${IOKIT_LIBRARY} ${CORESERVICES_LIBRARY})
|
2017-04-15 06:02:08 +00:00
|
|
|
else()
|
2019-12-08 06:30:26 +00:00
|
|
|
list(APPEND SOURCES_OS
|
2017-06-14 16:13:02 +00:00
|
|
|
src/App_unix.cpp
|
2019-06-02 12:43:56 +00:00
|
|
|
src/crypto/common/VirtualMemory_unix.cpp
|
2017-06-14 16:13:02 +00:00
|
|
|
)
|
|
|
|
|
2019-12-08 06:30:26 +00:00
|
|
|
if (XMRIG_OS_ANDROID)
|
|
|
|
set(EXTRA_LIBS pthread rt dl log)
|
|
|
|
elseif (XMRIG_OS_LINUX)
|
2019-12-08 16:17:39 +00:00
|
|
|
list(APPEND SOURCES_OS
|
|
|
|
src/crypto/common/LinuxMemory.h
|
|
|
|
src/crypto/common/LinuxMemory.cpp
|
|
|
|
)
|
|
|
|
|
2018-10-24 02:55:40 +00:00
|
|
|
set(EXTRA_LIBS pthread rt dl)
|
2019-12-08 06:30:26 +00:00
|
|
|
elseif (XMRIG_OS_FREEBSD)
|
|
|
|
set(EXTRA_LIBS kvm pthread)
|
2017-11-23 21:23:04 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2020-12-03 08:39:33 +00:00
|
|
|
add_definitions(-DXMRIG_MINER_PROJECT -DXMRIG_JSON_SINGLE_LINE_ARRAY)
|
2021-01-18 09:53:42 +00:00
|
|
|
add_definitions(-D__STDC_FORMAT_MACROS -DUNICODE -D_FILE_OFFSET_BITS=64)
|
2017-04-15 06:02:08 +00:00
|
|
|
|
2017-06-04 17:52:21 +00:00
|
|
|
find_package(UV REQUIRED)
|
2017-05-27 07:34:42 +00:00
|
|
|
|
2017-11-06 00:11:35 +00:00
|
|
|
include(cmake/flags.cmake)
|
2019-08-15 17:31:29 +00:00
|
|
|
include(cmake/randomx.cmake)
|
|
|
|
include(cmake/argon2.cmake)
|
2020-02-29 21:41:24 +00:00
|
|
|
include(cmake/astrobwt.cmake)
|
2020-05-24 21:57:41 +00:00
|
|
|
include(cmake/kawpow.cmake)
|
2021-11-13 19:12:15 +00:00
|
|
|
include(cmake/ghostrider.cmake)
|
2018-09-16 00:06:54 +00:00
|
|
|
include(cmake/OpenSSL.cmake)
|
2018-09-23 17:16:33 +00:00
|
|
|
include(cmake/asm.cmake)
|
2018-09-16 00:06:54 +00:00
|
|
|
|
2019-06-09 08:29:26 +00:00
|
|
|
if (WITH_CN_LITE)
|
|
|
|
add_definitions(/DXMRIG_ALGO_CN_LITE)
|
2017-09-02 16:04:40 +00:00
|
|
|
endif()
|
|
|
|
|
2019-06-09 08:29:26 +00:00
|
|
|
if (WITH_CN_HEAVY)
|
|
|
|
add_definitions(/DXMRIG_ALGO_CN_HEAVY)
|
2018-04-02 19:55:28 +00:00
|
|
|
endif()
|
|
|
|
|
2019-06-09 08:29:26 +00:00
|
|
|
if (WITH_CN_PICO)
|
|
|
|
add_definitions(/DXMRIG_ALGO_CN_PICO)
|
2019-01-20 12:52:44 +00:00
|
|
|
endif()
|
|
|
|
|
2021-04-17 12:53:42 +00:00
|
|
|
if (WITH_CN_FEMTO)
|
|
|
|
add_definitions(/DXMRIG_ALGO_CN_FEMTO)
|
|
|
|
endif()
|
|
|
|
|
2019-03-02 06:12:38 +00:00
|
|
|
if (WITH_EMBEDDED_CONFIG)
|
|
|
|
add_definitions(/DXMRIG_FEATURE_EMBEDDED_CONFIG)
|
|
|
|
endif()
|
|
|
|
|
2021-01-20 15:54:02 +00:00
|
|
|
include(src/hw/api/api.cmake)
|
|
|
|
include(src/hw/dmi/dmi.cmake)
|
2021-01-18 04:23:29 +00:00
|
|
|
|
2017-06-04 17:52:21 +00:00
|
|
|
include_directories(src)
|
|
|
|
include_directories(src/3rdparty)
|
|
|
|
include_directories(${UV_INCLUDE_DIR})
|
2017-05-10 09:58:52 +00:00
|
|
|
|
2018-09-02 22:26:19 +00:00
|
|
|
if (WITH_DEBUG_LOG)
|
|
|
|
add_definitions(/DAPP_DEBUG)
|
|
|
|
endif()
|
|
|
|
|
2020-12-06 14:51:24 +00:00
|
|
|
add_executable(${CMAKE_PROJECT_NAME} ${HEADERS} ${SOURCES} ${SOURCES_OS} ${HEADERS_CRYPTO} ${SOURCES_CRYPTO} ${SOURCES_SYSLOG} ${TLS_SOURCES} ${XMRIG_ASM_SOURCES})
|
2021-11-13 19:12:15 +00:00
|
|
|
target_link_libraries(${CMAKE_PROJECT_NAME} ${XMRIG_ASM_LIBRARY} ${OPENSSL_LIBRARIES} ${UV_LIBRARIES} ${EXTRA_LIBS} ${CPUID_LIB} ${ARGON2_LIBRARY} ${ETHASH_LIBRARY} ${GHOSTRIDER_LIBRARY})
|
2019-12-14 18:48:48 +00:00
|
|
|
|
|
|
|
if (WIN32)
|
2020-10-31 11:38:18 +00:00
|
|
|
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}>)
|
|
|
|
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/scripts/benchmark_1M.cmd" $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
|
|
|
|
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/scripts/benchmark_10M.cmd" $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
|
2020-11-26 17:50:46 +00:00
|
|
|
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/scripts/pool_mine_example.cmd" $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
|
|
|
|
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/scripts/solo_mine_example.cmd" $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
|
2019-12-14 18:48:48 +00:00
|
|
|
endif()
|
2020-08-23 16:48:05 +00:00
|
|
|
|
2020-12-15 15:47:22 +00:00
|
|
|
if (CMAKE_CXX_COMPILER_ID MATCHES Clang AND CMAKE_BUILD_TYPE STREQUAL Release AND NOT CMAKE_GENERATOR STREQUAL Xcode)
|
2020-08-23 16:48:05 +00:00
|
|
|
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_STRIP} ${CMAKE_PROJECT_NAME})
|
|
|
|
endif()
|