Skip to content

Commit a2e8818

Browse files
authored
Merge pull request #3 from scala-network/xlarig
DefyX integration and Rebrand to XLArig
2 parents ebd8fb3 + 846b9c0 commit a2e8818

File tree

466 files changed

+61829
-9048
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

466 files changed

+61829
-9048
lines changed

CHANGELOG.md

Lines changed: 157 additions & 69 deletions
Large diffs are not rendered by default.

CMakeLists.txt

Lines changed: 107 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -1,165 +1,149 @@
11
cmake_minimum_required(VERSION 2.8)
2-
project(xtlrig)
3-
4-
option(WITH_LIBCPUID "Use Libcpuid" ON)
5-
option(WITH_AEON "CryptoNight-Lite support" ON)
6-
option(WITH_SUMO "CryptoNight-Heavy support" ON)
7-
option(WITH_HTTPD "HTTP REST API" ON)
8-
option(WITH_DEBUG_LOG "Enable debug log output" OFF)
9-
option(WITH_TLS "Enable OpenSSL support" ON)
10-
option(WITH_ASM "Enable ASM PoW implementations" ON)
11-
option(BUILD_STATIC "Build static binary" OFF)
2+
project(xlarig)
3+
4+
option(WITH_LIBCPUID "Use Libcpuid" ON)
5+
option(WITH_CN_LITE "CryptoNight-Lite support" ON)
6+
option(WITH_CN_HEAVY "CryptoNight-Heavy support" ON)
7+
option(WITH_CN_PICO "CryptoNight-Pico support" ON)
8+
option(WITH_CN_GPU "CryptoNight-GPU support" ON)
9+
option(WITH_RANDOMX "RandomX support" ON)
10+
option(WITH_HTTP "HTTP protocol support (client/server)" ON)
11+
option(WITH_DEBUG_LOG "Enable debug log output" OFF)
12+
option(WITH_TLS "Enable OpenSSL support" ON)
13+
option(WITH_ASM "Enable ASM PoW implementations" ON)
14+
option(BUILD_STATIC "Build static binary" OFF)
15+
option(ARM_TARGET "Force use specific ARM target 8 or 7" 0)
16+
option(WITH_EMBEDDED_CONFIG "Enable internal embedded JSON config" OFF)
1217

1318
include (CheckIncludeFile)
1419
include (cmake/cpu.cmake)
20+
include (src/base/base.cmake)
1521

1622

1723
set(HEADERS
18-
src/api/NetworkState.h
24+
"${HEADERS_BASE}"
25+
"${HEADERS_BASE_HTTP}"
26+
src/api/interfaces/IApiListener.h
1927
src/App.h
20-
src/common/config/CommonConfig.h
21-
src/common/config/ConfigLoader.h
22-
src/common/config/ConfigWatcher.h
23-
src/common/Console.h
2428
src/common/cpu/Cpu.h
25-
src/common/crypto/Algorithm.h
2629
src/common/crypto/keccak.h
27-
src/common/interfaces/IClientListener.h
28-
src/common/interfaces/IConfig.h
29-
src/common/interfaces/IConfigCreator.h
30-
src/common/interfaces/IConsoleListener.h
31-
src/common/interfaces/IControllerListener.h
3230
src/common/interfaces/ICpuInfo.h
33-
src/common/interfaces/ILogBackend.h
34-
src/common/interfaces/IStrategy.h
35-
src/common/interfaces/IStrategyListener.h
36-
src/common/interfaces/IWatcherListener.h
37-
src/common/log/BasicLog.h
38-
src/common/log/ConsoleLog.h
39-
src/common/log/FileLog.h
40-
src/common/log/Log.h
41-
src/common/net/Client.h
42-
src/common/net/Id.h
43-
src/common/net/Job.h
44-
src/common/net/Pool.h
45-
src/common/net/Storage.h
46-
src/common/net/strategies/FailoverStrategy.h
47-
src/common/net/strategies/SinglePoolStrategy.h
48-
src/common/net/SubmitResult.h
4931
src/common/Platform.h
50-
src/common/utils/c_str.h
51-
src/common/utils/mm_malloc.h
52-
src/common/xmrig.h
53-
src/core/ConfigLoader_platform.h
32+
src/common/xlarig.h
33+
src/core/config/Config_default.h
34+
src/core/config/Config_platform.h
35+
src/core/config/Config.h
36+
src/core/config/ConfigTransform.h
37+
src/core/config/usage.h
5438
src/core/Controller.h
5539
src/interfaces/IJobResultListener.h
5640
src/interfaces/IThread.h
5741
src/interfaces/IWorker.h
5842
src/Mem.h
5943
src/net/JobResult.h
6044
src/net/Network.h
45+
src/net/NetworkState.h
6146
src/net/strategies/DonateStrategy.h
6247
src/Summary.h
6348
src/version.h
6449
src/workers/CpuThread.h
65-
src/workers/Handle.h
6650
src/workers/Hashrate.h
6751
src/workers/MultiWorker.h
52+
src/workers/ThreadHandle.h
6853
src/workers/Worker.h
6954
src/workers/Workers.h
7055
)
7156

