rig/CMakeLists.txt

208 lines
5.0 KiB
CMake
Raw Normal View History

2017-04-15 09:02:08 +03:00
cmake_minimum_required(VERSION 3.0)
2017-06-04 20:52:21 +03:00
project(xmrig)
2017-06-08 00:10:26 +03:00
option(WITH_LIBCPUID "Use Libcpuid" ON)
option(WITH_AEON "CryptoNight-Lite support" ON)
option(WITH_HTTPD "HTTP REST API" ON)
2017-06-25 02:04:59 +03:00
include (CheckIncludeFile)
2017-11-06 03:11:35 +03:00
include (cmake/cpu.cmake)
2017-06-25 02:04:59 +03:00
2017-04-15 09:02:08 +03:00
set(HEADERS
2017-06-12 16:19:07 +03:00
src/3rdparty/align.h
2017-08-31 04:30:59 +03:00
src/api/Api.h
src/api/ApiState.h
2017-09-01 15:35:00 +03:00
src/api/NetworkState.h
2017-06-04 20:52:21 +03:00
src/App.h
2017-07-23 08:35:26 +03:00
src/Console.h
2017-06-09 15:09:21 +03:00
src/Cpu.h
2017-06-04 20:52:21 +03:00
src/interfaces/IClientListener.h
2017-07-23 09:36:30 +03:00
src/interfaces/IConsoleListener.h
2017-06-11 15:32:15 +03:00
src/interfaces/IJobResultListener.h
src/interfaces/ILogBackend.h
src/interfaces/IStrategy.h
src/interfaces/IStrategyListener.h
src/interfaces/IWorker.h
src/log/ConsoleLog.h
2017-06-23 01:38:47 +03:00
src/log/FileLog.h
2017-06-20 13:04:38 +03:00
src/log/Log.h
2017-06-09 15:09:21 +03:00
src/Mem.h
2017-06-04 20:52:21 +03:00
src/net/Client.h
2017-06-06 20:43:52 +03:00
src/net/Job.h
src/net/JobId.h
2017-06-11 10:58:46 +03:00
src/net/JobResult.h
2017-06-04 20:52:21 +03:00
src/net/Network.h
src/net/strategies/DonateStrategy.h
2017-07-01 20:53:42 +03:00
src/net/strategies/FailoverStrategy.h
src/net/strategies/SinglePoolStrategy.h
2017-08-15 03:04:46 +03:00
src/net/SubmitResult.h
src/net/Url.h
2017-06-04 20:52:21 +03:00
src/Options.h
2017-08-15 03:04:46 +03:00
src/Platform.h
2017-06-08 01:16:45 +03:00
src/Summary.h
2017-06-12 16:19:07 +03:00
src/version.h
2017-06-13 19:58:31 +03:00
src/workers/DoubleWorker.h
src/workers/Handle.h
2017-06-15 21:00:25 +03:00
src/workers/Hashrate.h
src/workers/SingleWorker.h
src/workers/Worker.h
2017-06-10 09:41:08 +03:00
src/workers/Workers.h
2017-04-15 09:02:08 +03:00
)
2017-06-08 04:20:10 +03: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 09:47:25 +03:00
src/crypto/CryptoNight.h
src/crypto/CryptoNight_test.h
2017-06-08 04:20:10 +03:00
src/crypto/groestl_tables.h
src/crypto/hash.h
src/crypto/skein_port.h
2017-11-03 05:35:29 +03:00
src/crypto/soft_aes.h
2017-06-08 04:20:10 +03:00
)
2017-11-06 03:11:35 +03:00
if (XMRIG_ARM64)
set(HEADERS_CRYPTO "${HEADERS_CRYPTO}" src/crypto/CryptoNight_arm64.h)
else()
set(HEADERS_CRYPTO "${HEADERS_CRYPTO}" src/crypto/CryptoNight_x86.h)
endif()
2017-04-15 09:02:08 +03:00
set(SOURCES
2017-08-31 04:30:59 +03:00
src/api/Api.cpp
src/api/ApiState.cpp
2017-09-01 15:35:00 +03:00
src/api/NetworkState.cpp
2017-06-04 20:52:21 +03:00
src/App.cpp
2017-07-23 08:35:26 +03:00
src/Console.cpp
src/log/ConsoleLog.cpp
2017-06-23 01:38:47 +03:00
src/log/FileLog.cpp
2017-06-20 13:04:38 +03:00
src/log/Log.cpp
2017-06-09 15:09:21 +03:00
src/Mem.cpp
2017-06-04 20:52:21 +03:00
src/net/Client.cpp
2017-06-06 20:43:52 +03:00
src/net/Job.cpp
2017-06-04 20:52:21 +03:00
src/net/Network.cpp
src/net/strategies/DonateStrategy.cpp
2017-07-01 20:53:42 +03:00
src/net/strategies/FailoverStrategy.cpp
src/net/strategies/SinglePoolStrategy.cpp
2017-09-01 08:02:56 +03:00
src/net/SubmitResult.cpp
2017-07-23 08:35:26 +03:00
src/net/Url.cpp
2017-06-04 20:52:21 +03:00
src/Options.cpp
2017-08-15 03:04:46 +03:00
src/Platform.cpp
2017-06-08 01:16:45 +03:00
src/Summary.cpp
2017-06-13 19:58:31 +03:00
src/workers/DoubleWorker.cpp
src/workers/Handle.cpp
2017-06-15 21:00:25 +03:00
src/workers/Hashrate.cpp
src/workers/SingleWorker.cpp
src/workers/Worker.cpp
2017-06-10 09:41:08 +03:00
src/workers/Workers.cpp
2017-06-04 20:52:21 +03:00
src/xmrig.cpp
2017-04-15 09:02:08 +03:00
)
2017-06-08 04:20:10 +03: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-06-08 09:47:25 +03:00
src/crypto/CryptoNight.cpp
2017-06-08 04:20:10 +03:00
)
2017-04-15 09:02:08 +03:00
if (WIN32)
2017-06-04 20:52:21 +03:00
set(SOURCES_OS
res/app.rc
2017-06-13 13:20:15 +03:00
src/App_win.cpp
2017-06-08 00:10:26 +03:00
src/Cpu_win.cpp
2017-06-09 15:09:21 +03:00
src/Mem_win.cpp
2017-08-15 03:04:46 +03:00
src/Platform_win.cpp
2017-06-04 20:52:21 +03:00
)
2017-06-14 21:33:20 +03:00
add_definitions(/DWIN32)
2017-06-04 20:52:21 +03:00
set(EXTRA_LIBS ws2_32 psapi iphlpapi userenv)
2017-06-14 19:13:02 +03:00
elseif (APPLE)
set(SOURCES_OS
src/App_unix.cpp
2017-06-14 20:51:47 +03:00
src/Cpu_mac.cpp
2017-06-14 19:13:02 +03:00
src/Mem_unix.cpp
2017-08-15 03:04:46 +03:00
src/Platform_mac.cpp
2017-06-14 19:13:02 +03:00
)
2017-04-15 09:02:08 +03:00
else()
2017-06-14 19:13:02 +03:00
set(SOURCES_OS
src/App_unix.cpp
src/Cpu_unix.cpp
src/Mem_unix.cpp
2017-08-15 03:04:46 +03:00
src/Platform_unix.cpp
2017-06-14 19:13:02 +03:00
)
set(EXTRA_LIBS pthread rt)
2017-04-15 09:02:08 +03:00
endif()
if (CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
set(EXTRA_LIBS ${EXTRA_LIBS} kvm)
endif()
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()
add_definitions(/D__STDC_FORMAT_MACROS)
add_definitions(/DUNICODE)
2017-07-02 01:36:33 +03:00
#add_definitions(/DAPP_DEBUG)
2017-04-15 09:02:08 +03:00
2017-06-04 20:52:21 +03:00
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
2017-04-15 09:02:08 +03:00
2017-06-04 20:52:21 +03:00
find_package(UV REQUIRED)
2017-05-27 10:34:42 +03:00
2017-11-06 03:11:35 +03:00
include(cmake/flags.cmake)
2017-04-15 09:02:08 +03:00
2017-06-08 00:10:26 +03:00
if (WITH_LIBCPUID)
2017-06-08 01:51:24 +03:00
add_subdirectory(src/3rdparty/libcpuid)
2017-06-08 00:10:26 +03:00
2017-06-08 01:51:24 +03:00
include_directories(src/3rdparty/libcpuid)
set(CPUID_LIB cpuid)
set(SOURCES_CPUID src/Cpu.cpp)
2017-06-08 00:10:26 +03:00
else()
add_definitions(/DXMRIG_NO_LIBCPUID)
2017-11-06 03:11:35 +03:00
if (XMRIG_ARM64)
set(SOURCES_CPUID src/Cpu_arm.cpp)
else()
set(SOURCES_CPUID src/Cpu_stub.cpp)
endif()
2017-06-08 00:10:26 +03:00
endif()
2017-06-25 02:04:59 +03: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 19:04:40 +03:00
if (NOT WITH_AEON)
add_definitions(/DXMRIG_NO_AEON)
endif()
if (WITH_HTTPD)
find_package(MHD)
if (MHD_FOUND)
include_directories(${MHD_INCLUDE_DIRS})
set(HTTPD_SOURCES src/api/Httpd.h src/api/Httpd.cpp)
else()
message(FATAL_ERROR "microhttpd NOT found: use `-DWITH_HTTPD=OFF` to build without http deamon support")
endif()
else()
add_definitions(/DXMRIG_NO_HTTPD)
2017-09-02 15:50:27 +03:00
add_definitions(/DXMRIG_NO_API)
endif()
2017-06-04 20:52:21 +03:00
include_directories(src)
include_directories(src/3rdparty)
include_directories(${UV_INCLUDE_DIR})
2017-05-10 12:58:52 +03:00
add_executable(xmrig ${HEADERS} ${SOURCES} ${SOURCES_OS} ${SOURCES_CPUID} ${HEADERS_CRYPTO} ${SOURCES_CRYPTO} ${SOURCES_SYSLOG} ${HTTPD_SOURCES})
target_link_libraries(xmrig ${UV_LIBRARIES} ${MHD_LIBRARY} ${EXTRA_LIBS} ${CPUID_LIB})