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
|
|
|
|
2017-06-07 21:10:26 +00:00
|
|
|
option(WITH_LIBCPUID "Use Libcpuid" ON)
|
|
|
|
option(WITH_AEON "CryptoNight-Lite support" ON)
|
2018-04-02 19:55:28 +00:00
|
|
|
option(WITH_SUMO "CryptoNight-Heavy support" ON)
|
2017-08-30 23:28:33 +00:00
|
|
|
option(WITH_HTTPD "HTTP REST API" ON)
|
2018-03-12 20:03:04 +00:00
|
|
|
option(BUILD_STATIC "Build static binary" OFF)
|
2017-06-24 23:04:59 +00:00
|
|
|
|
|
|
|
include (CheckIncludeFile)
|
2017-11-06 00:11:35 +00:00
|
|
|
include (cmake/cpu.cmake)
|
2017-06-24 23:04:59 +00:00
|
|
|
|
|
|
|
|
2017-04-15 06:02:08 +00:00
|
|
|
set(HEADERS
|
2017-08-31 01:30:59 +00:00
|
|
|
src/api/Api.h
|
2017-09-01 12:35:00 +00:00
|
|
|
src/api/NetworkState.h
|
2017-06-04 17:52:21 +00:00
|
|
|
src/App.h
|
2017-07-23 05:35:26 +00:00
|
|
|
src/Console.h
|
2018-03-31 06:48:06 +00:00
|
|
|
src/core/CommonConfig.h
|
|
|
|
src/core/Config.cpp
|
|
|
|
src/core/ConfigLoader.cpp
|
|
|
|
src/core/ConfigLoader.h
|
|
|
|
src/core/ConfigLoader_platform.h
|
|
|
|
src/core/ConfigWatcher.cpp
|
2018-03-27 07:01:38 +00:00
|
|
|
src/core/Controller.h
|
2017-06-09 12:09:21 +00:00
|
|
|
src/Cpu.h
|
2017-06-04 17:52:21 +00:00
|
|
|
src/interfaces/IClientListener.h
|
2018-03-31 06:48:06 +00:00
|
|
|
src/interfaces/IConfig.h
|
|
|
|
src/interfaces/IConfigCreator.h
|
2017-07-23 06:36:30 +00:00
|
|
|
src/interfaces/IConsoleListener.h
|
2018-03-27 07:01:38 +00:00
|
|
|
src/interfaces/IControllerListener.h
|
2017-06-11 12:32:15 +00:00
|
|
|
src/interfaces/IJobResultListener.h
|
2017-06-22 11:41:34 +00:00
|
|
|
src/interfaces/ILogBackend.h
|
2017-06-28 03:17:02 +00:00
|
|
|
src/interfaces/IStrategy.h
|
|
|
|
src/interfaces/IStrategyListener.h
|
2018-04-01 15:49:21 +00:00
|
|
|
src/interfaces/IThread.h
|
2018-03-27 07:01:38 +00:00
|
|
|
src/interfaces/IWatcherListener.h
|
2017-06-10 04:05:00 +00:00
|
|
|
src/interfaces/IWorker.h
|
2017-06-22 11:41:34 +00:00
|
|
|
src/log/ConsoleLog.h
|
2017-06-22 22:38:47 +00:00
|
|
|
src/log/FileLog.h
|
2017-06-20 10:04:38 +00:00
|
|
|
src/log/Log.h
|
2017-06-09 12:09:21 +00:00
|
|
|
src/Mem.h
|
2017-06-04 17:52:21 +00:00
|
|
|
src/net/Client.h
|
2018-03-07 09:38:58 +00:00
|
|
|
src/net/Id.h
|
2017-06-06 17:43:52 +00:00
|
|
|
src/net/Job.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
|
2018-03-31 11:12:52 +00:00
|
|
|
src/net/Storage.h
|
2017-06-28 03:17:02 +00:00
|
|
|
src/net/strategies/DonateStrategy.h
|
2017-07-01 17:53:42 +00:00
|
|
|
src/net/strategies/FailoverStrategy.h
|
2017-06-28 03:17:02 +00:00
|
|
|
src/net/strategies/SinglePoolStrategy.h
|
2017-08-15 00:04:46 +00:00
|
|
|
src/net/SubmitResult.h
|
|
|
|
src/net/Url.h
|
|
|
|
src/Platform.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-13 16:58:31 +00:00
|
|
|
src/workers/DoubleWorker.h
|
2017-06-10 04:05:00 +00:00
|
|
|
src/workers/Handle.h
|
2017-06-15 18:00:25 +00:00
|
|
|
src/workers/Hashrate.h
|
2017-06-10 04:05:00 +00:00
|
|
|
src/workers/SingleWorker.h
|
|
|
|
src/workers/Worker.h
|
2017-06-10 06:41:08 +00:00
|
|
|
src/workers/Workers.h
|
2018-03-12 15:29:44 +00:00
|
|
|
src/xmrig.h
|
2017-04-15 06:02:08 +00:00
|
|
|
)
|
|
|
|
|
2017-06-08 01:20:10 +00:00
|
|
|
set(HEADERS_CRYPTO
|
|
|
|
src/crypto/c_blake256.h
|
|
|
|
src/crypto/c_groestl.h
|
|
|
|
src/crypto/c_jh.h
|
|
|
|
src/crypto/c_keccak.h
|
|
|
|
src/crypto/c_skein.h
|
2017-06-08 06:47:25 +00:00
|
|
|
src/crypto/CryptoNight.h
|
2018-04-02 19:55:28 +00:00
|
|
|
src/crypto/CryptoNight_constants.h
|
2018-03-06 14:34:20 +00:00
|
|
|
src/crypto/CryptoNight_monero.h
|
2017-06-08 20:31:42 +00:00
|
|
|
src/crypto/CryptoNight_test.h
|
2017-06-08 01:20:10 +00:00
|
|
|
src/crypto/groestl_tables.h
|
|
|
|
src/crypto/hash.h
|
|
|
|
src/crypto/skein_port.h
|
2017-11-03 02:35:29 +00:00
|
|
|
src/crypto/soft_aes.h
|
2017-06-08 01:20:10 +00:00
|
|
|
)
|
|
|
|
|
2017-11-26 19:23:23 +00:00
|
|
|
if (XMRIG_ARM)
|
|
|
|
set(HEADERS_CRYPTO "${HEADERS_CRYPTO}" src/crypto/CryptoNight_arm.h)
|
2017-11-06 00:11:35 +00:00
|
|
|
else()
|
|
|
|
set(HEADERS_CRYPTO "${HEADERS_CRYPTO}" src/crypto/CryptoNight_x86.h)
|
|
|
|
endif()
|
|
|
|
|
2017-04-15 06:02:08 +00:00
|
|
|
set(SOURCES
|
2017-08-31 01:30:59 +00:00
|
|
|
src/api/Api.cpp
|
2017-09-01 12:35:00 +00:00
|
|
|
src/api/NetworkState.cpp
|
2017-06-04 17:52:21 +00:00
|
|
|
src/App.cpp
|
2017-07-23 05:35:26 +00:00
|
|
|
src/Console.cpp
|
2018-03-31 06:48:06 +00:00
|
|
|
src/core/CommonConfig.cpp
|
|
|
|
src/core/Config.cpp
|
|
|
|
src/core/ConfigLoader.cpp
|
|
|
|
src/core/ConfigWatcher.cpp
|
2018-03-27 07:01:38 +00:00
|
|
|
src/core/Controller.cpp
|
2017-06-22 11:41:34 +00:00
|
|
|
src/log/ConsoleLog.cpp
|
2017-06-22 22:38:47 +00:00
|
|
|
src/log/FileLog.cpp
|
2017-06-20 10:04:38 +00:00
|
|
|
src/log/Log.cpp
|
2017-06-09 12:09:21 +00:00
|
|
|
src/Mem.cpp
|
2017-06-04 17:52:21 +00:00
|
|
|
src/net/Client.cpp
|
2017-06-06 17:43:52 +00:00
|
|
|
src/net/Job.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-07-01 17:53:42 +00:00
|
|
|
src/net/strategies/FailoverStrategy.cpp
|
2017-06-28 03:17:02 +00:00
|
|
|
src/net/strategies/SinglePoolStrategy.cpp
|
2017-09-01 05:02:56 +00:00
|
|
|
src/net/SubmitResult.cpp
|
2017-07-23 05:35:26 +00:00
|
|
|
src/net/Url.cpp
|
2017-08-15 00:04:46 +00:00
|
|
|
src/Platform.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-13 16:58:31 +00:00
|
|
|
src/workers/DoubleWorker.cpp
|
2017-06-10 04:05:00 +00:00
|
|
|
src/workers/Handle.cpp
|
2017-06-15 18:00:25 +00:00
|
|
|
src/workers/Hashrate.cpp
|
2017-06-10 04:05:00 +00:00
|
|
|
src/workers/SingleWorker.cpp
|
|
|
|
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
|
|
|
|
src/crypto/c_keccak.c
|
|
|
|
src/crypto/c_groestl.c
|
|
|
|
src/crypto/c_blake256.c
|
|
|
|
src/crypto/c_jh.c
|
|
|
|
src/crypto/c_skein.c
|
|
|
|
)
|
|
|
|
|
2017-04-15 06:02:08 +00:00
|
|
|
if (WIN32)
|
2017-06-04 17:52:21 +00:00
|
|
|
set(SOURCES_OS
|
|
|
|
res/app.rc
|
2017-06-13 10:20:15 +00:00
|
|
|
src/App_win.cpp
|
2017-06-07 21:10:26 +00:00
|
|
|
src/Cpu_win.cpp
|
2017-06-09 12:09:21 +00:00
|
|
|
src/Mem_win.cpp
|
2017-08-15 00:04:46 +00:00
|
|
|
src/Platform_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
|
|
|
|
src/App_unix.cpp
|
2017-06-14 17:51:47 +00:00
|
|
|
src/Cpu_mac.cpp
|
2017-06-14 16:13:02 +00:00
|
|
|
src/Mem_unix.cpp
|
2017-08-15 00:04:46 +00:00
|
|
|
src/Platform_mac.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
|
|
|
|
src/App_unix.cpp
|
|
|
|
src/Cpu_unix.cpp
|
|
|
|
src/Mem_unix.cpp
|
2017-08-15 00:04:46 +00:00
|
|
|
src/Platform_unix.cpp
|
2017-06-14 16:13:02 +00:00
|
|
|
)
|
|
|
|
|
2017-10-29 21:48:49 +00:00
|
|
|
set(EXTRA_LIBS pthread rt)
|
2017-04-15 06:02:08 +00:00
|
|
|
endif()
|
|
|
|
|
2017-10-20 16:54:18 +00:00
|
|
|
if (CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
|
|
|
|
set(EXTRA_LIBS ${EXTRA_LIBS} kvm)
|
|
|
|
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-07-01 22:36:33 +00:00
|
|
|
#add_definitions(/DAPP_DEBUG)
|
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)
|
|
|
|
set(SOURCES_CPUID src/Cpu.cpp)
|
2017-06-07 21:10:26 +00:00
|
|
|
else()
|
|
|
|
add_definitions(/DXMRIG_NO_LIBCPUID)
|
2017-11-06 00:11:35 +00:00
|
|
|
|
2017-11-26 19:23:23 +00:00
|
|
|
if (XMRIG_ARM)
|
2017-11-06 00:11:35 +00:00
|
|
|
set(SOURCES_CPUID src/Cpu_arm.cpp)
|
|
|
|
else()
|
|
|
|
set(SOURCES_CPUID src/Cpu_stub.cpp)
|
|
|
|
endif()
|
2017-06-07 21:10:26 +00:00
|
|
|
endif()
|
|
|
|
|
2017-06-24 23:04:59 +00:00
|
|
|
CHECK_INCLUDE_FILE (syslog.h HAVE_SYSLOG_H)
|
|
|
|
if (HAVE_SYSLOG_H)
|
|
|
|
add_definitions(/DHAVE_SYSLOG_H)
|
|
|
|
set(SOURCES_SYSLOG src/log/SysLog.h src/log/SysLog.cpp)
|
|
|
|
endif()
|
|
|
|
|
2017-09-02 16:04:40 +00:00
|
|
|
if (NOT WITH_AEON)
|
|
|
|
add_definitions(/DXMRIG_NO_AEON)
|
|
|
|
endif()
|
|
|
|
|
2018-04-02 19:55:28 +00:00
|
|
|
if (NOT WITH_SUMO)
|
|
|
|
add_definitions(/DXMRIG_NO_SUMO)
|
|
|
|
endif()
|
|
|
|
|
2017-10-04 20:33:30 +00:00
|
|
|
if (WITH_HTTPD)
|
|
|
|
find_package(MHD)
|
2017-08-30 23:28:33 +00:00
|
|
|
|
2017-10-04 20:33:30 +00:00
|
|
|
if (MHD_FOUND)
|
|
|
|
include_directories(${MHD_INCLUDE_DIRS})
|
2018-03-27 07:01:38 +00:00
|
|
|
set(HTTPD_SOURCES
|
|
|
|
src/api/ApiRouter.h
|
|
|
|
src/api/HttpBody.h
|
|
|
|
src/api/Httpd.h
|
|
|
|
src/api/HttpReply.h
|
|
|
|
src/api/HttpRequest.h
|
|
|
|
src/api/ApiRouter.cpp
|
|
|
|
src/api/Httpd.cpp
|
|
|
|
src/api/HttpRequest.cpp
|
|
|
|
)
|
2017-10-04 20:33:30 +00:00
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "microhttpd NOT found: use `-DWITH_HTTPD=OFF` to build without http deamon support")
|
|
|
|
endif()
|
2017-08-30 23:28:33 +00:00
|
|
|
else()
|
2018-01-06 09:07:07 +00:00
|
|
|
set(MHD_LIBRARY "")
|
2017-08-30 23:28:33 +00:00
|
|
|
add_definitions(/DXMRIG_NO_HTTPD)
|
2017-09-02 12:50:27 +00:00
|
|
|
add_definitions(/DXMRIG_NO_API)
|
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()
|
|
|
|
|
2017-08-30 23:28:33 +00:00
|
|
|
add_executable(xmrig ${HEADERS} ${SOURCES} ${SOURCES_OS} ${SOURCES_CPUID} ${HEADERS_CRYPTO} ${SOURCES_CRYPTO} ${SOURCES_SYSLOG} ${HTTPD_SOURCES})
|
2017-10-04 20:33:30 +00:00
|
|
|
target_link_libraries(xmrig ${UV_LIBRARIES} ${MHD_LIBRARY} ${EXTRA_LIBS} ${CPUID_LIB})
|