1
1
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 )
12
17
13
18
include (CheckIncludeFile )
14
19
include (cmake/cpu.cmake )
20
+ include (src/base/base.cmake )
15
21
16
22
17
23
set (HEADERS
18
- src/api/NetworkState.h
24
+ "${HEADERS_BASE} "
25
+ "${HEADERS_BASE_HTTP} "
26
+ src/api/interfaces/IApiListener.h
19
27
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
24
28
src/common/cpu/Cpu.h
25
- src/common/crypto/Algorithm.h
26
29
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
32
30
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
49
31
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
54
38
src/core/Controller.h
55
39
src/interfaces/IJobResultListener.h
56
40
src/interfaces/IThread.h
57
41
src/interfaces/IWorker.h
58
42
src/Mem.h
59
43
src/net/JobResult.h
60
44
src/net/Network.h
45
+ src/net/NetworkState.h
61
46
src/net/strategies/DonateStrategy.h
62
47
src/Summary.h
63
48
src/version.h
64
49
src/workers/CpuThread.h
65
- src/workers/Handle.h
66
50
src/workers/Hashrate.h
67
51
src/workers/MultiWorker.h
52
+ src/workers/ThreadHandle.h
68
53
src/workers/Worker.h
69
54
src/workers/Workers.h
70
55
)
71
56
72
57
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
85
74
)
86
75
87
76
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 )
89
78
else ()
90
- set (HEADERS_CRYPTO "${HEADERS_CRYPTO} " src/crypto/CryptoNight_x86.h )
79
+ set (HEADERS_CRYPTO "${HEADERS_CRYPTO} " src/crypto/cn/ CryptoNight_x86.h )
91
80
endif ()
92
81
93
82
set (SOURCES
94
- src/api/NetworkState.cpp
83
+ "${SOURCES_BASE} "
84
+ "${SOURCES_BASE_HTTP} "
95
85
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
101
86
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
112
87
src/common/Platform.cpp
113
- src/core/Config.cpp
88
+ src/core/config/Config.cpp
89
+ src/core/config/ConfigTransform.cpp
114
90
src/core/Controller.cpp
115
91
src/Mem.cpp
116
92
src/net/Network.cpp
93
+ src/net/NetworkState.cpp
117
94
src/net/strategies/DonateStrategy.cpp
118
95
src/Summary.cpp
119
96
src/workers/CpuThread.cpp
120
- src/workers/Handle.cpp
121
97
src/workers/Hashrate.cpp
122
98
src/workers/MultiWorker.cpp
99
+ src/workers/ThreadHandle.cpp
123
100
src/workers/Worker.cpp
124
101
src/workers/Workers.cpp
125
- src/xmrig .cpp
102
+ src/xlarig .cpp
126
103
)
127
104
128
105
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
133
111
)
134
112
135
113
if (WIN32 )
136
114
set (SOURCES_OS
115
+ "${SOURCES_OS} "
137
116
res/app.rc
138
117
src/App_win.cpp
139
118
src/common/Platform_win.cpp
140
119
src/Mem_win.cpp
120
+ src/crypto/common/VirtualMemory_win.cpp
141
121
)
142
122
143
123
add_definitions (/DWIN32 )
144
124
set (EXTRA_LIBS ws2_32 psapi iphlpapi userenv )
145
125
elseif (APPLE )
146
126
set (SOURCES_OS
127
+ "${SOURCES_OS} "
147
128
src/App_unix.cpp
148
129
src/common/Platform_mac.cpp
149
130
src/Mem_unix.cpp
131
+ src/crypto/common/VirtualMemory_unix.cpp
150
132
)
151
133
else ()
152
134
set (SOURCES_OS
135
+ "${SOURCES_OS} "
153
136
src/App_unix.cpp
154
137
src/common/Platform_unix.cpp
155
138
src/Mem_unix.cpp
139
+ src/crypto/common/VirtualMemory_unix.cpp
156
140
)
157
141
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 ( )
163
147
endif ()
164
148
165
149
if (CMAKE_SYSTEM_NAME MATCHES "Linux" )
@@ -176,6 +160,19 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
176
160
177
161
find_package (UV REQUIRED )
178
162
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
+
179
176
include (cmake/flags.cmake )
180
177
181
178
if (WITH_LIBCPUID )
@@ -197,50 +194,40 @@ endif()
197
194
198
195
include (cmake/OpenSSL.cmake )
199
196
include (cmake/asm.cmake )
197
+ include (cmake/cn-gpu.cmake )
200
198
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 )
205
201
endif ()
206
202
207
- if (NOT WITH_AEON )
208
- add_definitions (/DXMRIG_NO_AEON )
203
+ if (WITH_CN_HEAVY )
204
+ add_definitions (/DXMRIG_ALGO_CN_HEAVY )
209
205
endif ()
210
206
211
- if (NOT WITH_SUMO )
212
- add_definitions (/DXMRIG_NO_SUMO )
207
+ if (WITH_CN_PICO )
208
+ add_definitions (/DXMRIG_ALGO_CN_PICO )
213
209
endif ()
214
210
215
- if (NOT WITH_IPBC )
216
- add_definitions (/DXMRIG_NO_IPBC )
211
+ if (WITH_EMBEDDED_CONFIG )
212
+ add_definitions (/DXMRIG_FEATURE_EMBEDDED_CONFIG )
217
213
endif ()
218
214
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
+ )
239
229
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 "" )
244
231
endif ()
245
232
246
233
include_directories (src )
@@ -255,5 +242,5 @@ if (WITH_DEBUG_LOG)
255
242
add_definitions (/DAPP_DEBUG )
256
243
endif ()
257
244
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