2017-12-16 20:27:11 +08:00
|
|
|
cmake_minimum_required(VERSION 2.8)
|
2017-06-05 01:52:21 +08:00
|
|
|
project(xmrig)
|
2017-05-03 15:53:51 +08:00
|
|
|
|
2019-03-02 14:12:38 +08:00
|
|
|
option(WITH_LIBCPUID "Use Libcpuid" ON)
|
|
|
|
option(WITH_AEON "CryptoNight-Lite support" ON)
|
|
|
|
option(WITH_SUMO "CryptoNight-Heavy support" ON)
|
|
|
|
option(WITH_CN_PICO "CryptoNight-Pico support" ON)
|
|
|
|
option(WITH_CN_GPU "CryptoNight-GPU support" ON)
|
|
|
|
option(WITH_HTTPD "HTTP REST API" ON)
|
|
|
|
option(WITH_DEBUG_LOG "Enable debug log output" OFF)
|
|
|
|
option(WITH_TLS "Enable OpenSSL support" ON)
|
|
|
|
option(WITH_ASM "Enable ASM PoW implementations" ON)
|
|
|
|
option(BUILD_STATIC "Build static binary" OFF)
|
|
|
|
option(ARM_TARGET "Force use specific ARM target 8 or 7" 0)
|
|
|
|
option(WITH_EMBEDDED_CONFIG "Enable internal embedded JSON config" OFF)
|
2017-06-25 07:04:59 +08:00
|
|
|
|
|
|
|
include (CheckIncludeFile)
|
2017-11-06 08:11:35 +08:00
|
|
|
include (cmake/cpu.cmake)
|
2019-03-16 03:07:26 +08:00
|
|
|
include (src/base/base.cmake)
|
2017-06-25 07:04:59 +08:00
|
|
|
|
|
|
|
|
2017-04-15 14:02:08 +08:00
|
|
|
set(HEADERS
|
2019-03-16 03:07:26 +08:00
|
|
|
"${HEADERS_BASE}"
|
2019-03-29 03:31:56 +08:00
|
|
|
"${HEADERS_BASE_HTTP}"
|
2019-03-30 04:10:27 +08:00
|
|
|
src/api/interfaces/IApiListener.h
|
2017-06-05 01:52:21 +08:00
|
|
|
src/App.h
|
2018-04-13 07:38:18 +08:00
|
|
|
src/common/config/CommonConfig.h
|
|
|
|
src/common/config/ConfigLoader.h
|
|
|
|
src/common/config/ConfigWatcher.h
|
2018-09-23 22:51:56 +08:00
|
|
|
src/common/cpu/Cpu.h
|
2018-04-25 15:48:32 +08:00
|
|
|
src/common/crypto/Algorithm.h
|
2018-04-20 15:45:51 +08:00
|
|
|
src/common/crypto/keccak.h
|
2018-06-05 08:34:58 +08:00
|
|
|
src/common/interfaces/IConfig.h
|
2018-09-23 22:51:56 +08:00
|
|
|
src/common/interfaces/ICpuInfo.h
|
2018-04-13 08:23:01 +08:00
|
|
|
src/common/Platform.h
|
2018-04-15 12:08:47 +08:00
|
|
|
src/common/utils/mm_malloc.h
|
2018-04-13 08:00:51 +08:00
|
|
|
src/common/xmrig.h
|
2019-03-30 22:27:54 +08:00
|
|
|
src/core/config/Config.h
|
|
|
|
src/core/config/ConfigLoader_default.h
|
|
|
|
src/core/config/ConfigLoader_platform.h
|
|
|
|
src/core/config/usage.h
|
2018-03-27 15:01:38 +08:00
|
|
|
src/core/Controller.h
|
2017-06-11 20:32:15 +08:00
|
|
|
src/interfaces/IJobResultListener.h
|
2018-04-01 23:49:21 +08:00
|
|
|
src/interfaces/IThread.h
|
2017-06-10 12:05:00 +08:00
|
|
|
src/interfaces/IWorker.h
|
2017-06-09 20:09:21 +08:00
|
|
|
src/Mem.h
|
2017-06-11 15:58:46 +08:00
|
|
|
src/net/JobResult.h
|
2017-06-05 01:52:21 +08:00
|
|
|
src/net/Network.h
|
2019-03-30 04:10:27 +08:00
|
|
|
src/net/NetworkState.h
|
2017-06-28 11:17:02 +08:00
|
|
|
src/net/strategies/DonateStrategy.h
|
2017-06-08 06:16:45 +08:00
|
|
|
src/Summary.h
|
2017-06-12 21:19:07 +08:00
|
|
|
src/version.h
|
2018-04-01 23:49:21 +08:00
|
|
|
src/workers/CpuThread.h
|
2017-06-16 02:00:25 +08:00
|
|
|
src/workers/Hashrate.h
|
2018-04-14 23:14:57 +08:00
|
|
|
src/workers/MultiWorker.h
|
2019-03-30 04:10:27 +08:00
|
|
|
src/workers/ThreadHandle.h
|
2017-06-10 12:05:00 +08:00
|
|
|
src/workers/Worker.h
|
2017-06-10 14:41:08 +08:00
|
|
|
src/workers/Workers.h
|
2017-04-15 14:02:08 +08:00
|
|
|
)
|
|
|
|
|
2017-06-08 09:20:10 +08:00
|
|
|
set(HEADERS_CRYPTO
|
|
|
|
src/crypto/c_blake256.h
|
|
|
|
src/crypto/c_groestl.h
|
|
|
|
src/crypto/c_jh.h
|
|
|
|
src/crypto/c_skein.h
|
2017-06-08 14:47:25 +08:00
|
|
|
src/crypto/CryptoNight.h
|
2018-04-03 03:55:28 +08:00
|
|
|
src/crypto/CryptoNight_constants.h
|
2018-03-06 22:34:20 +08:00
|
|
|
src/crypto/CryptoNight_monero.h
|
2017-06-09 04:31:42 +08:00
|
|
|
src/crypto/CryptoNight_test.h
|
2017-06-08 09:20:10 +08:00
|
|
|
src/crypto/groestl_tables.h
|
|
|
|
src/crypto/hash.h
|
|
|
|
src/crypto/skein_port.h
|
2017-11-03 10:35:29 +08:00
|
|
|
src/crypto/soft_aes.h
|
2019-02-10 22:21:17 +08:00
|
|
|
src/crypto/asm/CryptonightR_template.h
|
2017-06-08 09:20:10 +08:00
|
|
|
)
|
|
|
|
|
2017-11-27 03:23:23 +08:00
|
|
|
if (XMRIG_ARM)
|
|
|
|
set(HEADERS_CRYPTO "${HEADERS_CRYPTO}" src/crypto/CryptoNight_arm.h)
|
2017-11-06 08:11:35 +08:00
|
|
|
else()
|
|
|
|
set(HEADERS_CRYPTO "${HEADERS_CRYPTO}" src/crypto/CryptoNight_x86.h)
|
|
|
|
endif()
|
|
|
|
|
2017-04-15 14:02:08 +08:00
|
|
|
set(SOURCES
|
2019-03-16 03:07:26 +08:00
|
|
|
"${SOURCES_BASE}"
|
2019-03-29 03:31:56 +08:00
|
|
|
"${SOURCES_BASE_HTTP}"
|
2017-06-05 01:52:21 +08:00
|
|
|
src/App.cpp
|
2018-04-13 07:38:18 +08:00
|
|
|
src/common/config/CommonConfig.cpp
|
|
|
|
src/common/config/ConfigLoader.cpp
|
|
|
|
src/common/config/ConfigWatcher.cpp
|
2018-04-25 15:48:32 +08:00
|
|
|
src/common/crypto/Algorithm.cpp
|
2018-04-20 15:45:51 +08:00
|
|
|
src/common/crypto/keccak.cpp
|
2018-04-13 08:23:01 +08:00
|
|
|
src/common/Platform.cpp
|
2019-03-30 22:27:54 +08:00
|
|
|
src/core/config/Config.cpp
|
2018-03-27 15:01:38 +08:00
|
|
|
src/core/Controller.cpp
|
2017-06-09 20:09:21 +08:00
|
|
|
src/Mem.cpp
|
2017-06-05 01:52:21 +08:00
|
|
|
src/net/Network.cpp
|
2019-03-30 04:10:27 +08:00
|
|
|
src/net/NetworkState.cpp
|
2017-06-28 11:17:02 +08:00
|
|
|
src/net/strategies/DonateStrategy.cpp
|
2017-06-08 06:16:45 +08:00
|
|
|
src/Summary.cpp
|
2018-04-01 23:49:21 +08:00
|
|
|
src/workers/CpuThread.cpp
|
2017-06-16 02:00:25 +08:00
|
|
|
src/workers/Hashrate.cpp
|
2018-04-14 23:14:57 +08:00
|
|
|
src/workers/MultiWorker.cpp
|
2019-03-30 04:10:27 +08:00
|
|
|
src/workers/ThreadHandle.cpp
|
2017-06-10 12:05:00 +08:00
|
|
|
src/workers/Worker.cpp
|
2017-06-10 14:41:08 +08:00
|
|
|
src/workers/Workers.cpp
|
2017-06-05 01:52:21 +08:00
|
|
|
src/xmrig.cpp
|
2017-04-15 14:02:08 +08:00
|
|
|
)
|
|
|
|
|
2017-06-08 09:20:10 +08:00
|
|
|
set(SOURCES_CRYPTO
|
|
|
|
src/crypto/c_groestl.c
|
|
|
|
src/crypto/c_blake256.c
|
|
|
|
src/crypto/c_jh.c
|
|
|
|
src/crypto/c_skein.c
|
|
|
|
)
|
|
|
|
|
2017-04-15 14:02:08 +08:00
|
|
|
if (WIN32)
|
2017-06-05 01:52:21 +08:00
|
|
|
set(SOURCES_OS
|
2019-03-16 03:07:26 +08:00
|
|
|
"${SOURCES_OS}"
|
2017-06-05 01:52:21 +08:00
|
|
|
res/app.rc
|
2017-06-13 18:20:15 +08:00
|
|
|
src/App_win.cpp
|
2018-04-13 08:23:01 +08:00
|
|
|
src/common/Platform_win.cpp
|
2017-06-09 20:09:21 +08:00
|
|
|
src/Mem_win.cpp
|
2017-06-05 01:52:21 +08:00
|
|
|
)
|
|
|
|
|
2017-06-15 02:33:20 +08:00
|
|
|
add_definitions(/DWIN32)
|
2017-06-05 01:52:21 +08:00
|
|
|
set(EXTRA_LIBS ws2_32 psapi iphlpapi userenv)
|
2017-06-15 00:13:02 +08:00
|
|
|
elseif (APPLE)
|
|
|
|
set(SOURCES_OS
|
2019-03-16 03:07:26 +08:00
|
|
|
"${SOURCES_OS}"
|
2017-06-15 00:13:02 +08:00
|
|
|
src/App_unix.cpp
|
2018-04-13 08:23:01 +08:00
|
|
|
src/common/Platform_mac.cpp
|
2017-06-15 00:13:02 +08:00
|
|
|
src/Mem_unix.cpp
|
|
|
|
)
|
2017-04-15 14:02:08 +08:00
|
|
|
else()
|
2017-06-15 00:13:02 +08:00
|
|
|
set(SOURCES_OS
|
2019-03-16 03:07:26 +08:00
|
|
|
"${SOURCES_OS}"
|
2017-06-15 00:13:02 +08:00
|
|
|
src/App_unix.cpp
|
2018-04-13 08:23:01 +08:00
|
|
|
src/common/Platform_unix.cpp
|
2017-06-15 00:13:02 +08:00
|
|
|
src/Mem_unix.cpp
|
|
|
|
)
|
|
|
|
|
2018-10-24 10:55:40 +08:00
|
|
|
if (CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
|
2019-01-16 17:55:45 +08:00
|
|
|
set(EXTRA_LIBS kvm pthread)
|
2018-10-24 10:55:40 +08:00
|
|
|
else()
|
|
|
|
set(EXTRA_LIBS pthread rt dl)
|
|
|
|
endif()
|
2017-10-21 00:54:18 +08:00
|
|
|
endif()
|
|
|
|
|
2017-11-24 05:23:04 +08:00
|
|
|
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|
|
|
EXECUTE_PROCESS(COMMAND uname -o COMMAND tr -d '\n' OUTPUT_VARIABLE OPERATING_SYSTEM)
|
|
|
|
if (OPERATING_SYSTEM MATCHES "Android")
|
|
|
|
set(EXTRA_LIBS ${EXTRA_LIBS} log)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2017-08-30 04:41:57 +08:00
|
|
|
add_definitions(/D__STDC_FORMAT_MACROS)
|
2017-05-05 20:49:38 +08:00
|
|
|
add_definitions(/DUNICODE)
|
2017-04-15 14:02:08 +08:00
|
|
|
|
2017-06-05 01:52:21 +08:00
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
2017-04-15 14:02:08 +08:00
|
|
|
|
2017-06-05 01:52:21 +08:00
|
|
|
find_package(UV REQUIRED)
|
2017-05-27 15:34:42 +08:00
|
|
|
|
2017-11-06 08:11:35 +08:00
|
|
|
include(cmake/flags.cmake)
|
2017-04-15 14:02:08 +08:00
|
|
|
|
2017-06-08 05:10:26 +08:00
|
|
|
if (WITH_LIBCPUID)
|
2017-06-08 06:51:24 +08:00
|
|
|
add_subdirectory(src/3rdparty/libcpuid)
|
2017-06-08 05:10:26 +08:00
|
|
|
|
2017-06-08 06:51:24 +08:00
|
|
|
include_directories(src/3rdparty/libcpuid)
|
|
|
|
set(CPUID_LIB cpuid)
|
2018-09-23 22:51:56 +08:00
|
|
|
set(SOURCES_CPUID src/core/cpu/AdvancedCpuInfo.h src/core/cpu/AdvancedCpuInfo.cpp src/core/cpu/Cpu.cpp)
|
2017-06-08 05:10:26 +08:00
|
|
|
else()
|
|
|
|
add_definitions(/DXMRIG_NO_LIBCPUID)
|
2018-09-23 22:51:56 +08:00
|
|
|
set(SOURCES_CPUID src/common/cpu/BasicCpuInfo.h src/common/cpu/Cpu.cpp)
|
2017-11-06 08:11:35 +08:00
|
|
|
|
2017-11-27 03:23:23 +08:00
|
|
|
if (XMRIG_ARM)
|
2018-09-23 22:51:56 +08:00
|
|
|
set(SOURCES_CPUID ${SOURCES_CPUID} src/common/cpu/BasicCpuInfo_arm.cpp)
|
2017-11-06 08:11:35 +08:00
|
|
|
else()
|
2018-09-23 22:51:56 +08:00
|
|
|
set(SOURCES_CPUID ${SOURCES_CPUID} src/common/cpu/BasicCpuInfo.cpp)
|
2017-11-06 08:11:35 +08:00
|
|
|
endif()
|
2017-06-08 05:10:26 +08:00
|
|
|
endif()
|
|
|
|
|
2018-09-16 08:06:54 +08:00
|
|
|
include(cmake/OpenSSL.cmake)
|
2018-09-24 01:16:33 +08:00
|
|
|
include(cmake/asm.cmake)
|
2019-02-03 15:44:23 +08:00
|
|
|
include(cmake/cn-gpu.cmake)
|
2018-09-16 08:06:54 +08:00
|
|
|
|
2017-09-03 00:04:40 +08:00
|
|
|
if (NOT WITH_AEON)
|
|
|
|
add_definitions(/DXMRIG_NO_AEON)
|
|
|
|
endif()
|
|
|
|
|
2018-04-03 03:55:28 +08:00
|
|
|
if (NOT WITH_SUMO)
|
|
|
|
add_definitions(/DXMRIG_NO_SUMO)
|
|
|
|
endif()
|
|
|
|
|
2018-04-21 01:19:33 +08:00
|
|
|
if (NOT WITH_IPBC)
|
|
|
|
add_definitions(/DXMRIG_NO_IPBC)
|
|
|
|
endif()
|
|
|
|
|
2019-01-20 20:52:44 +08:00
|
|
|
if (NOT WITH_CN_PICO)
|
|
|
|
add_definitions(/DXMRIG_NO_CN_PICO)
|
|
|
|
endif()
|
|
|
|
|
2019-03-02 14:12:38 +08:00
|
|
|
if (WITH_EMBEDDED_CONFIG)
|
|
|
|
add_definitions(/DXMRIG_FEATURE_EMBEDDED_CONFIG)
|
|
|
|
endif()
|
|
|
|
|
2017-10-05 04:33:30 +08:00
|
|
|
if (WITH_HTTPD)
|
2019-03-29 13:33:11 +08:00
|
|
|
set(HTTPD_SOURCES
|
2019-03-31 02:31:40 +08:00
|
|
|
src/api/Api.cpp
|
2019-03-30 01:16:01 +08:00
|
|
|
src/api/Api.h
|
2019-03-31 02:31:40 +08:00
|
|
|
src/api/Httpd.cpp
|
|
|
|
src/api/Httpd.h
|
2019-03-30 03:26:30 +08:00
|
|
|
src/api/interfaces/IApiRequest.h
|
|
|
|
src/api/requests/ApiRequest.cpp
|
2019-03-31 02:31:40 +08:00
|
|
|
src/api/requests/ApiRequest.h
|
2019-03-30 03:26:30 +08:00
|
|
|
src/api/requests/HttpApiRequest.cpp
|
2019-03-31 02:31:40 +08:00
|
|
|
src/api/requests/HttpApiRequest.h
|
|
|
|
src/api/v1/ApiRouter.cpp
|
|
|
|
src/api/v1/ApiRouter.h
|
2019-03-29 13:33:11 +08:00
|
|
|
)
|
2017-08-31 07:28:33 +08:00
|
|
|
else()
|
2018-09-16 08:06:54 +08:00
|
|
|
set(HTTPD_SOURCES "")
|
2017-08-31 07:28:33 +08:00
|
|
|
endif()
|
|
|
|
|
2017-06-05 01:52:21 +08:00
|
|
|
include_directories(src)
|
|
|
|
include_directories(src/3rdparty)
|
|
|
|
include_directories(${UV_INCLUDE_DIR})
|
2017-05-10 17:58:52 +08:00
|
|
|
|
2018-03-13 04:03:04 +08:00
|
|
|
if (BUILD_STATIC)
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS " -static")
|
|
|
|
endif()
|
|
|
|
|
2018-09-03 06:26:19 +08:00
|
|
|
if (WITH_DEBUG_LOG)
|
|
|
|
add_definitions(/DAPP_DEBUG)
|
|
|
|
endif()
|
|
|
|
|
2019-02-03 15:44:23 +08:00
|
|
|
add_executable(${CMAKE_PROJECT_NAME} ${HEADERS} ${SOURCES} ${SOURCES_OS} ${SOURCES_CPUID} ${HEADERS_CRYPTO} ${SOURCES_CRYPTO} ${SOURCES_SYSLOG} ${HTTPD_SOURCES} ${TLS_SOURCES} ${XMRIG_ASM_SOURCES} ${CN_GPU_SOURCES})
|
2019-03-29 13:33:11 +08:00
|
|
|
target_link_libraries(${CMAKE_PROJECT_NAME} ${XMRIG_ASM_LIBRARY} ${OPENSSL_LIBRARIES} ${UV_LIBRARIES} ${EXTRA_LIBS} ${CPUID_LIB})
|