1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-14 15:11:13 +02:00

Enable Interprocedural Optimization

CMake will now enable linking IPO if the compiler supports it

Signed-off-by: Emily Mabrey <emabrey@tenacityaudio.org>
This commit is contained in:
Emily Mabrey 2021-08-22 11:00:13 -04:00
parent 80cc3f2ff2
commit b650b5aafc
No known key found for this signature in database
GPG Key ID: 6F4EF47256A1B7DC
4 changed files with 22 additions and 11 deletions

@ -156,11 +156,6 @@ set( CMAKE_PREFIX_PATH
${CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH}
) )
# This "is a good thing" but greatly increases link time on Linux
#set( CMAKE_INTERPROCEDURAL_OPTIMIZATION ON )
#set( CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ON )
#set( CMAKE_INTERPROCEDURAL_OPTIMIZATION_DEBUG OFF )
# Set the required C++ standard # Set the required C++ standard
set( CMAKE_CXX_STANDARD 17 ) set( CMAKE_CXX_STANDARD 17 )
set( CMAKE_CXX_STANDARD_REQUIRED ON ) set( CMAKE_CXX_STANDARD_REQUIRED ON )
@ -169,6 +164,20 @@ include( CMakeDependentOption )
project( Tenacity ) project( Tenacity )
#This must appear after the project declaration so it can detect ENABLED_LANGUAGES
include(CheckIPOSupported)
check_ipo_supported(RESULT IPO_SUPPORTED OUTPUT IPO_OUTPUT)
mark_as_advanced( FORCE IPO_SUPPORTED )
if(IPO_SUPPORTED)
set( CMAKE_INTERPROCEDURAL_OPTIMIZATION ON )
set( CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ON )
set( CMAKE_INTERPROCEDURAL_OPTIMIZATION_DEBUG OFF )
add_definitions( -DHAVE_IPO )
message(STATUS "Interprocedural optimization is supported")
else()
message(STATUS "Interprocedural optimization is not supported: ${IPO_OUTPUT}")
endif()
# Use ccache if available # Use ccache if available
find_program( CCACHE_PROGRAM ccache ) find_program( CCACHE_PROGRAM ccache )
mark_as_advanced( FORCE CCACHE_PROGRAM ) mark_as_advanced( FORCE CCACHE_PROGRAM )

@ -41,10 +41,12 @@
** process and the values HAVE_LRINT and HAVE_LRINTF are set accordingly in ** process and the values HAVE_LRINT and HAVE_LRINTF are set accordingly in
** the config.h file. ** the config.h file.
*/ */
#if (defined (WIN32) || defined (_WIN32)) && defined(_MSC_VER) && defined(_M_IX86) #if (defined (WIN32) || defined (_WIN32)) && defined(_MSC_VER) && defined(_M_IX86) && !defined(HAVE_IPO)
// As of Visual Studio 2019 16.9, these functions have been made intrinsic and the build // As of Visual Studio 2019 16.9, these functions have been made intrinsic and the build
// will fail. Unfortunately, the intrinsic versions run a LOT slower than the ones // will fail. Unfortunately, the intrinsic versions run a LOT slower than the ones
// below, so force the compiler to use ours instead. // below, so force the compiler to use ours instead. However, we cannot do this if
// interprocedural optimization is turned on, because that will break the build because we are
// redefining a compiler library helper
#pragma function( lrint, lrintf ) #pragma function( lrint, lrintf )
// Including math.h allows us to use the inline assembler versions without // Including math.h allows us to use the inline assembler versions without
@ -53,7 +55,7 @@
// Without the inline assembler versions, these functions are VERY slow. // Without the inline assembler versions, these functions are VERY slow.
// I also see that the include was part of the original source for this file: // I also see that the include was part of the original source for this file:
// http://www.mega-nerd.com/FPcast/ // http://www.mega-nerd.com/FPcast/
#include <math.h> #include <math.h>
/* Win32 doesn't seem to have these functions. /* Win32 doesn't seem to have these functions.
@ -146,6 +148,6 @@
#include <math.h> #include <math.h>
#define lrint(dbl) ((int)rint(dbl)) #define lrint(dbl) ((int)rint(dbl))
#define lrintf(flt) ((int)rint(flt)) #define lrintf(flt) ((int)rint(flt))
#endif #endif

2
vcpkg

@ -1 +1 @@
Subproject commit 149fdbc4420631ed04a8881642b45b7993335db4 Subproject commit b1ec341bb7d68257f1ffa090a6e3ca5553664c80

@ -348,7 +348,7 @@ bn.ResetPrefs=Reset Preferences
bs.ResetPrefs=Reset Preferences bs.ResetPrefs=Reset Preferences
ca.ResetPrefs=Voleu restablir les preferències? ca.ResetPrefs=Voleu restablir les preferències?
ca_ES0valencia.ResetPrefs=Reset Preferences ca_ES0valencia.ResetPrefs=Reset Preferences
co.ResetPrefs=Reinizià e preferenze ? co.ResetPrefs=Reinizià e preferenze ?
cs.ResetPrefs=Vynulovat nastavení? cs.ResetPrefs=Vynulovat nastavení?
cy.ResetPrefs=Reset Preferences cy.ResetPrefs=Reset Preferences
da.ResetPrefs=Gendan indstillinger? da.ResetPrefs=Gendan indstillinger?