rig/CMakeLists.txt

237 lines
6.4 KiB
CMake
Raw Normal View History

cmake_minimum_required(VERSION 2.8)
2017-06-04 20:52:21 +03:00
project(xmrig)
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_HTTP "HTTP protocol support (client/server)" 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 02:04:59 +03:00
include (CheckIncludeFile)
2017-11-06 03:11:35 +03:00
include (cmake/cpu.cmake)
2019-03-16 02:07:26 +07:00
include (src/base/base.cmake)
2017-06-25 02:04:59 +03:00
2017-04-15 09:02:08 +03:00
set(HEADERS
2019-03-16 02:07:26 +07:00
"${HEADERS_BASE}"
2019-03-29 02:31:56 +07:00
"${HEADERS_BASE_HTTP}"
2019-03-30 03:10:27 +07:00
src/api/interfaces/IApiListener.h
2017-06-04 20:52:21 +03:00
src/App.h
src/common/cpu/Cpu.h
2018-04-25 14:48:32 +07:00
src/common/crypto/Algorithm.h
2018-04-20 14:45:51 +07:00
src/common/crypto/keccak.h
src/common/interfaces/ICpuInfo.h
2018-04-13 07:23:01 +07:00
src/common/Platform.h
2018-04-13 07:00:51 +07:00
src/common/xmrig.h
2019-04-05 22:14:01 +07:00
src/core/config/Config_default.h
src/core/config/Config_platform.h
2019-04-06 18:32:24 +07:00
src/core/config/Config.h
src/core/config/ConfigTransform.h
src/core/config/usage.h
2018-03-27 14:01:38 +07:00
src/core/Controller.h
2017-06-11 15:32:15 +03:00
src/interfaces/IJobResultListener.h
src/interfaces/IThread.h
src/interfaces/IWorker.h
2017-06-09 15:09:21 +03:00
src/Mem.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
2019-03-30 03:10:27 +07:00
src/net/NetworkState.h
src/net/strategies/DonateStrategy.h
2017-06-08 01:16:45 +03:00
src/Summary.h
2017-06-12 16:19:07 +03:00
src/version.h
src/workers/CpuThread.h
2017-06-15 21:00:25 +03:00
src/workers/Hashrate.h
src/workers/MultiWorker.h
2019-03-30 03:10:27 +07:00
src/workers/ThreadHandle.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
2019-06-02 20:57:49 +07:00
src/crypto/asm/CryptonightR_template.h
2017-06-08 04:20:10 +03:00
src/crypto/c_blake256.h
src/crypto/c_groestl.h
src/crypto/c_jh.h
src/crypto/c_skein.h
2019-06-02 20:57:49 +07:00
src/crypto/common/portable/mm_malloc.h
src/crypto/common/VirtualMemory.h
2018-04-03 02:55:28 +07:00
src/crypto/CryptoNight_constants.h
2018-03-06 21:34:20 +07:00
src/crypto/CryptoNight_monero.h
src/crypto/CryptoNight_test.h
2019-06-02 20:57:49 +07:00
src/crypto/CryptoNight.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-26 22:23:23 +03:00
if (XMRIG_ARM)
set(HEADERS_CRYPTO "${HEADERS_CRYPTO}" src/crypto/CryptoNight_arm.h)
2017-11-06 03:11:35 +03:00
else()
set(HEADERS_CRYPTO "${HEADERS_CRYPTO}" src/crypto/CryptoNight_x86.h)
endif()
2017-04-15 09:02:08 +03:00
set(SOURCES
2019-03-16 02:07:26 +07:00
"${SOURCES_BASE}"
2019-03-29 02:31:56 +07:00
"${SOURCES_BASE_HTTP}"
2017-06-04 20:52:21 +03:00
src/App.cpp
2018-04-25 14:48:32 +07:00
src/common/crypto/Algorithm.cpp
2018-04-20 14:45:51 +07:00
src/common/crypto/keccak.cpp
2018-04-13 07:23:01 +07:00
src/common/Platform.cpp
src/core/config/Config.cpp
2019-04-05 22:14:01 +07:00
src/core/config/ConfigTransform.cpp
2018-03-27 14:01:38 +07:00
src/core/Controller.cpp
2017-06-09 15:09:21 +03:00
src/Mem.cpp
2017-06-04 20:52:21 +03:00
src/net/Network.cpp
2019-03-30 03:10:27 +07:00
src/net/NetworkState.cpp
src/net/strategies/DonateStrategy.cpp
2017-06-08 01:16:45 +03:00
src/Summary.cpp
src/workers/CpuThread.cpp
2017-06-15 21:00:25 +03:00
src/workers/Hashrate.cpp
src/workers/MultiWorker.cpp
2019-03-30 03:10:27 +07:00
src/workers/ThreadHandle.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_groestl.c
src/crypto/c_blake256.c
src/crypto/c_jh.c
src/crypto/c_skein.c
)
2017-04-15 09:02:08 +03:00
if (WIN32)
2017-06-04 20:52:21 +03:00
set(SOURCES_OS
2019-03-16 02:07:26 +07:00
"${SOURCES_OS}"
2017-06-04 20:52:21 +03:00
res/app.rc
2017-06-13 13:20:15 +03:00
src/App_win.cpp
2018-04-13 07:23:01 +07:00
src/common/Platform_win.cpp
2017-06-09 15:09:21 +03:00
src/Mem_win.cpp
src/crypto/common/VirtualMemory_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
2019-03-16 02:07:26 +07:00
"${SOURCES_OS}"
2017-06-14 19:13:02 +03:00
src/App_unix.cpp
2018-04-13 07:23:01 +07:00
src/common/Platform_mac.cpp
2017-06-14 19:13:02 +03:00
src/Mem_unix.cpp
src/crypto/common/VirtualMemory_unix.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
2019-03-16 02:07:26 +07:00
"${SOURCES_OS}"
2017-06-14 19:13:02 +03:00
src/App_unix.cpp
2018-04-13 07:23:01 +07:00
src/common/Platform_unix.cpp
2019-06-02 19:58:16 +07:00
src/Mem_unix.cpp
src/crypto/common/VirtualMemory_unix.cpp
2017-06-14 19:13:02 +03:00
)
2018-10-24 09:55:40 +07:00
if (CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
set(EXTRA_LIBS kvm pthread)
2018-10-24 09:55:40 +07:00
else()
set(EXTRA_LIBS pthread rt dl)
endif()
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-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/core/cpu/AdvancedCpuInfo.h src/core/cpu/AdvancedCpuInfo.cpp src/core/cpu/Cpu.cpp)
2017-06-08 00:10:26 +03:00
else()
add_definitions(/DXMRIG_NO_LIBCPUID)
set(SOURCES_CPUID src/common/cpu/BasicCpuInfo.h src/common/cpu/Cpu.cpp)
2017-11-06 03:11:35 +03:00
2017-11-26 22:23:23 +03:00
if (XMRIG_ARM)
set(SOURCES_CPUID ${SOURCES_CPUID} src/common/cpu/BasicCpuInfo_arm.cpp)
2017-11-06 03:11:35 +03:00
else()
set(SOURCES_CPUID ${SOURCES_CPUID} src/common/cpu/BasicCpuInfo.cpp)
2017-11-06 03:11:35 +03:00
endif()
2017-06-08 00:10:26 +03:00
endif()
2018-09-16 03:06:54 +03:00
include(cmake/OpenSSL.cmake)
2018-09-23 20:16:33 +03:00
include(cmake/asm.cmake)
include(cmake/cn-gpu.cmake)
2018-09-16 03:06:54 +03:00
2017-09-02 19:04:40 +03:00
if (NOT WITH_AEON)
add_definitions(/DXMRIG_NO_AEON)
endif()
2018-04-03 02:55:28 +07:00
if (NOT WITH_SUMO)
add_definitions(/DXMRIG_NO_SUMO)
endif()
2018-04-21 00:19:33 +07:00
if (NOT WITH_IPBC)
add_definitions(/DXMRIG_NO_IPBC)
endif()
if (NOT WITH_CN_PICO)
add_definitions(/DXMRIG_NO_CN_PICO)
endif()
if (WITH_EMBEDDED_CONFIG)
add_definitions(/DXMRIG_FEATURE_EMBEDDED_CONFIG)
endif()
if (WITH_HTTP)
set(HTTP_SOURCES
2019-03-31 01:31:40 +07:00
src/api/Api.cpp
2019-03-30 00:16:01 +07:00
src/api/Api.h
2019-03-31 01:31:40 +07:00
src/api/Httpd.cpp
src/api/Httpd.h
src/api/interfaces/IApiRequest.h
src/api/requests/ApiRequest.cpp
2019-03-31 01:31:40 +07:00
src/api/requests/ApiRequest.h
src/api/requests/HttpApiRequest.cpp
2019-03-31 01:31:40 +07:00
src/api/requests/HttpApiRequest.h
src/api/v1/ApiRouter.cpp
src/api/v1/ApiRouter.h
)
else()
set(HTTP_SOURCES "")
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
if (BUILD_STATIC)
set(CMAKE_EXE_LINKER_FLAGS " -static")
endif()
2018-09-03 01:26:19 +03:00
if (WITH_DEBUG_LOG)
add_definitions(/DAPP_DEBUG)
endif()
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})
target_link_libraries(${CMAKE_PROJECT_NAME} ${XMRIG_ASM_LIBRARY} ${OPENSSL_LIBRARIES} ${UV_LIBRARIES} ${EXTRA_LIBS} ${CPUID_LIB})