Skip to content

Commit

Permalink
Merge pull request #3 from scala-network/xlarig
Browse files Browse the repository at this point in the history
DefyX integration and Rebrand to XLArig
  • Loading branch information
hayzamjs authored Aug 13, 2019
2 parents ebd8fb3 + 846b9c0 commit a2e8818
Show file tree
Hide file tree
Showing 466 changed files with 61,829 additions and 9,048 deletions.
226 changes: 157 additions & 69 deletions CHANGELOG.md

Large diffs are not rendered by default.

227 changes: 107 additions & 120 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,165 +1,149 @@
cmake_minimum_required(VERSION 2.8)
project(xtlrig)

option(WITH_LIBCPUID "Use Libcpuid" ON)
option(WITH_AEON "CryptoNight-Lite support" ON)
option(WITH_SUMO "CryptoNight-Heavy 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)
project(xlarig)

option(WITH_LIBCPUID "Use Libcpuid" ON)
option(WITH_CN_LITE "CryptoNight-Lite support" ON)
option(WITH_CN_HEAVY "CryptoNight-Heavy support" ON)
option(WITH_CN_PICO "CryptoNight-Pico support" ON)
option(WITH_CN_GPU "CryptoNight-GPU support" ON)
option(WITH_RANDOMX "RandomX 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)

include (CheckIncludeFile)
include (cmake/cpu.cmake)
include (src/base/base.cmake)


set(HEADERS
src/api/NetworkState.h
"${HEADERS_BASE}"
"${HEADERS_BASE_HTTP}"
src/api/interfaces/IApiListener.h
src/App.h
src/common/config/CommonConfig.h
src/common/config/ConfigLoader.h
src/common/config/ConfigWatcher.h
src/common/Console.h
src/common/cpu/Cpu.h
src/common/crypto/Algorithm.h
src/common/crypto/keccak.h
src/common/interfaces/IClientListener.h
src/common/interfaces/IConfig.h
src/common/interfaces/IConfigCreator.h
src/common/interfaces/IConsoleListener.h
src/common/interfaces/IControllerListener.h
src/common/interfaces/ICpuInfo.h
src/common/interfaces/ILogBackend.h
src/common/interfaces/IStrategy.h
src/common/interfaces/IStrategyListener.h
src/common/interfaces/IWatcherListener.h
src/common/log/BasicLog.h
src/common/log/ConsoleLog.h
src/common/log/FileLog.h
src/common/log/Log.h
src/common/net/Client.h
src/common/net/Id.h
src/common/net/Job.h
src/common/net/Pool.h
src/common/net/Storage.h
src/common/net/strategies/FailoverStrategy.h
src/common/net/strategies/SinglePoolStrategy.h
src/common/net/SubmitResult.h
src/common/Platform.h
src/common/utils/c_str.h
src/common/utils/mm_malloc.h
src/common/xmrig.h
src/core/ConfigLoader_platform.h
src/common/xlarig.h
src/core/config/Config_default.h
src/core/config/Config_platform.h
src/core/config/Config.h
src/core/config/ConfigTransform.h
src/core/config/usage.h
src/core/Controller.h
src/interfaces/IJobResultListener.h
src/interfaces/IThread.h
src/interfaces/IWorker.h
src/Mem.h
src/net/JobResult.h
src/net/Network.h
src/net/NetworkState.h
src/net/strategies/DonateStrategy.h
src/Summary.h
src/version.h
src/workers/CpuThread.h
src/workers/Handle.h
src/workers/Hashrate.h
src/workers/MultiWorker.h
src/workers/ThreadHandle.h
src/workers/Worker.h
src/workers/Workers.h
)

set(HEADERS_CRYPTO
src/crypto/c_blake256.h
src/crypto/c_groestl.h
src/crypto/c_jh.h
src/crypto/c_skein.h
src/crypto/CryptoNight.h
src/crypto/CryptoNight_constants.h
src/crypto/CryptoNight_monero.h
src/crypto/CryptoNight_test.h
src/crypto/groestl_tables.h
src/crypto/hash.h
src/crypto/skein_port.h
src/crypto/soft_aes.h
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
src/crypto/common/Algorithm.h
src/crypto/common/portable/mm_malloc.h
src/crypto/common/VirtualMemory.h
)

if (XMRIG_ARM)
set(HEADERS_CRYPTO "${HEADERS_CRYPTO}" src/crypto/CryptoNight_arm.h)
set(HEADERS_CRYPTO "${HEADERS_CRYPTO}" src/crypto/cn/CryptoNight_arm.h)
else()
set(HEADERS_CRYPTO "${HEADERS_CRYPTO}" src/crypto/CryptoNight_x86.h)
set(HEADERS_CRYPTO "${HEADERS_CRYPTO}" src/crypto/cn/CryptoNight_x86.h)
endif()

set(SOURCES
src/api/NetworkState.cpp
"${SOURCES_BASE}"
"${SOURCES_BASE_HTTP}"
src/App.cpp
src/common/config/CommonConfig.cpp
src/common/config/ConfigLoader.cpp
src/common/config/ConfigWatcher.cpp
src/common/Console.cpp
src/common/crypto/Algorithm.cpp
src/common/crypto/keccak.cpp
src/common/log/BasicLog.cpp
src/common/log/ConsoleLog.cpp
src/common/log/FileLog.cpp
src/common/log/Log.cpp
src/common/net/Client.cpp
src/common/net/Job.cpp
src/common/net/Pool.cpp
src/common/net/strategies/FailoverStrategy.cpp
src/common/net/strategies/SinglePoolStrategy.cpp
src/common/net/SubmitResult.cpp
src/common/Platform.cpp
src/core/Config.cpp
src/core/config/Config.cpp
src/core/config/ConfigTransform.cpp
src/core/Controller.cpp
src/Mem.cpp
src/net/Network.cpp
src/net/NetworkState.cpp
src/net/strategies/DonateStrategy.cpp
src/Summary.cpp
src/workers/CpuThread.cpp
src/workers/Handle.cpp
src/workers/Hashrate.cpp
src/workers/MultiWorker.cpp
src/workers/ThreadHandle.cpp
src/workers/Worker.cpp
src/workers/Workers.cpp
src/xmrig.cpp
src/xlarig.cpp
)

set(SOURCES_CRYPTO
src/crypto/c_groestl.c
src/crypto/c_blake256.c
src/crypto/c_jh.c
src/crypto/c_skein.c
src/crypto/cn/c_groestl.c
src/crypto/cn/c_blake256.c
src/crypto/cn/c_jh.c
src/crypto/cn/c_skein.c
src/crypto/common/Algorithm.cpp
)

if (WIN32)
set(SOURCES_OS
"${SOURCES_OS}"
res/app.rc
src/App_win.cpp
src/common/Platform_win.cpp
src/Mem_win.cpp
src/crypto/common/VirtualMemory_win.cpp
)

add_definitions(/DWIN32)
set(EXTRA_LIBS ws2_32 psapi iphlpapi userenv)
elseif (APPLE)
set(SOURCES_OS
"${SOURCES_OS}"
src/App_unix.cpp
src/common/Platform_mac.cpp
src/Mem_unix.cpp
src/crypto/common/VirtualMemory_unix.cpp
)
else()
set(SOURCES_OS
"${SOURCES_OS}"
src/App_unix.cpp
src/common/Platform_unix.cpp
src/Mem_unix.cpp
src/crypto/common/VirtualMemory_unix.cpp
)

set(EXTRA_LIBS pthread rt dl)
endif()

if (CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
set(EXTRA_LIBS ${EXTRA_LIBS} kvm)
if (CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
set(EXTRA_LIBS kvm pthread)
else()
set(EXTRA_LIBS pthread rt dl)
endif()
endif()

if (CMAKE_SYSTEM_NAME MATCHES "Linux")
Expand All @@ -176,6 +160,19 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")

find_package(UV REQUIRED)

if (WITH_RANDOMX)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/defyx)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/defyx/src)

set(RANDOMX_LIBRARIES defyx)

add_definitions(/DXMRIG_ALGO_RANDOMX)
else()
set(RANDOMX_LIBRARIES "")

remove_definitions(/DXMRIG_ALGO_RANDOMX)
endif()

include(cmake/flags.cmake)

if (WITH_LIBCPUID)
Expand All @@ -197,50 +194,40 @@ endif()

include(cmake/OpenSSL.cmake)
include(cmake/asm.cmake)
include(cmake/cn-gpu.cmake)

CHECK_INCLUDE_FILE (syslog.h HAVE_SYSLOG_H)
if (HAVE_SYSLOG_H)
add_definitions(/DHAVE_SYSLOG_H)
set(SOURCES_SYSLOG src/common/log/SysLog.h src/common/log/SysLog.cpp)
if (WITH_CN_LITE)
add_definitions(/DXMRIG_ALGO_CN_LITE)
endif()

if (NOT WITH_AEON)
add_definitions(/DXMRIG_NO_AEON)
if (WITH_CN_HEAVY)
add_definitions(/DXMRIG_ALGO_CN_HEAVY)
endif()

if (NOT WITH_SUMO)
add_definitions(/DXMRIG_NO_SUMO)
if (WITH_CN_PICO)
add_definitions(/DXMRIG_ALGO_CN_PICO)
endif()

if (NOT WITH_IPBC)
add_definitions(/DXMRIG_NO_IPBC)
if (WITH_EMBEDDED_CONFIG)
add_definitions(/DXMRIG_FEATURE_EMBEDDED_CONFIG)
endif()

if (WITH_HTTPD)
find_package(MHD)

if (MHD_FOUND)
include_directories(${MHD_INCLUDE_DIRS})
set(HTTPD_SOURCES
src/api/Api.h
src/api/ApiRouter.h
src/common/api/HttpBody.h
src/common/api/Httpd.h
src/common/api/HttpReply.h
src/common/api/HttpRequest.h
src/api/Api.cpp
src/api/ApiRouter.cpp
src/common/api/Httpd.cpp
src/common/api/HttpRequest.cpp
)
else()
message(FATAL_ERROR "microhttpd NOT found: use `-DWITH_HTTPD=OFF` to build without http deamon support")
endif()
if (WITH_HTTP)
set(HTTP_SOURCES
src/api/Api.cpp
src/api/Api.h
src/api/Httpd.cpp
src/api/Httpd.h
src/api/interfaces/IApiRequest.h
src/api/requests/ApiRequest.cpp
src/api/requests/ApiRequest.h
src/api/requests/HttpApiRequest.cpp
src/api/requests/HttpApiRequest.h
src/api/v1/ApiRouter.cpp
src/api/v1/ApiRouter.h
)
else()
set(HTTPD_SOURCES "")
set(MHD_LIBRARY "")
add_definitions(/DXMRIG_NO_HTTPD)
add_definitions(/DXMRIG_NO_API)
set(HTTP_SOURCES "")
endif()

include_directories(src)
Expand All @@ -255,5 +242,5 @@ if (WITH_DEBUG_LOG)
add_definitions(/DAPP_DEBUG)
endif()

add_executable(${PROJECT_NAME} ${HEADERS} ${SOURCES} ${SOURCES_OS} ${SOURCES_CPUID} ${HEADERS_CRYPTO} ${SOURCES_CRYPTO} ${SOURCES_SYSLOG} ${HTTPD_SOURCES} ${TLS_SOURCES} ${XMRIG_ASM_SOURCES})
target_link_libraries(${PROJECT_NAME} ${XMRIG_ASM_LIBRARY} ${OPENSSL_LIBRARIES} ${UV_LIBRARIES} ${MHD_LIBRARY} ${EXTRA_LIBS} ${CPUID_LIB})
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} ${RANDOMX_LIBRARIES} ${EXTRA_LIBS} ${CPUID_LIB})
Loading

0 comments on commit a2e8818

Please sign in to comment.