diff --git a/CMakeLists.txt b/CMakeLists.txt index c1f403af..b0f80a90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,6 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.9) +cmake_policy(SET CMP0069 NEW) + project(xmrig) option(WITH_HWLOC "Enable hwloc support" ON) @@ -31,6 +33,7 @@ option(WITH_DMI "Enable DMI/SMBIOS reader" ON) option(BUILD_STATIC "Build static binary" OFF) option(ARM_TARGET "Force use specific ARM target 8 or 7" 0) option(HWLOC_DEBUG "Enable hwloc debug helpers and log" OFF) +option(WITH_IPO "Enable IPO / LTO optimizations" OFF) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") @@ -82,7 +85,7 @@ set(HEADERS_CRYPTO src/crypto/cn/skein_port.h src/crypto/cn/soft_aes.h src/crypto/common/HugePagesInfo.h - src/crypto/common/MemoryPool.h + src/crypto/common/MemoryPool.hhttps://gcc.gnu.org/onlinedocs/gccint/LTO-Overview.html src/crypto/common/Nonce.h src/crypto/common/portable/mm_malloc.h src/crypto/common/VirtualMemory.h @@ -171,6 +174,19 @@ else() endif() endif() + +if(WITH_IPO) + include(CheckIPOSupported) + check_ipo_supported(RESULT IPO_SUPPORTED OUTPUT IPO_ERROR) + + if( IPO_SUPPORTED ) + message(STATUS "IPO / LTO enabled") + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) + else() + message(STATUS "IPO / LTO not supported: <${IPO_ERROR}>") + endif() +endif() + add_definitions(-DXMRIG_MINER_PROJECT -DXMRIG_JSON_SINGLE_LINE_ARRAY) add_definitions(-D__STDC_FORMAT_MACROS -DUNICODE -D_FILE_OFFSET_BITS=64) diff --git a/src/3rdparty/argon2/CMakeLists.txt b/src/3rdparty/argon2/CMakeLists.txt index e02197be..1a1c5deb 100644 --- a/src/3rdparty/argon2/CMakeLists.txt +++ b/src/3rdparty/argon2/CMakeLists.txt @@ -1,4 +1,5 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.9) +cmake_policy(SET CMP0069 NEW) project(argon2 C) set(CMAKE_C_STANDARD 99) diff --git a/src/3rdparty/hwloc/CMakeLists.txt b/src/3rdparty/hwloc/CMakeLists.txt index 3f159afd..973dc59a 100644 --- a/src/3rdparty/hwloc/CMakeLists.txt +++ b/src/3rdparty/hwloc/CMakeLists.txt @@ -1,4 +1,6 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required(VERSION 3.9) +cmake_policy(SET CMP0069 NEW) + project (hwloc C) include_directories(include) diff --git a/src/3rdparty/libethash/CMakeLists.txt b/src/3rdparty/libethash/CMakeLists.txt index 6a545440..bd97ba0a 100644 --- a/src/3rdparty/libethash/CMakeLists.txt +++ b/src/3rdparty/libethash/CMakeLists.txt @@ -1,4 +1,6 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required(VERSION 3.9) +cmake_policy(SET CMP0069 NEW) + project (ethash C) set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Os")