mirror of
https://github.com/monero-project/monero.git
synced 2024-10-01 11:49:47 -04:00
User setting to turn LTO on and off
This isn't currently working on mingw
This commit is contained in:
parent
e1dfd58bdb
commit
729d4bb91d
@ -92,11 +92,6 @@ else()
|
||||
else()
|
||||
set(WARNINGS "${WARNINGS} -Wlogical-op -Wno-error=maybe-uninitialized")
|
||||
endif()
|
||||
# Since gcc 4.9 the LTO format is non-standard (slim), so we need the gcc-specific ar and ranlib binaries
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9.0))
|
||||
set(CMAKE_AR "gcc-ar")
|
||||
set(CMAKE_RANLIB "gcc-ranlib")
|
||||
endif()
|
||||
if(MINGW)
|
||||
set(WARNINGS "${WARNINGS} -Wno-error=unused-value -Wno-error=unused-but-set-variable")
|
||||
set(MINGW_FLAG "${MINGW_FLAG} -DWIN32_LEAN_AND_MEAN")
|
||||
@ -121,14 +116,23 @@ else()
|
||||
else()
|
||||
set(DEBUG_FLAGS "-g3 -O0")
|
||||
endif()
|
||||
|
||||
set(RELEASE_FLAGS "-Ofast -DNDEBUG -Wno-unused-variable")
|
||||
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
|
||||
set(USE_LTO false CACHE BOOL "Use Link-Time Optimization (Release mode only)")
|
||||
if(USE_LTO)
|
||||
# There is a clang bug that does not allow to compile code that uses AES-NI intrinsics if -flto is enabled
|
||||
set(RELEASE_FLAGS "${RELEASE_FLAGS} -flto")
|
||||
if(STATIC)
|
||||
set(RELEASE_FLAGS "${RELEASE_FLAGS} -ffat-lto-objects")
|
||||
endif()
|
||||
#if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT MINGW)
|
||||
# set(RELEASE_FLAGS "${RELEASE_FLAGS} -fno-fat-lto-objects")
|
||||
#endif()
|
||||
# Since gcc 4.9 the LTO format is non-standard (slim), so we need the gcc-specific ar and ranlib binaries
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9.0))
|
||||
set(CMAKE_AR "gcc-ar")
|
||||
set(CMAKE_RANLIB "gcc-ranlib")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${DEBUG_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEBUG_FLAGS}")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${RELEASE_FLAGS}")
|
||||
|
Loading…
Reference in New Issue
Block a user