diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a764b22..fbd08aaf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 2.8) 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_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_HTTP "HTTP protocol support (client/server)" ON) @@ -182,20 +182,16 @@ include(cmake/OpenSSL.cmake) include(cmake/asm.cmake) include(cmake/cn-gpu.cmake) -if (NOT WITH_AEON) - add_definitions(/DXMRIG_NO_AEON) +if (WITH_CN_LITE) + add_definitions(/DXMRIG_ALGO_CN_LITE) endif() -if (NOT WITH_SUMO) - add_definitions(/DXMRIG_NO_SUMO) +if (WITH_CN_HEAVY) + add_definitions(/DXMRIG_ALGO_CN_HEAVY) endif() -if (NOT WITH_IPBC) - add_definitions(/DXMRIG_NO_IPBC) -endif() - -if (NOT WITH_CN_PICO) - add_definitions(/DXMRIG_NO_CN_PICO) +if (WITH_CN_PICO) + add_definitions(/DXMRIG_ALGO_CN_PICO) endif() if (WITH_EMBEDDED_CONFIG) diff --git a/cmake/cn-gpu.cmake b/cmake/cn-gpu.cmake index 9b8a62dd..7aa489e6 100644 --- a/cmake/cn-gpu.cmake +++ b/cmake/cn-gpu.cmake @@ -16,8 +16,10 @@ if (WITH_CN_GPU AND CMAKE_SIZEOF_VOID_P EQUAL 8) set_source_files_properties(src/crypto/cn/gpu/cn_gpu_avx.cpp PROPERTIES COMPILE_FLAGS "/arch:AVX") endif() endif() + + add_definitions(/DXMRIG_ALGO_CN_GPU) else() set(CN_GPU_SOURCES "") - add_definitions(/DXMRIG_NO_CN_GPU) + remove_definitions(/DXMRIG_ALGO_CN_GPU) endif() diff --git a/src/common/crypto/Algorithm.cpp b/src/common/crypto/Algorithm.cpp index d9d3ead9..10f70750 100644 --- a/src/common/crypto/Algorithm.cpp +++ b/src/common/crypto/Algorithm.cpp @@ -70,21 +70,21 @@ static AlgoData const algorithms[] = { { "cryptonight/zls", "cn/zls", xmrig::CRYPTONIGHT, xmrig::VARIANT_ZLS }, { "cryptonight/double", "cn/double", xmrig::CRYPTONIGHT, xmrig::VARIANT_DOUBLE }, -# ifndef XMRIG_NO_AEON +# ifdef XMRIG_ALGO_CN_LITE { "cryptonight-lite", "cn-lite", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_AUTO }, { "cryptonight-light", "cn-light", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_AUTO }, { "cryptonight-lite/0", "cn-lite/0", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_0 }, { "cryptonight-lite/1", "cn-lite/1", xmrig::CRYPTONIGHT_LITE, xmrig::VARIANT_1 }, # endif -# ifndef XMRIG_NO_SUMO +# ifdef XMRIG_ALGO_CN_HEAVY { "cryptonight-heavy", "cn-heavy", xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_AUTO }, { "cryptonight-heavy/0", "cn-heavy/0", xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_0 }, { "cryptonight-heavy/xhv", "cn-heavy/xhv", xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_XHV }, { "cryptonight-heavy/tube", "cn-heavy/tube", xmrig::CRYPTONIGHT_HEAVY, xmrig::VARIANT_TUBE }, # endif -# ifndef XMRIG_NO_CN_PICO +# ifdef XMRIG_ALGO_CN_PICO { "cryptonight-pico/trtl", "cn-pico/trtl", xmrig::CRYPTONIGHT_PICO, xmrig::VARIANT_TRTL }, { "cryptonight-pico", "cn-pico", xmrig::CRYPTONIGHT_PICO, xmrig::VARIANT_TRTL }, { "cryptonight-turtle", "cn-trtl", xmrig::CRYPTONIGHT_PICO, xmrig::VARIANT_TRTL }, @@ -92,7 +92,7 @@ static AlgoData const algorithms[] = { { "cryptonight_turtle", "cn_turtle", xmrig::CRYPTONIGHT_PICO, xmrig::VARIANT_TRTL }, # endif -# ifndef XMRIG_NO_CN_GPU +# ifdef XMRIG_ALGO_CN_GPU { "cryptonight/gpu", "cn/gpu", xmrig::CRYPTONIGHT, xmrig::VARIANT_GPU }, # endif }; diff --git a/src/core/config/Config.cpp b/src/core/config/Config.cpp index a3612ed8..c1430e4d 100644 --- a/src/core/config/Config.cpp +++ b/src/core/config/Config.cpp @@ -244,7 +244,7 @@ void xmrig::Config::setThreads(const rapidjson::Value &threads) xmrig::AlgoVariant xmrig::Config::getAlgoVariant() const { -# ifndef XMRIG_NO_AEON +# ifdef XMRIG_ALGO_CN_LITE if (m_algorithm.algo() == xmrig::CRYPTONIGHT_LITE) { return getAlgoVariantLite(); } @@ -262,7 +262,7 @@ xmrig::AlgoVariant xmrig::Config::getAlgoVariant() const } -#ifndef XMRIG_NO_AEON +#ifdef XMRIG_ALGO_CN_LITE xmrig::AlgoVariant xmrig::Config::getAlgoVariantLite() const { if (m_algoVariant <= AV_AUTO || m_algoVariant >= AV_MAX) { diff --git a/src/core/config/Config.h b/src/core/config/Config.h index 861840c7..4bcb8bba 100644 --- a/src/core/config/Config.h +++ b/src/core/config/Config.h @@ -90,7 +90,7 @@ private: void setThreads(const rapidjson::Value &threads); AlgoVariant getAlgoVariant() const; -# ifndef XMRIG_NO_AEON +# ifdef XMRIG_ALGO_CN_LITE AlgoVariant getAlgoVariantLite() const; # endif diff --git a/src/core/config/usage.h b/src/core/config/usage.h index ce172778..42cbc24a 100644 --- a/src/core/config/usage.h +++ b/src/core/config/usage.h @@ -37,15 +37,15 @@ Usage: " APP_ID " [OPTIONS]\n\ Options:\n\ -a, --algo=ALGO specify the algorithm to use\n\ cryptonight\n" -#ifndef XMRIG_NO_AEON +#ifdef XMRIG_ALGO_CN_LITE "\ cryptonight-lite\n" #endif -#ifndef XMRIG_NO_SUMO +#ifdef XMRIG_ALGO_CN_HEAVY "\ cryptonight-heavy\n" #endif -#ifndef XMRIG_NO_CN_PICO +#ifdef XMRIG_ALGO_CN_PICO "\ cryptonight-pico\n" #endif diff --git a/src/crypto/cn/CryptoNight_arm.h b/src/crypto/cn/CryptoNight_arm.h index e08c02de..d9be454b 100644 --- a/src/crypto/cn/CryptoNight_arm.h +++ b/src/crypto/cn/CryptoNight_arm.h @@ -284,7 +284,7 @@ static inline void cn_explode_scratchpad(const __m128i *input, __m128i *output) } -#ifndef XMRIG_NO_CN_GPU +#ifdef XMRIG_ALGO_CN_GPU template void cn_explode_scratchpad_gpu(const uint8_t *input, uint8_t *output) { @@ -583,7 +583,7 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si } -#ifndef XMRIG_NO_CN_GPU +#ifdef XMRIG_ALGO_CN_GPU template void cn_gpu_inner_arm(const uint8_t *spad, uint8_t *lpad); diff --git a/src/crypto/cn/CryptoNight_test.h b/src/crypto/cn/CryptoNight_test.h index 6fa9dd28..2429fc17 100644 --- a/src/crypto/cn/CryptoNight_test.h +++ b/src/crypto/cn/CryptoNight_test.h @@ -272,7 +272,7 @@ const static uint8_t test_output_double[160] = { 0x5E, 0x2E, 0xC1, 0x80, 0x89, 0x39, 0xB3, 0x54, 0x39, 0x52, 0x0E, 0x69, 0x3D, 0xF6, 0xC5, 0x4A }; -#ifndef XMRIG_NO_AEON +#ifdef XMRIG_ALGO_CN_LITE // "cn-lite/0" const static uint8_t test_output_v0_lite[160] = { 0x36, 0x95, 0xB4, 0xB5, 0x3B, 0xB0, 0x03, 0x58, 0xB0, 0xAD, 0x38, 0xDC, 0x16, 0x0F, 0xEB, 0x9E, @@ -304,7 +304,7 @@ const static uint8_t test_output_v1_lite[160] = { #endif -#ifndef XMRIG_NO_SUMO +#ifdef XMRIG_ALGO_CN_HEAVY // "cn-heavy/0" const static uint8_t test_output_v0_heavy[160] = { 0x99, 0x83, 0xF2, 0x1B, 0xDF, 0x20, 0x10, 0xA8, 0xD7, 0x07, 0xBB, 0x2F, 0x14, 0xD7, 0x86, 0x64, @@ -351,7 +351,7 @@ const static uint8_t test_output_tube_heavy[160] = { #endif -#ifndef XMRIG_NO_CN_PICO +#ifdef XMRIG_ALGO_CN_PICO // "cn-pico/trtl" const static uint8_t test_output_pico_trtl[160] = { 0x08, 0xF4, 0x21, 0xD7, 0x83, 0x31, 0x17, 0x30, 0x0E, 0xDA, 0x66, 0xE9, 0x8F, 0x4A, 0x25, 0x69, @@ -368,7 +368,7 @@ const static uint8_t test_output_pico_trtl[160] = { #endif -#ifndef XMRIG_NO_CN_GPU +#ifdef XMRIG_ALGO_CN_GPU // "cn/gpu" const static uint8_t test_output_gpu[160] = { 0xE5, 0x5C, 0xB2, 0x3E, 0x51, 0x64, 0x9A, 0x59, 0xB1, 0x27, 0xB9, 0x6B, 0x51, 0x5F, 0x2B, 0xF7, diff --git a/src/crypto/cn/CryptoNight_x86.h b/src/crypto/cn/CryptoNight_x86.h index c3a89dac..8d6792d2 100644 --- a/src/crypto/cn/CryptoNight_x86.h +++ b/src/crypto/cn/CryptoNight_x86.h @@ -361,7 +361,7 @@ static inline void cn_explode_scratchpad(const __m128i *input, __m128i *output) } -#ifndef XMRIG_NO_CN_GPU +#ifdef XMRIG_ALGO_CN_GPU template void cn_explode_scratchpad_gpu(const uint8_t *input, uint8_t *output) { @@ -708,7 +708,7 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si } -#ifndef XMRIG_NO_CN_GPU +#ifdef XMRIG_ALGO_CN_GPU template void cn_gpu_inner_avx(const uint8_t *spad, uint8_t *lpad); diff --git a/src/workers/CpuThread.cpp b/src/workers/CpuThread.cpp index ddcb36f9..5c98a5b3 100644 --- a/src/workers/CpuThread.cpp +++ b/src/workers/CpuThread.cpp @@ -207,7 +207,7 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a add_asm_func(asm_func_map); add_asm_func(asm_func_map); -# ifndef XMRIG_NO_CN_PICO +# ifdef XMRIG_ALGO_CN_PICO add_asm_func(asm_func_map); # endif @@ -321,7 +321,7 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_TRTL -# ifndef XMRIG_NO_CN_GPU +# ifdef XMRIG_ALGO_CN_GPU cryptonight_single_hash_gpu, nullptr, cryptonight_single_hash_gpu, @@ -391,7 +391,7 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a cryptonight_quad_hash, cryptonight_penta_hash, -# ifndef XMRIG_NO_AEON +# ifdef XMRIG_ALGO_CN_LITE cryptonight_single_hash, cryptonight_double_hash, cryptonight_single_hash, @@ -449,7 +449,7 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_DOUBLE # endif -# ifndef XMRIG_NO_SUMO +# ifdef XMRIG_ALGO_CN_HEAVY cryptonight_single_hash, cryptonight_double_hash, cryptonight_single_hash, @@ -519,7 +519,7 @@ xmrig::CpuThread::cn_hash_fun xmrig::CpuThread::fn(Algo algorithm, AlgoVariant a nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_DOUBLE # endif -# ifndef XMRIG_NO_CN_PICO +# ifdef XMRIG_ALGO_CN_PICO nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_0 nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_1 nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, // VARIANT_TUBE diff --git a/src/workers/MultiWorker.cpp b/src/workers/MultiWorker.cpp index b71ed076..e4a5fb0c 100644 --- a/src/workers/MultiWorker.cpp +++ b/src/workers/MultiWorker.cpp @@ -68,7 +68,7 @@ bool MultiWorker::selfTest() verify(VARIANT_ZLS, test_output_zls) && verify(VARIANT_DOUBLE, test_output_double); -# ifndef XMRIG_NO_CN_GPU +# ifdef XMRIG_ALGO_CN_GPU if (!rc || N > 1) { return rc; } @@ -79,14 +79,14 @@ bool MultiWorker::selfTest() # endif } -# ifndef XMRIG_NO_AEON +# ifdef XMRIG_ALGO_CN_LITE if (m_thread->algorithm() == CRYPTONIGHT_LITE) { return verify(VARIANT_0, test_output_v0_lite) && verify(VARIANT_1, test_output_v1_lite); } # endif -# ifndef XMRIG_NO_SUMO +# ifdef XMRIG_ALGO_CN_HEAVY if (m_thread->algorithm() == CRYPTONIGHT_HEAVY) { return verify(VARIANT_0, test_output_v0_heavy) && verify(VARIANT_XHV, test_output_xhv_heavy) && @@ -94,7 +94,7 @@ bool MultiWorker::selfTest() } # endif -# ifndef XMRIG_NO_CN_PICO +# ifdef XMRIG_ALGO_CN_PICO if (m_thread->algorithm() == CRYPTONIGHT_PICO) { return verify(VARIANT_TRTL, test_output_pico_trtl); }