From c87ac8301b15b0daefece32dc42c565927f2289b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Sun, 24 Jan 2021 01:45:50 +0100 Subject: Make use of CMAKE_INTERPROCEDURAL_OPTIMIZATION and enable it for all targets if appropriated. --- CMakeLists.txt | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index a43f49622b..25641fa374 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,10 @@ if(POLICY CMP0042) cmake_policy(SET CMP0042 NEW) endif() +if(POLICY CMP0069) + cmake_policy(SET CMP0069 NEW) +endif() + ####################################################################### # Compilers and toolchains @@ -77,6 +81,14 @@ endif() # # Optimizations # + +include(CheckIPOSupported) +check_ipo_supported(RESULT HAVE_IPO) +if(HAVE_IPO) + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) +endif() + + set(OPTIMIZE "portable" CACHE STRING "Optimization and Tuning (set to off, portable, native, legacy, fastbuild)") message(STATUS "Optimization level: ${OPTIMIZE}") @@ -116,18 +128,18 @@ if(MSVC) if(OPTIMIZE STREQUAL "fastbuild") # /GL : http://msdn.microsoft.com/en-us/library/0zza0de8.aspx # !!! /GL is incompatible with /ZI, which is set by mscvdebug - add_compile_options(/GL-) # Do link-time code generation (and don't show a progress indicator # -- this relies on ANSI control characters and tends to overwhelm # Jenkins logs) Should we turn on PGO ? # http://msdn.microsoft.com/en-us/library/xbf3tbeh.aspx - add_link_options(/LTCG:OFF) - elseif(CMAKE_BUILD_TYPE STREQUAL "Debug") - add_compile_options(/GL-) - else() - add_compile_options(/GL) - add_link_options(/LTCG:NOSTATUS) + + # CMAKE_INTERPROCEDURAL_OPTIMIZATION sets the /GL and /LTCG flags for us + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION FALSE) + elseif(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") + # We need to set it here to false as well to avoid: + # LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION FALSE) endif() if(OPTIMIZE STREQUAL "portable" OR OPTIMIZE STREQUAL "fastbuild") @@ -163,7 +175,9 @@ if(MSVC) endif() endif() elseif(GNU_GCC OR LLVM_CLANG) - if(NOT OPTIMIZE STREQUAL "off") + if(OPTIMIZE STREQUAL "off") + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION FALSE) + else() # Common flags to all optimizations. # -ffast-math will prevent a performance penalty by denormals # (floating point values almost Zero are treated as Zero) @@ -175,7 +189,6 @@ elseif(GNU_GCC OR LLVM_CLANG) -ffast-math -funroll-loops ) - # set -fomit-frame-pointer when we don't profile and are not using # Clang sanitizers. # Note: It is only included in -O on machines where it does not -- cgit v1.2.3 From 20c89c8fa8506a13e50a1e8c6330e0a416164676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Sun, 24 Jan 2021 10:59:36 +0100 Subject: Allow to override CMAKE_INTERPROCEDURAL_OPTIMIZATION --- CMakeLists.txt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 25641fa374..b020a9ea54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,10 +82,13 @@ endif() # Optimizations # -include(CheckIPOSupported) -check_ipo_supported(RESULT HAVE_IPO) -if(HAVE_IPO) - set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) +# CMAKE_INTERPROCEDURAL_OPTIMIZATION can be defined to override the default behaviour. +if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION) + include(CheckIPOSupported) + check_ipo_supported(RESULT HAVE_IPO) + if(HAVE_IPO) + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) + endif() endif() -- cgit v1.2.3 From 1af3d88e9cf6772483266ca7c23900e46dac10b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Sun, 24 Jan 2021 15:47:48 +0100 Subject: Dispose OPTIMIZE="fastbuild" Deal with CMake default flags and enable IPO except for Debug Builds. --- CMakeLists.txt | 76 +++++++++++++++++++++++++--------------------------------- 1 file changed, 33 insertions(+), 43 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index b020a9ea54..8f758eebc4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,7 +83,10 @@ endif() # # CMAKE_INTERPROCEDURAL_OPTIMIZATION can be defined to override the default behaviour. -if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION) +# We keep DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION unset = FALSE for Debug builds to save +# build time during development at the cost of a bigger memory foodprint. +# Note: This is has caused issues on Fedoa https://bugzilla.rpmfusion.org/show_bug.cgi?id=5829 +if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT OPTIMIZE STREQUAL "off") include(CheckIPOSupported) check_ipo_supported(RESULT HAVE_IPO) if(HAVE_IPO) @@ -91,7 +94,6 @@ if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION) endif() endif() - set(OPTIMIZE "portable" CACHE STRING "Optimization and Tuning (set to off, portable, native, legacy, fastbuild)") message(STATUS "Optimization level: ${OPTIMIZE}") @@ -115,37 +117,19 @@ if(MSVC) # http://msdn.microsoft.com/en-us/library/xsa71f43.aspx # http://msdn.microsoft.com/en-us/library/bxwfs976.aspx add_compile_options(/Gy) - add_link_options(/OPT:REF /OPT:ICF) - - # http://msdn.microsoft.com/en-us/library/59a3b321.aspx - # In general, you should pick /O2 over /Ox - add_compile_options($<$>:/O2>) - - # Remove /RTC1 flag (conflicts with /O2) - string(REGEX REPLACE "/RTC[^ ]*" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - - # Re-add /RTC1 for Debug builds - add_compile_options($<$:/RTC1>) - - if(OPTIMIZE STREQUAL "fastbuild") - # /GL : http://msdn.microsoft.com/en-us/library/0zza0de8.aspx - # !!! /GL is incompatible with /ZI, which is set by mscvdebug - - # Do link-time code generation (and don't show a progress indicator - # -- this relies on ANSI control characters and tends to overwhelm - # Jenkins logs) Should we turn on PGO ? - # http://msdn.microsoft.com/en-us/library/xbf3tbeh.aspx - - # CMAKE_INTERPROCEDURAL_OPTIMIZATION sets the /GL and /LTCG flags for us - set(CMAKE_INTERPROCEDURAL_OPTIMIZATION FALSE) - elseif(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") - # We need to set it here to false as well to avoid: - # LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification - set(CMAKE_INTERPROCEDURAL_OPTIMIZATION FALSE) + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + #optimize Debug Builds as well, to have "normal" behaviour of mixxx during development + add_compile_options(/O2) + # Remove /RTC1 flag set by CMAKE by default (conflicts with /O2) + string(REGEX REPLACE "/RTC[^ ]*" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + else() + # Squeez binary in Release builds + add_link_options(/OPT:REF /OPT:ICF) + # Note: CMAKE_INTERPROCEDURAL_OPTIMIZATION sets the /GL and /LTCG flags for us endif() - if(OPTIMIZE STREQUAL "portable" OR OPTIMIZE STREQUAL "fastbuild") + if(OPTIMIZE STREQUAL "portable") if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8) # Target architecture is x86 with SSE and SSE2 message(STATUS "x86 Enabling SS2 CPU optimizations (>= Pentium 4)") @@ -162,25 +146,31 @@ if(MSVC) # Define gcc/clang style defines for SSE and SSE2 for compatibility add_compile_definitions("__SSE__" "__SSE2__") endif() - # Define the target processor instruction and other compiler optimization flags here: - # https://docs.microsoft.com/en-us/cpp/build/reference/arch-x64?view=msvc-160 - # add_compile_options(/arch:AVX512) - message(FATAL_ERROR "User need to set the MSVC compiler flags for the native processor here!") + # Define the target processor instruction and other compiler optimization flags here: + # https://docs.microsoft.com/en-us/cpp/build/reference/arch-x64?view=msvc-160 + # add_compile_options(/arch:AVX512) + message(FATAL_ERROR "User need to set the MSVC compiler flags for the native processor here!") add_compile_options("/favor:${CMAKE_SYSTEM_PROCESSOR}") elseif(OPTIMIZE STREQUAL "legacy") - if(CMAKE_SIZEOF_VOID_P EQUAL 8) - message("Enabling pure x64 instruction set (without AVX etc.)") - else() - message("Enabling pure i386 instruction set (without SSE/SSE2 etc.)") - endif() + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + message("Enabling pure x64 instruction set (without AVX etc.)") + else() + message("Enabling pure i386 instruction set (without SSE/SSE2 etc.)") + endif() else() message(FATAL_ERROR "Invalid value passed to OPTIMIZE option: ${OPTIMIZE}") endif() + else() + # OPTIMIZE=off + if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + #Remove optimize flags set by cmake defaults + string(REPLACE "/O2" "/Od" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REPLACE "/Od2" "/Od0" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + add_compile_options(/RTC1) + endif() endif() elseif(GNU_GCC OR LLVM_CLANG) - if(OPTIMIZE STREQUAL "off") - set(CMAKE_INTERPROCEDURAL_OPTIMIZATION FALSE) - else() + if(NOT OPTIMIZE STREQUAL "off") # Common flags to all optimizations. # -ffast-math will prevent a performance penalty by denormals # (floating point values almost Zero are treated as Zero) @@ -200,7 +190,7 @@ elseif(GNU_GCC OR LLVM_CLANG) add_compile_options(-fomit-frame-pointer) endif() - if(OPTIMIZE STREQUAL "portable" OR OPTIMIZE STREQUAL "fastbuild") + if(OPTIMIZE STREQUAL "portable") # portable: sse2 CPU (>= Pentium 4) if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i[3456]86|x86|x64|x86_64|AMD64)$") message(STATUS "Enabling SS2 CPU optimizations (>= Pentium 4)") -- cgit v1.2.3 From 05a2bef2e783197a24136d2b6f59836ec0dbabb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Mon, 25 Jan 2021 07:58:38 +0100 Subject: Fix flags for the Debug build types --- CMakeLists.txt | 63 +++++++++++++++++++++------------------------------------- 1 file changed, 23 insertions(+), 40 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f758eebc4..055aaa56fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,7 +94,7 @@ if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION AND NOT CMAKE_BUILD_TYPE STREQ endif() endif() -set(OPTIMIZE "portable" CACHE STRING "Optimization and Tuning (set to off, portable, native, legacy, fastbuild)") +set(OPTIMIZE "portable" CACHE STRING "Optimization and Tuning (set to off, portable, native, legacy)") message(STATUS "Optimization level: ${OPTIMIZE}") if(MSVC) @@ -120,9 +120,15 @@ if(MSVC) if(CMAKE_BUILD_TYPE STREQUAL "Debug") #optimize Debug Builds as well, to have "normal" behaviour of mixxx during development - add_compile_options(/O2) + string(REPLACE "/Od" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") + string(REPLACE "/Od" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS}") + string(REPLACE "/Ob0" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") + string(REPLACE "/Ob0" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS}") + + add_compile_options(/O2) # this implies /Od2 # Remove /RTC1 flag set by CMAKE by default (conflicts with /O2) - string(REGEX REPLACE "/RTC[^ ]*" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") + string(REPLACE "/RTC1" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}") else() # Squeez binary in Release builds add_link_options(/OPT:REF /OPT:ICF) @@ -162,10 +168,21 @@ if(MSVC) endif() else() # OPTIMIZE=off - if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + if(CMAKE_BUILD_TYPE STREQUAL "Release") + #Remove optimize flags set by cmake defaults + string(REPLACE "/O2" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") + string(REPLACE "/O2" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") + string(REPLACE "/Ob2" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") + string(REPLACE "/Ob2" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") + add_compile_options(/Od) # this implies /Ob0 + add_compile_options(/RTC1) + elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") #Remove optimize flags set by cmake defaults - string(REPLACE "/O2" "/Od" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - string(REPLACE "/Od2" "/Od0" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REPLACE "/O2" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") + string(REPLACE "/O2" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}") + string(REPLACE "/Ob2" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") + string(REPLACE "/Ob2" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}") + add_compile_options(/Od) # this implies /Ob0 add_compile_options(/RTC1) endif() endif() @@ -1540,40 +1557,6 @@ set_target_properties(mixxx-qrc PROPERTIES AUTORCC ON) target_sources(mixxx PRIVATE $) target_sources(mixxx-test PRIVATE $) -if(UNIX AND USE_SYMLINKS) - add_custom_target(mixxx-res - COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_SOURCE_DIR}/res" "${CMAKE_CURRENT_BINARY_DIR}/res" - COMMENT "Symlinking resources to build directory..." - ) - add_custom_target(mixxx-script - COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_SOURCE_DIR}/script" "${CMAKE_CURRENT_BINARY_DIR}/script" - COMMENT "Symlinking to build directory..." - ) -elseif(WIN32) - file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/res" CMAKE_CURRENT_SOURCE_RES_DIR_NATIVE) - file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/res/" CMAKE_CURRENT_BINARY_RES_DIR_NATIVE) - add_custom_target(mixxx-res - COMMAND xcopy ${CMAKE_CURRENT_SOURCE_RES_DIR_NATIVE} ${CMAKE_CURRENT_BINARY_RES_DIR_NATIVE} /s /d /q /y - COMMENT "Copying missing or modified resources files to build directory..." - ) - file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/script" CMAKE_CURRENT_SOURCE_SCRIPT_DIR_NATIVE) - file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/script/" CMAKE_CURRENT_BINARY_SCRIPT_DIR_NATIVE) - add_custom_target(mixxx-script - COMMAND xcopy ${CMAKE_CURRENT_SOURCE_SCRIPT_DIR_NATIVE} ${CMAKE_CURRENT_BINARY_SCRIPT_DIR_NATIVE} /s /d /q /y - COMMENT "Copying missing or modified QScriptEngine extension files to build directory..." - ) -else() - add_custom_target(mixxx-res - COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/res" "${CMAKE_CURRENT_BINARY_DIR}/res" - COMMENT "Copying all resources files to build directory..." - ) - add_custom_target(mixxx-script - COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/script" "${CMAKE_CURRENT_BINARY_DIR}/script" - COMMENT "Copying all QScriptEngine extension files to build directory..." - ) -endif() -add_dependencies(mixxx-lib mixxx-res mixxx-script) - file(READ src/_version.h MIXXX_VERSION_FILECONTENT) string(REGEX REPLACE "^.*#define MIXXX_VERSION \"(.*)\".*$" "\\1" MIXXX_VERSION "${MIXXX_VERSION_FILECONTENT}") # a dummy configure to force a reconfigure when the version changes -- cgit v1.2.3 From 9ff2365400ea442619252ff40e470e9aeaa1da26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Mon, 25 Jan 2021 19:18:07 +0100 Subject: move optimize check up and make it case insensitive --- CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 055aaa56fc..7fda7c5d07 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,6 +82,10 @@ endif() # Optimizations # +set(OPTIMIZE "portable" CACHE STRING "Optimization and Tuning (set to off, portable, native, legacy)") +string(TOLOWER "${OPTIMIZE}" OPTIMIZE) +message(STATUS "Optimization level: ${OPTIMIZE}") + # CMAKE_INTERPROCEDURAL_OPTIMIZATION can be defined to override the default behaviour. # We keep DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION unset = FALSE for Debug builds to save # build time during development at the cost of a bigger memory foodprint. @@ -94,9 +98,6 @@ if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION AND NOT CMAKE_BUILD_TYPE STREQ endif() endif() -set(OPTIMIZE "portable" CACHE STRING "Optimization and Tuning (set to off, portable, native, legacy)") -message(STATUS "Optimization level: ${OPTIMIZE}") - if(MSVC) # Microsoft Visual Studio Compiler if(CMAKE_SIZEOF_VOID_P EQUAL 8) -- cgit v1.2.3 From 42bc5939982a3c94ef8be362b5ede5128dd99db7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Mon, 25 Jan 2021 21:45:50 +0100 Subject: Improve comments --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 7fda7c5d07..0f030387c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,8 +88,8 @@ message(STATUS "Optimization level: ${OPTIMIZE}") # CMAKE_INTERPROCEDURAL_OPTIMIZATION can be defined to override the default behaviour. # We keep DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION unset = FALSE for Debug builds to save -# build time during development at the cost of a bigger memory foodprint. -# Note: This is has caused issues on Fedoa https://bugzilla.rpmfusion.org/show_bug.cgi?id=5829 +# build time during development at the cost of a bigger memory foodprint at run-time. +# Note: This is has caused issues on Fedora https://bugzilla.rpmfusion.org/show_bug.cgi?id=5829 if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT OPTIMIZE STREQUAL "off") include(CheckIPOSupported) check_ipo_supported(RESULT HAVE_IPO) -- cgit v1.2.3 From 822922fbdaa1f9a06a598ddb42a25f8f603fd24a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Tue, 26 Jan 2021 20:52:09 +0100 Subject: Improve comments --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f030387c4..1fc13d9280 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,8 +87,8 @@ string(TOLOWER "${OPTIMIZE}" OPTIMIZE) message(STATUS "Optimization level: ${OPTIMIZE}") # CMAKE_INTERPROCEDURAL_OPTIMIZATION can be defined to override the default behaviour. -# We keep DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION unset = FALSE for Debug builds to save -# build time during development at the cost of a bigger memory foodprint at run-time. +# We keep CMAKE_INTERPROCEDURAL_OPTIMIZATION unset (IPO disabled) for Debug builds to save +# build time during development at the cost of a bigger memory footprint at run-time. # Note: This is has caused issues on Fedora https://bugzilla.rpmfusion.org/show_bug.cgi?id=5829 if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT OPTIMIZE STREQUAL "off") include(CheckIPOSupported) -- cgit v1.2.3 From 09598849a1baaae954139710c257841653e4ac5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Wed, 27 Jan 2021 22:52:20 +0100 Subject: Fix typo. Co-authored-by: Be --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fc13d9280..def9c2490c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -131,7 +131,7 @@ if(MSVC) string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") string(REPLACE "/RTC1" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}") else() - # Squeez binary in Release builds + # Squeeze binary in Release builds add_link_options(/OPT:REF /OPT:ICF) # Note: CMAKE_INTERPROCEDURAL_OPTIMIZATION sets the /GL and /LTCG flags for us endif() -- cgit v1.2.3 From 1c49c0dd4f217e267ad573642eba81072f4bcea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Thu, 25 Feb 2021 08:24:59 +0100 Subject: disble the CMAKE_INTERPROCEDURAL_OPTIMIZATION code but keep it as comment for documentation purpose. --- CMakeLists.txt | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index fe8cc12bf9..3a902e897c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,16 +87,18 @@ string(TOLOWER "${OPTIMIZE}" OPTIMIZE) message(STATUS "Optimization level: ${OPTIMIZE}") # CMAKE_INTERPROCEDURAL_OPTIMIZATION can be defined to override the default behaviour. -# We keep CMAKE_INTERPROCEDURAL_OPTIMIZATION unset (IPO disabled) for Debug builds to save -# build time during development at the cost of a bigger memory footprint at run-time. -# Note: This is has caused issues on Fedora https://bugzilla.rpmfusion.org/show_bug.cgi?id=5829 -if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT OPTIMIZE STREQUAL "off") - include(CheckIPOSupported) - check_ipo_supported(RESULT HAVE_IPO) - if(HAVE_IPO) - set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) - endif() -endif() +# We keep CMAKE_INTERPROCEDURAL_OPTIMIZATION unset (IPO disabled) to save +# build time at the cost of a bigger memory footprint at run-time. +# See https://github.com/mixxxdj/mixxx/pull/3589 for some test results +# Note: IPO has caused issues on Fedora https://bugzilla.rpmfusion.org/show_bug.cgi?id=5829 +# Uncomment the following code to enable IPO for Release builds +#if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT OPTIMIZE STREQUAL "off") +# include(CheckIPOSupported) +# check_ipo_supported(RESULT HAVE_IPO) +# if(HAVE_IPO) +# set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) +# endif() +#endif() if(MSVC) # Microsoft Visual Studio Compiler -- cgit v1.2.3