This commit is contained in:
Christoph Oelckers 2013-11-29 12:53:31 +01:00
commit 5624b1ace0
2 changed files with 31 additions and 14 deletions

View file

@ -92,6 +92,19 @@ if( MSVC )
# Set floating point model to fast or the GL render will suffer for it. # Set floating point model to fast or the GL render will suffer for it.
set( ALL_C_FLAGS "/GF /Gy /GR- /fp:fast" ) set( ALL_C_FLAGS "/GF /Gy /GR- /fp:fast" )
if( CMAKE_SIZEOF_VOID_P MATCHES "4")
# SSE2 option (mostly to switch it off in VC2012 and later where it's the default
option (ZDOOM_USE_SSE2 "Use SSE2 instruction set")
if (ZDOOM_USE_SSE2)
set( ALL_C_FLAGS "${ALL_C_FLAGS} /arch:SSE2")
else (ZDOOM_USE_SSE2)
if (MSVC_VERSION GREATER 1699)
# On Visual C++ 2012 and later SSE2 is the default, so we need to switch it off explicitly
set( ALL_C_FLAGS "${ALL_C_FLAGS} /arch:IA32")
endif (MSVC_VERSION GREATER 1699)
endif (ZDOOM_USE_SSE2)
endif( CMAKE_SIZEOF_VOID_P MATCHES "4")
# Avoid CRT DLL dependancies in release builds, optionally generate assembly output for checking crash locations. # Avoid CRT DLL dependancies in release builds, optionally generate assembly output for checking crash locations.
option( ZDOOM_GENERATE_ASM "Generate assembly output." OFF ) option( ZDOOM_GENERATE_ASM "Generate assembly output." OFF )
if( ZDOOM_GENERATE_ASM ) if( ZDOOM_GENERATE_ASM )
@ -99,6 +112,7 @@ if( MSVC )
else( ZDOOM_GENERATE_ASM ) else( ZDOOM_GENERATE_ASM )
set( REL_C_FLAGS "/MT /Oy /Oi" ) set( REL_C_FLAGS "/MT /Oy /Oi" )
endif( ZDOOM_GENERATE_ASM ) endif( ZDOOM_GENERATE_ASM )
# Debug allocations in debug builds # Debug allocations in debug builds
set( DEB_C_FLAGS "/D _CRTDBG_MAP_ALLOC /MTd" ) set( DEB_C_FLAGS "/D _CRTDBG_MAP_ALLOC /MTd" )

View file

@ -398,20 +398,23 @@ endif( APPLE )
set( SSE_MATTERS NO ) set( SSE_MATTERS NO )
# SSE only matters on 32-bit targets. We check compiler flags to know if we can do it. # with global use of SSE 2 we do not need special handling for selected files
if( CMAKE_SIZEOF_VOID_P MATCHES "4" AND NOT CMAKE_OSX_ARCHITECTURES MATCHES ppc ) if (NOT ZDOOM_USE_SSE2)
CHECK_CXX_COMPILER_FLAG( "-msse2 -mfpmath=sse" CAN_DO_MFPMATH ) # SSE only matters on 32-bit targets. We check compiler flags to know if we can do it.
CHECK_CXX_COMPILER_FLAG( -arch:SSE2 CAN_DO_ARCHSSE2 ) if( CMAKE_SIZEOF_VOID_P MATCHES "4" AND NOT CMAKE_OSX_ARCHITECTURES MATCHES ppc )
if( CAN_DO_MFPMATH ) CHECK_CXX_COMPILER_FLAG( "-msse2 -mfpmath=sse" CAN_DO_MFPMATH )
set( SSE1_ENABLE "-msse -mfpmath=sse" ) CHECK_CXX_COMPILER_FLAG( -arch:SSE2 CAN_DO_ARCHSSE2 )
set( SSE2_ENABLE "-msse2 -mfpmath=sse" ) if( CAN_DO_MFPMATH )
set( SSE_MATTERS YES ) set( SSE1_ENABLE "-msse -mfpmath=sse" )
elseif( CAN_DO_ARCHSSE2 ) set( SSE2_ENABLE "-msse2 -mfpmath=sse" )
set( SSE1_ENABLE -arch:SSE ) set( SSE_MATTERS YES )
set( SSE2_ENABLE -arch:SSE2 ) elseif( CAN_DO_ARCHSSE2 )
set( SSE_MATTERS YES ) set( SSE1_ENABLE -arch:SSE )
endif( CAN_DO_MFPMATH ) set( SSE2_ENABLE -arch:SSE2 )
endif( CMAKE_SIZEOF_VOID_P MATCHES "4" AND NOT CMAKE_OSX_ARCHITECTURES MATCHES ppc ) set( SSE_MATTERS YES )
endif( CAN_DO_MFPMATH )
endif( CMAKE_SIZEOF_VOID_P MATCHES "4" AND NOT CMAKE_OSX_ARCHITECTURES MATCHES ppc )
endif (NOT ZDOOM_USE_SSE2)
if( SSE_MATTERS ) if( SSE_MATTERS )
if( WIN32 ) if( WIN32 )