Browse Source

Enable Interprocedural Optimization

CMake will now enable linking IPO if the compiler supports it

Signed-off-by: Emily Mabrey <emabrey@tenacityaudio.org>
pull/545/head
Emily Mabrey 3 months ago
parent
commit
b650b5aafc
No known key found for this signature in database GPG Key ID: 6F4EF47256A1B7DC
  1. 19
      CMakeLists.txt
  2. 10
      src/float_cast.h
  3. 2
      vcpkg
  4. 2
      win/Inno_Setup_Wizard/tenacity.iss.in

19
CMakeLists.txt

@ -156,11 +156,6 @@ set( 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( CMAKE_CXX_STANDARD 17 )
set( CMAKE_CXX_STANDARD_REQUIRED ON )
@ -169,6 +164,20 @@ include( CMakeDependentOption )
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
find_program( CCACHE_PROGRAM ccache )
mark_as_advanced( FORCE CCACHE_PROGRAM )

10
src/float_cast.h

@ -41,10 +41,12 @@
** process and the values HAVE_LRINT and HAVE_LRINTF are set accordingly in
** 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
// 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 )
// 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.
// I also see that the include was part of the original source for this file:
// http://www.mega-nerd.com/FPcast/
#include <math.h>
/* Win32 doesn't seem to have these functions.
@ -146,6 +148,6 @@
#include <math.h>
#define lrint(dbl) ((int)rint(dbl))
#define lrintf(flt) ((int)rint(flt))
#define lrintf(flt) ((int)rint(flt))
#endif

2
vcpkg

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

2
win/Inno_Setup_Wizard/tenacity.iss.in

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

Loading…
Cancel
Save