2017-04-15 06:02:08 +00:00
|
|
|
cmake_minimum_required(VERSION 3.0)
|
2017-06-04 17:52:21 +00:00
|
|
|
project(xmrig)
|
2017-05-03 07:53:51 +00:00
|
|
|
|
2017-06-07 21:10:26 +00:00
|
|
|
option(WITH_LIBCPUID "Use Libcpuid" ON)
|
|
|
|
option(WITH_AEON "CryptoNight-Lite support" ON)
|
|
|
|
|
2017-04-15 06:02:08 +00:00
|
|
|
set(HEADERS
|
2017-06-12 13:19:07 +00:00
|
|
|
src/3rdparty/align.h
|
2017-06-04 17:52:21 +00:00
|
|
|
src/App.h
|
2017-06-09 12:09:21 +00:00
|
|
|
src/Console.h
|
|
|
|
src/Cpu.h
|
2017-06-04 17:52:21 +00:00
|
|
|
src/interfaces/IClientListener.h
|
2017-06-11 12:32:15 +00:00
|
|
|
src/interfaces/IJobResultListener.h
|
2017-06-10 04:05:00 +00:00
|
|
|
src/interfaces/IWorker.h
|
2017-06-09 12:09:21 +00:00
|
|
|
src/Mem.h
|
2017-06-04 17:52:21 +00:00
|
|
|
src/net/Client.h
|
2017-06-06 17:43:52 +00:00
|
|
|
src/net/Job.h
|
2017-06-11 07:58:46 +00:00
|
|
|
src/net/JobResult.h
|
2017-06-04 17:52:21 +00:00
|
|
|
src/net/Network.h
|
|
|
|
src/net/Url.h
|
|
|
|
src/Options.h
|
2017-06-07 22:16:45 +00:00
|
|
|
src/Summary.h
|
2017-06-12 13:19:07 +00:00
|
|
|
src/version.h
|
2017-06-13 16:58:31 +00:00
|
|
|
src/workers/DoubleWorker.h
|
2017-06-10 04:05:00 +00:00
|
|
|
src/workers/Handle.h
|
|
|
|
src/workers/SingleWorker.h
|
2017-06-12 04:18:14 +00:00
|
|
|
src/workers/Telemetry.h
|
2017-06-10 04:05:00 +00:00
|
|
|
src/workers/Worker.h
|
2017-06-10 06:41:08 +00:00
|
|
|
src/workers/Workers.h
|
2017-04-15 06:02:08 +00:00
|
|
|
)
|
|
|
|
|
2017-06-08 01:20:10 +00: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 06:47:25 +00:00
|
|
|
src/crypto/CryptoNight.h
|
|
|
|
src/crypto/CryptoNight_p.h
|
2017-06-08 20:31:42 +00:00
|
|
|
src/crypto/CryptoNight_test.h
|
2017-06-08 01:20:10 +00:00
|
|
|
src/crypto/groestl_tables.h
|
|
|
|
src/crypto/hash.h
|
|
|
|
src/crypto/skein_port.h
|
|
|
|
)
|
|
|
|
|
2017-04-15 06:02:08 +00:00
|
|
|
set(SOURCES
|
2017-06-04 17:52:21 +00:00
|
|
|
src/App.cpp
|
2017-06-09 12:09:21 +00:00
|
|
|
src/Console.cpp
|
|
|
|
src/Mem.cpp
|
2017-06-04 17:52:21 +00:00
|
|
|
src/net/Client.cpp
|
2017-06-06 17:43:52 +00:00
|
|
|
src/net/Job.cpp
|
2017-06-04 17:52:21 +00:00
|
|
|
src/net/Network.cpp
|
|
|
|
src/net/Url.cpp
|
|
|
|
src/Options.cpp
|
2017-06-07 22:16:45 +00:00
|
|
|
src/Summary.cpp
|
2017-06-13 16:58:31 +00:00
|
|
|
src/workers/DoubleWorker.cpp
|
2017-06-10 04:05:00 +00:00
|
|
|
src/workers/Handle.cpp
|
|
|
|
src/workers/SingleWorker.cpp
|
2017-06-12 04:18:14 +00:00
|
|
|
src/workers/Telemetry.cpp
|
2017-06-10 04:05:00 +00:00
|
|
|
src/workers/Worker.cpp
|
2017-06-10 06:41:08 +00:00
|
|
|
src/workers/Workers.cpp
|
2017-06-04 17:52:21 +00:00
|
|
|
src/xmrig.cpp
|
2017-04-15 06:02:08 +00:00
|
|
|
)
|
|
|
|
|
2017-06-08 01:20:10 +00: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
|
|
|
|
src/crypto/soft_aes.c
|
2017-06-08 06:47:25 +00:00
|
|
|
src/crypto/soft_aes.c
|
|
|
|
src/crypto/CryptoNight.cpp
|
2017-06-08 01:20:10 +00:00
|
|
|
)
|
|
|
|
|
2017-04-15 06:02:08 +00:00
|
|
|
if (WIN32)
|
2017-06-04 17:52:21 +00:00
|
|
|
set(SOURCES_OS
|
|
|
|
res/app.rc
|
|
|
|
src/3rdparty/winansi.cpp
|
|
|
|
src/3rdparty/winansi.h
|
2017-06-13 10:20:15 +00:00
|
|
|
src/App_win.cpp
|
2017-06-07 21:10:26 +00:00
|
|
|
src/Cpu_win.cpp
|
2017-06-09 12:09:21 +00:00
|
|
|
src/Mem_win.cpp
|
2017-06-04 17:52:21 +00:00
|
|
|
src/net/Network_win.cpp
|
|
|
|
)
|
|
|
|
|
2017-06-14 18:33:20 +00:00
|
|
|
add_definitions(/DWIN32)
|
2017-06-04 17:52:21 +00:00
|
|
|
set(EXTRA_LIBS ws2_32 psapi iphlpapi userenv)
|
2017-06-14 16:13:02 +00:00
|
|
|
elseif (APPLE)
|
|
|
|
set(SOURCES_OS
|
|
|
|
src/App_unix.cpp
|
2017-06-14 17:51:47 +00:00
|
|
|
src/Cpu_mac.cpp
|
2017-06-14 16:13:02 +00:00
|
|
|
src/Mem_unix.cpp
|
|
|
|
src/net/Network_mac.cpp
|
|
|
|
)
|
2017-04-15 06:02:08 +00:00
|
|
|
else()
|
2017-06-14 16:13:02 +00:00
|
|
|
set(SOURCES_OS
|
|
|
|
src/App_unix.cpp
|
|
|
|
src/Cpu_unix.cpp
|
|
|
|
src/Mem_unix.cpp
|
|
|
|
src/net/Network_unix.cpp
|
|
|
|
)
|
|
|
|
|
2017-04-15 06:02:08 +00:00
|
|
|
set(EXTRA_LIBS pthread)
|
|
|
|
endif()
|
|
|
|
|
2017-05-05 12:49:38 +00:00
|
|
|
add_definitions(/DUNICODE)
|
2017-06-12 04:18:14 +00:00
|
|
|
#add_definitions(/DAPP_DEBUG)
|
2017-04-15 06:02:08 +00:00
|
|
|
|
2017-06-04 17:52:21 +00:00
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
2017-04-15 06:02:08 +00:00
|
|
|
|
2017-06-04 17:52:21 +00:00
|
|
|
find_package(UV REQUIRED)
|
2017-05-27 07:34:42 +00:00
|
|
|
|
2017-06-04 17:52:21 +00:00
|
|
|
if ("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
|
|
|
set(CMAKE_BUILD_TYPE Release)
|
2017-05-27 07:34:42 +00:00
|
|
|
endif()
|
|
|
|
|
2017-06-08 01:20:10 +00:00
|
|
|
|
2017-06-12 13:19:07 +00:00
|
|
|
# https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html
|
2017-06-13 07:08:32 +00:00
|
|
|
if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
2017-06-12 13:19:07 +00:00
|
|
|
|
2017-06-14 16:13:02 +00:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes -Wall")
|
2017-06-12 13:19:07 +00:00
|
|
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Ofast -funroll-loops -fvariable-expansion-in-unroller -ftree-loop-if-convert-stores -fmerge-all-constants -fbranch-target-load-optimize2")
|
|
|
|
|
2017-06-14 16:13:02 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes -Wall -std=c++14 -fno-exceptions -fno-rtti")
|
2017-06-12 13:19:07 +00:00
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast -s -funroll-loops -fvariable-expansion-in-unroller -ftree-loop-if-convert-stores -fmerge-all-constants -fbranch-target-load-optimize2")
|
2017-04-15 06:02:08 +00:00
|
|
|
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
|
2017-06-12 13:19:07 +00:00
|
|
|
|
|
|
|
add_definitions(/D_GNU_SOURCE)
|
|
|
|
|
2017-06-14 16:13:02 +00:00
|
|
|
#set(CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -gdwarf-2")
|
2017-06-12 13:19:07 +00:00
|
|
|
|
2017-06-13 07:08:32 +00:00
|
|
|
elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
2017-06-12 13:19:07 +00:00
|
|
|
|
2017-06-13 07:08:32 +00:00
|
|
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Ox /Ot /Oi /MT /GL")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Ox /Ot /Oi /MT /GL")
|
2017-06-12 13:19:07 +00:00
|
|
|
|
2017-06-13 07:08:32 +00:00
|
|
|
elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
|
2017-06-12 13:19:07 +00:00
|
|
|
|
2017-06-14 16:13:02 +00:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes -Wall")
|
2017-06-14 17:37:59 +00:00
|
|
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Ofast -funroll-loops -fmerge-all-constants")
|
2017-06-14 16:13:02 +00:00
|
|
|
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes -Wall -std=c++14 -fno-exceptions -fno-rtti")
|
2017-06-14 17:37:59 +00:00
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast -funroll-loops -fmerge-all-constants")
|
2017-06-12 13:19:07 +00:00
|
|
|
|
2017-04-15 06:02:08 +00:00
|
|
|
endif()
|
|
|
|
|
2017-06-07 21:10:26 +00:00
|
|
|
if (WITH_LIBCPUID)
|
2017-06-07 22:51:24 +00:00
|
|
|
add_subdirectory(src/3rdparty/libcpuid)
|
2017-06-07 21:10:26 +00:00
|
|
|
|
2017-06-07 22:51:24 +00:00
|
|
|
include_directories(src/3rdparty/libcpuid)
|
|
|
|
set(CPUID_LIB cpuid)
|
|
|
|
set(SOURCES_CPUID src/Cpu.cpp)
|
2017-06-07 21:10:26 +00:00
|
|
|
else()
|
|
|
|
add_definitions(/DXMRIG_NO_LIBCPUID)
|
|
|
|
set(SOURCES_CPUID src/Cpu_stub.cpp)
|
|
|
|
endif()
|
|
|
|
|
2017-06-04 17:52:21 +00:00
|
|
|
include_directories(src)
|
|
|
|
include_directories(src/3rdparty)
|
|
|
|
include_directories(src/3rdparty/jansson)
|
|
|
|
include_directories(${UV_INCLUDE_DIR})
|
2017-05-10 09:58:52 +00:00
|
|
|
|
2017-06-04 17:52:21 +00:00
|
|
|
add_subdirectory(src/3rdparty/jansson)
|
2017-04-15 06:02:08 +00:00
|
|
|
|
2017-06-08 01:20:10 +00:00
|
|
|
add_executable(xmrig ${HEADERS} ${SOURCES} ${SOURCES_OS} ${SOURCES_CPUID} ${HEADERS_CRYPTO} ${SOURCES_CRYPTO})
|
2017-06-07 22:51:24 +00:00
|
|
|
target_link_libraries(xmrig jansson ${UV_LIBRARIES} ${EXTRA_LIBS} ${CPUID_LIB})
|