2017-12-16 12:27:11 +00:00
|
|
|
cmake_minimum_required(VERSION 2.8)
|
2017-06-04 17:52:21 +00:00
|
|
|
project(xmrig)
|
2017-05-03 07:53:51 +00:00
|
|
|
|
2019-03-02 06:12:38 +00:00
|
|
|
option(WITH_LIBCPUID "Use Libcpuid" ON)
|
2019-06-09 08:29:26 +00:00
|
|
|
option(WITH_CN_LITE "CryptoNight-Lite support" ON)
|
|
|
|
option(WITH_CN_HEAVY "CryptoNight-Heavy support" ON)
|
2019-03-02 06:12:38 +00:00
|
|
|
option(WITH_CN_PICO "CryptoNight-Pico support" ON)
|
|
|
|
option(WITH_CN_GPU "CryptoNight-GPU support" ON)
|
2019-04-08 19:27:19 +00:00
|
|
|
option(WITH_HTTP "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)
|
|
|
|
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-24 23:04:59 +00:00
|
|
|
|
|
|
|
include (CheckIncludeFile)
|
2017-11-06 00:11:35 +00:00
|
|
|
include (cmake/cpu.cmake)
|
2019-03-15 19:07:26 +00:00
|
|
|
include (src/base/base.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-03-29 20:10:27 +00:00
|
|
|
src/api/interfaces/IApiListener.h
|
2017-06-04 17:52:21 +00:00
|
|
|
src/App.h
|
2018-09-23 14:51:56 +00:00
|
|
|
src/common/cpu/Cpu.h
|
2018-04-20 07:45:51 +00:00
|
|
|
src/common/crypto/keccak.h
|
2018-09-23 14:51:56 +00:00
|
|
|
src/common/interfaces/ICpuInfo.h
|
2018-04-13 00:23:01 +00:00
|
|
|
src/common/Platform.h
|
2018-04-13 00:00:51 +00:00
|
|
|
src/common/xmrig.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
|
2017-06-11 12:32:15 +00:00
|
|
|
src/interfaces/IJobResultListener.h
|
2018-04-01 15:49:21 +00:00
|
|
|
src/interfaces/IThread.h
|
2017-06-10 04:05:00 +00:00
|
|
|
src/interfaces/IWorker.h
|
2017-06-09 12:09:21 +00:00
|
|
|
src/Mem.h
|
2017-06-11 07:58:46 +00:00
|
|
|
src/net/JobResult.h
|
2017-06-04 17:52:21 +00:00
|
|
|
src/net/Network.h
|
2019-03-29 20:10:27 +00:00
|
|
|
src/net/NetworkState.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
|
2018-04-01 15:49:21 +00:00
|
|
|
src/workers/CpuThread.h
|
2017-06-15 18:00:25 +00:00
|
|
|
src/workers/Hashrate.h
|
2018-04-14 15:14:57 +00:00
|
|
|
src/workers/MultiWorker.h
|
2019-03-29 20:10:27 +00:00
|
|
|
src/workers/ThreadHandle.h
|
2017-06-10 04:05:00 +00:00
|
|
|
src/workers/Worker.h
|
2017-06-10 06:41:08 +00:00
|
|
|
src/workers/Workers.h
|
2017-04-15 06:02:08 +00:00
|
|
|
)
|
|
|
|
|
2017-06-08 01:20:10 +00:00
|
|
|
set(HEADERS_CRYPTO
|
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
|
|
|
|
src/crypto/cn/CryptoNight_constants.h
|
|
|
|
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-06-09 09:46:44 +00:00
|
|
|
src/crypto/common/Algorithm.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}"
|
2017-06-04 17:52:21 +00:00
|
|
|
src/App.cpp
|
2018-04-20 07:45:51 +00:00
|
|
|
src/common/crypto/keccak.cpp
|
2018-04-13 00:23:01 +00:00
|
|
|
src/common/Platform.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
|
2017-06-09 12:09:21 +00:00
|
|
|
src/Mem.cpp
|
2017-06-04 17:52:21 +00:00
|
|
|
src/net/Network.cpp
|
2019-03-29 20:10:27 +00:00
|
|
|
src/net/NetworkState.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
|
2018-04-01 15:49:21 +00:00
|
|
|
src/workers/CpuThread.cpp
|
2017-06-15 18:00:25 +00:00
|
|
|
src/workers/Hashrate.cpp
|
2018-04-14 15:14:57 +00:00
|
|
|
src/workers/MultiWorker.cpp
|
2019-03-29 20:10:27 +00:00
|
|
|
src/workers/ThreadHandle.cpp
|
2017-06-10 04:05:00 +00:00
|
|
|
src/workers/Worker.cpp
|
2017-06-10 06:41:08 +00:00
|
|
|
src/workers/Workers.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_groestl.c
|
|
|
|
src/crypto/cn/c_blake256.c
|
|
|
|
src/crypto/cn/c_jh.c
|
|
|
|
src/crypto/cn/c_skein.c
|
2019-06-09 09:46:44 +00:00
|
|
|
src/crypto/common/Algorithm.cpp
|
2017-06-08 01:20:10 +00:00
|
|
|
)
|
|
|
|
|
2017-04-15 06:02:08 +00:00
|
|
|
if (WIN32)
|
2017-06-04 17:52:21 +00:00
|
|
|
set(SOURCES_OS
|
2019-03-15 19:07:26 +00:00
|
|
|
"${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
|
2018-04-13 00:23:01 +00:00
|
|
|
src/common/Platform_win.cpp
|
2017-06-09 12:09:21 +00:00
|
|
|
src/Mem_win.cpp
|
2019-06-02 12:43:56 +00:00
|
|
|
src/crypto/common/VirtualMemory_win.cpp
|
2017-06-04 17:52:21 +00:00
|
|
|
)
|
|
|
|
|
2017-06-14 18:33:20 +00:00
|
|
|
add_definitions(/DWIN32)
|
2017-06-04 17:52:21 +00:00
|
|
|
set(EXTRA_LIBS ws2_32 psapi iphlpapi userenv)
|
2017-06-14 16:13:02 +00:00
|
|
|
elseif (APPLE)
|
|
|
|
set(SOURCES_OS
|
2019-03-15 19:07:26 +00:00
|
|
|
"${SOURCES_OS}"
|
2017-06-14 16:13:02 +00:00
|
|
|
src/App_unix.cpp
|
2018-04-13 00:23:01 +00:00
|
|
|
src/common/Platform_mac.cpp
|
2017-06-14 16:13:02 +00:00
|
|
|
src/Mem_unix.cpp
|
2019-06-02 12:43:56 +00:00
|
|
|
src/crypto/common/VirtualMemory_unix.cpp
|
2017-06-14 16:13:02 +00:00
|
|
|
)
|
2017-04-15 06:02:08 +00:00
|
|
|
else()
|
2017-06-14 16:13:02 +00:00
|
|
|
set(SOURCES_OS
|
2019-03-15 19:07:26 +00:00
|
|
|
"${SOURCES_OS}"
|
2017-06-14 16:13:02 +00:00
|
|
|
src/App_unix.cpp
|
2018-04-13 00:23:01 +00:00
|
|
|
src/common/Platform_unix.cpp
|
2019-06-02 12:58:16 +00:00
|
|
|
src/Mem_unix.cpp
|
2019-06-02 12:43:56 +00:00
|
|
|
src/crypto/common/VirtualMemory_unix.cpp
|
2017-06-14 16:13:02 +00:00
|
|
|
)
|
|
|
|
|
2018-10-24 02:55:40 +00:00
|
|
|
if (CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
|
2019-01-16 09:55:45 +00:00
|
|
|
set(EXTRA_LIBS kvm pthread)
|
2018-10-24 02:55:40 +00:00
|
|
|
else()
|
|
|
|
set(EXTRA_LIBS pthread rt dl)
|
|
|
|
endif()
|
2017-10-20 16:54:18 +00:00
|
|
|
endif()
|
|
|
|
|
2017-11-23 21:23:04 +00: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-29 20:41:57 +00:00
|
|
|
add_definitions(/D__STDC_FORMAT_MACROS)
|
2017-05-05 12:49:38 +00:00
|
|
|
add_definitions(/DUNICODE)
|
2017-04-15 06:02:08 +00:00
|
|
|
|
2017-06-04 17:52:21 +00:00
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
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)
|
2017-04-15 06:02:08 +00:00
|
|
|
|
2017-06-07 21:10:26 +00:00
|
|
|
if (WITH_LIBCPUID)
|
2017-06-07 22:51:24 +00:00
|
|
|
add_subdirectory(src/3rdparty/libcpuid)
|
2017-06-07 21:10:26 +00:00
|
|
|
|
2017-06-07 22:51:24 +00:00
|
|
|
include_directories(src/3rdparty/libcpuid)
|
|
|
|
set(CPUID_LIB cpuid)
|
2018-09-23 14:51:56 +00:00
|
|
|
set(SOURCES_CPUID src/core/cpu/AdvancedCpuInfo.h src/core/cpu/AdvancedCpuInfo.cpp src/core/cpu/Cpu.cpp)
|
2017-06-07 21:10:26 +00:00
|
|
|
else()
|
|
|
|
add_definitions(/DXMRIG_NO_LIBCPUID)
|
2018-09-23 14:51:56 +00:00
|
|
|
set(SOURCES_CPUID src/common/cpu/BasicCpuInfo.h src/common/cpu/Cpu.cpp)
|
2017-11-06 00:11:35 +00:00
|
|
|
|
2017-11-26 19:23:23 +00:00
|
|
|
if (XMRIG_ARM)
|
2018-09-23 14:51:56 +00:00
|
|
|
set(SOURCES_CPUID ${SOURCES_CPUID} src/common/cpu/BasicCpuInfo_arm.cpp)
|
2017-11-06 00:11:35 +00:00
|
|
|
else()
|
2018-09-23 14:51:56 +00:00
|
|
|
set(SOURCES_CPUID ${SOURCES_CPUID} src/common/cpu/BasicCpuInfo.cpp)
|
2017-11-06 00:11:35 +00:00
|
|
|
endif()
|
2017-06-07 21:10:26 +00:00
|
|
|
endif()
|
|
|
|
|
2018-09-16 00:06:54 +00:00
|
|
|
include(cmake/OpenSSL.cmake)
|
2018-09-23 17:16:33 +00:00
|
|
|
include(cmake/asm.cmake)
|
2019-02-03 07:44:23 +00:00
|
|
|
include(cmake/cn-gpu.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()
|
|
|
|
|
2019-03-02 06:12:38 +00:00
|
|
|
if (WITH_EMBEDDED_CONFIG)
|
|
|
|
add_definitions(/DXMRIG_FEATURE_EMBEDDED_CONFIG)
|
|
|
|
endif()
|
|
|
|
|
2019-04-08 19:27:19 +00:00
|
|
|
if (WITH_HTTP)
|
|
|
|
set(HTTP_SOURCES
|
2019-03-30 18:31:40 +00:00
|
|
|
src/api/Api.cpp
|
2019-03-29 17:16:01 +00:00
|
|
|
src/api/Api.h
|
2019-03-30 18:31:40 +00:00
|
|
|
src/api/Httpd.cpp
|
|
|
|
src/api/Httpd.h
|
2019-03-29 19:26:30 +00:00
|
|
|
src/api/interfaces/IApiRequest.h
|
|
|
|
src/api/requests/ApiRequest.cpp
|
2019-03-30 18:31:40 +00:00
|
|
|
src/api/requests/ApiRequest.h
|
2019-03-29 19:26:30 +00:00
|
|
|
src/api/requests/HttpApiRequest.cpp
|
2019-03-30 18:31:40 +00:00
|
|
|
src/api/requests/HttpApiRequest.h
|
|
|
|
src/api/v1/ApiRouter.cpp
|
|
|
|
src/api/v1/ApiRouter.h
|
2019-03-29 05:33:11 +00:00
|
|
|
)
|
2017-08-30 23:28:33 +00:00
|
|
|
else()
|
2019-04-08 19:27:19 +00:00
|
|
|
set(HTTP_SOURCES "")
|
2017-08-30 23:28:33 +00:00
|
|
|
endif()
|
|
|
|
|
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-03-12 20:03:04 +00:00
|
|
|
if (BUILD_STATIC)
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS " -static")
|
|
|
|
endif()
|
|
|
|
|
2018-09-02 22:26:19 +00:00
|
|
|
if (WITH_DEBUG_LOG)
|
|
|
|
add_definitions(/DAPP_DEBUG)
|
|
|
|
endif()
|
|
|
|
|
2019-04-08 19:27:19 +00:00
|
|
|
add_executable(${CMAKE_PROJECT_NAME} ${HEADERS} ${SOURCES} ${SOURCES_OS} ${SOURCES_CPUID} ${HEADERS_CRYPTO} ${SOURCES_CRYPTO} ${SOURCES_SYSLOG} ${HTTP_SOURCES} ${TLS_SOURCES} ${XMRIG_ASM_SOURCES} ${CN_GPU_SOURCES})
|
2019-03-29 05:33:11 +00:00
|
|
|
target_link_libraries(${CMAKE_PROJECT_NAME} ${XMRIG_ASM_LIBRARY} ${OPENSSL_LIBRARIES} ${UV_LIBRARIES} ${EXTRA_LIBS} ${CPUID_LIB})
|