7257
set(HEADERS_CRYPTO
73-
src/crypto/c_blake256.h
74-
src/crypto/c_groestl.h
75-
src/crypto/c_jh.h
76-
src/crypto/c_skein.h
77-
src/crypto/CryptoNight.h
78-
src/crypto/CryptoNight_constants.h
79-
src/crypto/CryptoNight_monero.h
80-
src/crypto/CryptoNight_test.h
81-
src/crypto/groestl_tables.h
82-
src/crypto/hash.h
83-
src/crypto/skein_port.h
84-
src/crypto/soft_aes.h
58+
src/crypto/cn/asm/CryptonightR_template.h
59+
src/crypto/cn/c_blake256.h
60+
src/crypto/cn/c_groestl.h
61+
src/crypto/cn/c_jh.h
62+
src/crypto/cn/c_skein.h
63+
src/crypto/cn/CryptoNight_constants.h
64+
src/crypto/cn/CryptoNight_monero.h
65+
src/crypto/cn/CryptoNight_test.h
66+
src/crypto/cn/CryptoNight.h
67+
src/crypto/cn/groestl_tables.h
68+
src/crypto/cn/hash.h
69+
src/crypto/cn/skein_port.h
70+
src/crypto/cn/soft_aes.h
71+
src/crypto/common/Algorithm.h
72+
src/crypto/common/portable/mm_malloc.h
73+
src/crypto/common/VirtualMemory.h
8574
)
8675

8776
if (XMRIG_ARM)
88-
set(HEADERS_CRYPTO "${HEADERS_CRYPTO}" src/crypto/CryptoNight_arm.h)
77+
set(HEADERS_CRYPTO "${HEADERS_CRYPTO}" src/crypto/cn/CryptoNight_arm.h)
8978
else()
90-
set(HEADERS_CRYPTO "${HEADERS_CRYPTO}" src/crypto/CryptoNight_x86.h)
79+
set(HEADERS_CRYPTO "${HEADERS_CRYPTO}" src/crypto/cn/CryptoNight_x86.h)
9180
endif()
9281

9382
set(SOURCES
94-
src/api/NetworkState.cpp
83+
"${SOURCES_BASE}"
84+
"${SOURCES_BASE_HTTP}"
9585
src/App.cpp
96-
src/common/config/CommonConfig.cpp
97-
src/common/config/ConfigLoader.cpp
98-
src/common/config/ConfigWatcher.cpp
99-
src/common/Console.cpp
100-
src/common/crypto/Algorithm.cpp
10186
src/common/crypto/keccak.cpp
102-
src/common/log/BasicLog.cpp
103-
src/common/log/ConsoleLog.cpp
104-
src/common/log/FileLog.cpp
105-
src/common/log/Log.cpp
106-
src/common/net/Client.cpp
107-
src/common/net/Job.cpp
108-
src/common/net/Pool.cpp
109-
src/common/net/strategies/FailoverStrategy.cpp
110-
src/common/net/strategies/SinglePoolStrategy.cpp
111-
src/common/net/SubmitResult.cpp
11287
src/common/Platform.cpp
113-
src/core/Config.cpp
88+
src/core/config/Config.cpp
89+
src/core/config/ConfigTransform.cpp
11490
src/core/Controller.cpp
11591
src/Mem.cpp
11692
src/net/Network.cpp
93+
src/net/NetworkState.cpp
11794
src/net/strategies/DonateStrategy.cpp
11895
src/Summary.cpp
11996
src/workers/CpuThread.cpp
120-
src/workers/Handle.cpp
12197
src/workers/Hashrate.cpp
12298
src/workers/MultiWorker.cpp
99+
src/workers/ThreadHandle.cpp
123100
src/workers/Worker.cpp
124101
src/workers/Workers.cpp
125-
src/xmrig.cpp
102+
src/xlarig.cpp
126103
)
127104

128105
set(SOURCES_CRYPTO
129-
src/crypto/c_groestl.c
130-
src/crypto/c_blake256.c
131-
src/crypto/c_jh.c
132-
src/crypto/c_skein.c
106+
src/crypto/cn/c_groestl.c
107+
src/crypto/cn/c_blake256.c
108+
src/crypto/cn/c_jh.c
109+
src/crypto/cn/c_skein.c
110+
src/crypto/common/Algorithm.cpp
133111
)
134112

135113
if (WIN32)
136114
set(SOURCES_OS
115+
"${SOURCES_OS}"
137116
res/app.rc
138117
src/App_win.cpp
139118
src/common/Platform_win.cpp
140119
src/Mem_win.cpp
120+
src/crypto/common/VirtualMemory_win.cpp
141121
)
142122

