diff --git a/CHANGELOG.md b/CHANGELOG.md index a56048220..30e533594 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# v3.1.2 +- Many RandomX optimizations and fixes. + - [#1132](https://github.com/xmrig/xmrig/issues/1132) Fixed build on CentOS 7. + - [#1163](https://github.com/xmrig/xmrig/pull/1163) Optimized soft AES code, up to +30% hashrate on CPU without AES support and other optimizations. + - [#1166](https://github.com/xmrig/xmrig/pull/1166) Fixed crash when initialize dataset with big threads count (eg 272). + - [#1168](https://github.com/xmrig/xmrig/pull/1168) Optimized loading from scratchpad. +- [#1128](https://github.com/xmrig/xmrig/issues/1128) Fixed CMake 2.8 compatibility. + # v3.1.1 - [#1133](https://github.com/xmrig/xmrig/issues/1133) Fixed syslog regression. - [#1138](https://github.com/xmrig/xmrig/issues/1138) Fixed multiple network bugs. diff --git a/cmake/flags.cmake b/cmake/flags.cmake index bc441dd03..97f22f3c1 100644 --- a/cmake/flags.cmake +++ b/cmake/flags.cmake @@ -2,6 +2,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD 11) +set(CMAKE_C_STANDARD 99) +set(CMAKE_C_STANDARD_REQUIRED ON) + if ("${CMAKE_BUILD_TYPE}" STREQUAL "") set(CMAKE_BUILD_TYPE Release) endif() @@ -13,11 +16,10 @@ endif() include(CheckSymbolExists) if (CMAKE_CXX_COMPILER_ID MATCHES GNU) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-strict-aliasing") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Ofast") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fexceptions -fno-rtti -Wno-class-memaccess") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fexceptions -fno-rtti -Wno-strict-aliasing -Wno-class-memaccess") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast -s") if (XMRIG_ARMv8) @@ -46,6 +48,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU) add_definitions(/D_GNU_SOURCE) if (${CMAKE_VERSION} VERSION_LESS "3.1.0") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") endif() diff --git a/doc/build/CMAKE_OPTIONS.md b/doc/build/CMAKE_OPTIONS.md new file mode 100644 index 000000000..8cb66eecb --- /dev/null +++ b/doc/build/CMAKE_OPTIONS.md @@ -0,0 +1,39 @@ +# CMake options +This document contains list of useful cmake options. + +## Algorithms + +* **`-DWITH_CN_LITE=OFF`** disable all CryptoNight-Lite algorithms (`cn-lite/0`, `cn-lite/1`). +* **`-DWITH_CN_HEAVY=OFF`** disable all CryptoNight-Heavy algorithms (`cn-heavy/0`, `cn-heavy/xhv`, `cn-heavy/tube`). +* **`-DWITH_CN_PICO=OFF`** disable CryptoNight-Pico algorithm (`cn-pico`). +* **`-DWITH_CN_GPU=OFF`** disable CryptoNight-GPU algorithm (`cn/gpu`). +* **`-DWITH_RANDOMX=OFF`** disable RandomX algorithms (`rx/loki`, `rx/wow`). +* **`-DWITH_ARGON2=OFF`** disable Argon2 algorithms (`argon2/chukwa`, `argon2/wrkz`). + +## Features + +* **`-DWITH_HWLOC=OFF`** +disable [hwloc](https://github.com/xmrig/xmrig/issues/1077) support. +Disabling this feature is not recommended in most cases. +This feature add external dependency to libhwloc (1.10.0+) (except MSVC builds). +* **`-DWITH_LIBCPUID=OFF`** disable built in libcpuid support, this feature always disabled if hwloc enabled, if both hwloc and libcpuid disabled auto configuration for CPU will very limited. +* **`-DWITH_HTTP=OFF`** disable built in HTTP support, this feature used for HTTP API and daemon (solo mining) support. +* **`-DWITH_TLS=OFF`** disable SSL/TLS support (secure connections to pool). This feature add external dependency to OpenSSL. +* **`-DWITH_ASM=OFF`** disable assembly optimizations for modern CryptoNight algorithms. +* **`-DWITH_EMBEDDED_CONFIG=ON`** Enable [embedded](https://github.com/xmrig/xmrig/issues/957) config support. + +## Debug options + +* **`-DWITH_DEBUG_LOG=ON`** enable debug log (mostly network requests). +* **`-DHWLOC_DEBUG=ON`** enable some debug log for hwloc. +* **`-DCMAKE_BUILD_TYPE=Debug`** enable debug build, only useful for investigate crashes, this option slow down miner. + +## Special build options + +* **`-DXMRIG_DEPS=`** path to precompiled dependensices https://github.com/xmrig/xmrig-deps +* **`-DARM_TARGET=`** override ARM target, possible values `7` (ARMv7) and `8` (ARMv8). +* **`-DUV_INCLUDE_DIR=`** custom path to libuv headers. +* **`-DUV_LIBRARY=`** custom path to libuv library. +* **`-DHWLOC_INCLUDE_DIR=`** custom path to hwloc headers. +* **`-DHWLOC_LIBRARY=`** custom path to hwloc library. +* **`-DOPENSSL_ROOT_DIR=`** custom path to OpenSSL. diff --git a/src/3rdparty/argon2/CMakeLists.txt b/src/3rdparty/argon2/CMakeLists.txt index 30900b0bc..f77835f3b 100644 --- a/src/3rdparty/argon2/CMakeLists.txt +++ b/src/3rdparty/argon2/CMakeLists.txt @@ -1,23 +1,23 @@ -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 2.8) -project(Argon2 C) -set(ARGON2_VERSION 1.0) +project(argon2 C) set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD_REQUIRED ON) include(CheckCSourceCompiles) -add_library(argon2 STATIC +set(ARGON2_SOURCES lib/argon2.c lib/core.c lib/encoding.c lib/genkat.c lib/impl-select.c lib/blake2/blake2.c -) + ) -target_include_directories(argon2 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) -target_include_directories(argon2 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/lib) +set(ARGON2_X86_64_ENABLED ON) +set(ARGON2_X86_64_LIBS argon2-sse2 argon2-ssse3 argon2-xop argon2-avx2 argon2-avx512f) +set(ARGON2_X86_64_SOURCES arch/x86_64/lib/argon2-arch.c arch/x86_64/lib/cpu-flags.c) if (CMAKE_C_COMPILER_ID MATCHES MSVC) function(add_feature_impl FEATURE MSVC_FLAG DEF) @@ -28,7 +28,6 @@ if (CMAKE_C_COMPILER_ID MATCHES MSVC) target_compile_options(argon2-${FEATURE} PRIVATE ${MSVC_FLAG}) target_compile_definitions(argon2-${FEATURE} PRIVATE ${DEF}) - target_link_libraries(argon2 PUBLIC argon2-${FEATURE}) endfunction() add_feature_impl(sse2 "" HAVE_SSE2) @@ -36,8 +35,6 @@ if (CMAKE_C_COMPILER_ID MATCHES MSVC) add_feature_impl(xop "" HAVE_XOP) add_feature_impl(avx2 "/arch:AVX2" HAVE_AVX2) add_feature_impl(avx512f "/arch:AVX512F" HAVE_AVX512F) - - target_sources(argon2 PRIVATE arch/x86_64/lib/argon2-arch.c arch/x86_64/lib/cpu-flags.c) elseif (NOT XMRIG_ARM AND CMAKE_SIZEOF_VOID_P EQUAL 8) function(add_feature_impl FEATURE GCC_FLAG DEF) add_library(argon2-${FEATURE} STATIC arch/x86_64/lib/argon2-${FEATURE}.c) @@ -67,8 +64,6 @@ elseif (NOT XMRIG_ARM AND CMAKE_SIZEOF_VOID_P EQUAL 8) message("-- argon2: feature '${FEATURE}' detected!") target_compile_definitions(argon2-${FEATURE} PRIVATE ${DEF}) endif() - - target_link_libraries(argon2 PUBLIC argon2-${FEATURE}) endfunction() add_feature_impl(sse2 -msse2 HAVE_SSE2) @@ -76,8 +71,18 @@ elseif (NOT XMRIG_ARM AND CMAKE_SIZEOF_VOID_P EQUAL 8) add_feature_impl(xop -mxop HAVE_XOP) add_feature_impl(avx2 -mavx2 HAVE_AVX2) add_feature_impl(avx512f -mavx512f HAVE_AVX512F) - - target_sources(argon2 PRIVATE arch/x86_64/lib/argon2-arch.c arch/x86_64/lib/cpu-flags.c) else() - target_sources(argon2 PRIVATE arch/generic/lib/argon2-arch.c) + set(ARGON2_X86_64_ENABLED OFF) + list(APPEND ARGON2_SOURCES arch/generic/lib/argon2-arch.c) endif() + +if (ARGON2_X86_64_ENABLED) + set(ARGON2_LIBS ${ARGON2_X86_64_LIBS}) + list(APPEND ARGON2_SOURCES ${ARGON2_X86_64_SOURCES}) +endif() + +add_library(argon2 STATIC ${ARGON2_SOURCES}) +target_link_libraries(argon2 ${ARGON2_LIBS}) + +target_include_directories(argon2 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) +target_include_directories(argon2 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/lib)