- applied fast math flags to C and C++ files

Avoid copy-paste using CMake macro
This commit is contained in:
alexey.lysiuk 2019-10-05 14:41:21 +03:00
parent ace677b8a3
commit c09f196141
14 changed files with 31 additions and 31 deletions

View file

@ -143,6 +143,19 @@ if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
set( PROFILE 0 CACHE BOOL "Enable profiling with gprof for Debug and RelWithDebInfo build types." )
endif()
# Fast math flags, required by some subprojects
set( ZD_FASTMATH_FLAG "" )
if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
set( ZD_FASTMATH_FLAG "-ffast-math -ffp-contract=fast" )
elseif( MSVC )
set( ZD_FASTMATH_FLAG "/fp:fast" )
endif()
macro( use_fast_math )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ZD_FASTMATH_FLAG}" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ZD_FASTMATH_FLAG}" )
endmacro()
option( NO_OPENAL "Disable OpenAL sound support" OFF )
find_package( BZip2 )
@ -305,14 +318,6 @@ if (HAVE_VULKAN)
add_subdirectory( libraries/glslang/OGLCompilersDLL )
endif()
# Fast math flags, required by some subprojects
set( ZD_FASTMATH_FLAG "" )
if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
set( ZD_FASTMATH_FLAG "-ffast-math -ffp-contract=fast" )
elseif( MSVC )
set( ZD_FASTMATH_FLAG "/fp:fast" )
endif()
if( ZLIB_FOUND AND NOT FORCE_INTERNAL_ZLIB )
message( STATUS "Using system zlib, includes found at ${ZLIB_INCLUDE_DIR}" )
else()

View file

@ -1,6 +1,7 @@
cmake_minimum_required( VERSION 2.8.7 )
make_release_only()
use_fast_math()
add_definitions(-DADLMIDI_DISABLE_MIDI_SEQUENCER)
@ -8,8 +9,6 @@ if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -fomit-frame-pointer" )
endif()
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ZD_FASTMATH_FLAG}")
add_library( adl STATIC
adldata.cpp
adlmidi.cpp

View file

@ -1,6 +1,7 @@
cmake_minimum_required( VERSION 2.8.7 )
make_release_only()
use_fast_math()
include( CheckFunctionExists )
include( CheckCXXCompilerFlag )
@ -14,9 +15,6 @@ if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
endif()
endif()
# Enable fast flag for dumb
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ZD_FASTMATH_FLAG}" )
CHECK_FUNCTION_EXISTS( itoa ITOA_EXISTS )
if( NOT ITOA_EXISTS )
add_definitions( -DNEED_ITOA=1 )

View file

@ -32,8 +32,7 @@ if( MSVC )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4101 /wd4800 /wd4702 /wd4706 /wd4805 /wd4310 /wd4244 /wd4456 /wd4459 /wd4146 /wd4127 /wd4458 /wd4267 /wd4804")
endif()
# Enable fast flag for GME
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ZD_FASTMATH_FLAG}" )
use_fast_math()
# Default emulators to build (all of them! ;)
# [ZDoom] No options, enable all of them by default.

View file

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 2.8.12)
make_release_only()
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ZD_FASTMATH_FLAG}" )
use_fast_math()
# Request C++11
if(${CMAKE_VERSION} VERSION_LESS 3.1)

View file

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 2.8.12)
make_release_only()
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ZD_FASTMATH_FLAG}" )
use_fast_math()
if(WIN32)
add_subdirectory(OSDependent/Windows)

View file

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 2.8.12)
make_release_only()
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ZD_FASTMATH_FLAG}" )
use_fast_math()
# Request C++11
if(${CMAKE_VERSION} VERSION_LESS 3.1)

View file

@ -1,12 +1,12 @@
cmake_minimum_required( VERSION 2.8.7 )
use_fast_math()
if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -fomit-frame-pointer" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
endif()
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ZD_FASTMATH_FLAG}")
include( CheckFunctionExists )
CHECK_FUNCTION_EXISTS( stricmp STRICMP_EXISTS )

View file

@ -1,6 +1,7 @@
cmake_minimum_required( VERSION 2.8.7 )
make_release_only()
use_fast_math()
# we play with out own sequencer
add_definitions(-DOPNMIDI_DISABLE_MIDI_SEQUENCER)
@ -12,8 +13,6 @@ if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -fomit-frame-pointer" )
endif()
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ZD_FASTMATH_FLAG}")
add_library( opn STATIC
chips/gens_opn2.cpp
chips/gens/Ym2612_Emu.cpp

View file

@ -1,12 +1,12 @@
cmake_minimum_required( VERSION 2.8.7 )
use_fast_math()
if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -fomit-frame-pointer" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
endif()
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ZD_FASTMATH_FLAG}")
include( CheckFunctionExists )
CHECK_FUNCTION_EXISTS( stricmp STRICMP_EXISTS )

View file

@ -1,12 +1,12 @@
cmake_minimum_required( VERSION 2.8.7 )
use_fast_math()
if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -fomit-frame-pointer" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
endif()
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ZD_FASTMATH_FLAG}")
include_directories( timiditypp )
file( GLOB HEADER_FILES

View file

@ -1,12 +1,12 @@
cmake_minimum_required( VERSION 2.8.7 )
use_fast_math()
if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -fomit-frame-pointer" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
endif()
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ZD_FASTMATH_FLAG}")
include( CheckFunctionExists )
CHECK_FUNCTION_EXISTS( stricmp STRICMP_EXISTS )

View file

@ -1,12 +1,12 @@
cmake_minimum_required( VERSION 2.8.7 )
use_fast_math()
if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -fomit-frame-pointer" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
endif()
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ZD_FASTMATH_FLAG}")
include( CheckFunctionExists )
CHECK_FUNCTION_EXISTS( stricmp STRICMP_EXISTS )

View file

@ -136,7 +136,7 @@ bool FCDThread::Init ()
CD_WindowClass.style = CS_NOCLOSE;
CD_WindowClass.lpfnWndProc = CD_WndProc;
CD_WindowClass.hInstance = g_hInst;
CD_WindowClass.lpszClassName = L"ZNusic CD Player";
CD_WindowClass.lpszClassName = L"ZMusic CD Player";
CD_WindowAtom = RegisterClass (&CD_WindowClass);
if (CD_WindowAtom == 0)