143123
add_definitions(/DWIN32)
144124
set(EXTRA_LIBS ws2_32 psapi iphlpapi userenv)
145125
elseif (APPLE)
146126
set(SOURCES_OS
127+
"${SOURCES_OS}"
147128
src/App_unix.cpp
148129
src/common/Platform_mac.cpp
149130
src/Mem_unix.cpp
131+
src/crypto/common/VirtualMemory_unix.cpp
150132
)
151133
else()
152134
set(SOURCES_OS
135+
"${SOURCES_OS}"
153136
src/App_unix.cpp
154137
src/common/Platform_unix.cpp
155138
src/Mem_unix.cpp
139+
src/crypto/common/VirtualMemory_unix.cpp
156140
)
157141

158-
set(EXTRA_LIBS pthread rt dl)
159-
endif()
160-
161-
if (CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
162-
set(EXTRA_LIBS ${EXTRA_LIBS} kvm)
142+
if (CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
143+
set(EXTRA_LIBS kvm pthread)
144+
else()
145+
set(EXTRA_LIBS pthread rt dl)
146+
endif()
163147
endif()
164148

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

177161
find_package(UV REQUIRED)
178162

163+
if (WITH_RANDOMX)
164+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/defyx)
165+
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/defyx/src)
166+
167+
set(RANDOMX_LIBRARIES defyx)
168+
169+
add_definitions(/DXMRIG_ALGO_RANDOMX)
170+
else()
171+
set(RANDOMX_LIBRARIES "")
172+
173+
remove_definitions(/DXMRIG_ALGO_RANDOMX)
174+
endif()
175+
179176
include(cmake/flags.cmake)
180177

181178
if (WITH_LIBCPUID)
@@ -197,50 +194,40 @@ endif()
197194

198195
include(cmake/OpenSSL.cmake)
199196
include(cmake/asm.cmake)
197+
include(cmake/cn-gpu.cmake)
200198

201-
CHECK_INCLUDE_FILE (syslog.h HAVE_SYSLOG_H)
202-
if (HAVE_SYSLOG_H)
203-
add_definitions(/DHAVE_SYSLOG_H)
204-
set(SOURCES_SYSLOG src/common/log/SysLog.h src/common/log/SysLog.cpp)
199+
if (WITH_CN_LITE)
200+
add_definitions(/DXMRIG_ALGO_CN_LITE)
205201
endif()
206202

207-
if (NOT WITH_AEON)
208-
add_definitions(/DXMRIG_NO_AEON)
203+
if (WITH_CN_HEAVY)
204+
add_definitions(/DXMRIG_ALGO_CN_HEAVY)
209205
endif()
210206

211-
if (NOT WITH_SUMO)
212-
add_definitions(/DXMRIG_NO_SUMO)
207+
if (WITH_CN_PICO)
208+
add_definitions(/DXMRIG_ALGO_CN_PICO)
213209
endif()
214210

215-
if (NOT WITH_IPBC)
216-
add_definitions(/DXMRIG_NO_IPBC)
211+
if (WITH_EMBEDDED_CONFIG)
212+
add_definitions(/DXMRIG_FEATURE_EMBEDDED_CONFIG)
217213
endif()
218214

219-
if (WITH_HTTPD)
220-
find_package(MHD)
221-
222-
if (MHD_FOUND)
223-
include_directories(${MHD_INCLUDE_DIRS})
224-
set(HTTPD_SOURCES
225-
src/api/Api.h
226-
src/api/ApiRouter.h
227-
src/common/api/HttpBody.h
228-
src/common/api/Httpd.h
229-
src/common/api/HttpReply.h
230-
src/common/api/HttpRequest.h
231-
src/api/Api.cpp
232-
src/api/ApiRouter.cpp
233-
src/common/api/Httpd.cpp
234-
src/common/api/HttpRequest.cpp
235-
)
236-
else()
237-
message(FATAL_ERROR "microhttpd NOT found: use `-DWITH_HTTPD=OFF` to build without http deamon support")
238-
endif()
215+
if (WITH_HTTP)
216+
set(HTTP_SOURCES
217+
src/api/Api.cpp
218+
src/api/Api.h
219+
src/api/Httpd.cpp
220+
src/api/Httpd.h
221+
src/api/interfaces/IApiRequest.h
222+
src/api/requests/ApiRequest.cpp
223+
src/api/requests/ApiRequest.h
224+
src/api/requests/HttpApiRequest.cpp
225+
src/api/requests/HttpApiRequest.h
226+
src/api/v1/ApiRouter.cpp
227+
src/api/v1/ApiRouter.h
228+
)
239229
else()
240-
set(HTTPD_SOURCES "")
241-
set(MHD_LIBRARY "")
242-
add_definitions(/DXMRIG_NO_HTTPD)
243-
add_definitions(/DXMRIG_NO_API)
230+
set(HTTP_SOURCES "")
244231
endif()
245232

246233
include_directories(src)
@@ -255,5 +242,5 @@ if (WITH_DEBUG_LOG)
255242
add_definitions(/DAPP_DEBUG)
256243
endif()
257244

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

0 commit comments

Comments
 (0)