mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 07:17:42 -05:00
Merge pull request #24855 from hpvb/disable-ffast-math
Don't use -ffast-math or other unsafe math optimizations
This commit is contained in:
@@ -33,11 +33,6 @@ env_etc.Append(CPPPATH=[thirdparty_dir])
|
||||
if not env.msvc:
|
||||
env_etc.Append(CCFLAGS="-std=c++11")
|
||||
|
||||
# -ffast-math seems to be incompatible with etc2comp on recent versions of
|
||||
# GCC and Clang
|
||||
if '-ffast-math' in env_etc['CCFLAGS']:
|
||||
env_etc['CCFLAGS'].remove('-ffast-math')
|
||||
|
||||
env_thirdparty = env_etc.Clone()
|
||||
env_thirdparty.disable_warnings()
|
||||
env_thirdparty.add_source_files(env.modules_sources, thirdparty_sources)
|
||||
|
||||
@@ -141,7 +141,7 @@ def configure(env):
|
||||
if (env["target"].startswith("release")):
|
||||
if (env["optimize"] == "speed"): #optimize for speed (default)
|
||||
env.Append(LINKFLAGS=['-O2'])
|
||||
env.Append(CPPFLAGS=['-O2', '-DNDEBUG', '-ffast-math', '-funsafe-math-optimizations', '-fomit-frame-pointer'])
|
||||
env.Append(CPPFLAGS=['-O2', '-DNDEBUG', '-fomit-frame-pointer'])
|
||||
else: #optimize for size
|
||||
env.Append(CPPFLAGS=['-Os', '-DNDEBUG'])
|
||||
env.Append(LINKFLAGS=['-Os'])
|
||||
|
||||
@@ -37,14 +37,14 @@ def configure(env):
|
||||
## Build type
|
||||
|
||||
if (env["target"] == "release"):
|
||||
env.Prepend(CCFLAGS=['-O3', '-ffast-math'])
|
||||
env.Prepend(CCFLAGS=['-O3'])
|
||||
if (env["debug_symbols"] == "yes"):
|
||||
env.Prepend(CCFLAGS=['-g1'])
|
||||
if (env["debug_symbols"] == "full"):
|
||||
env.Prepend(CCFLAGS=['-g2'])
|
||||
|
||||
elif (env["target"] == "release_debug"):
|
||||
env.Prepend(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
|
||||
env.Prepend(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
|
||||
if (env["debug_symbols"] == "yes"):
|
||||
env.Prepend(CCFLAGS=['-g1'])
|
||||
if (env["debug_symbols"] == "full"):
|
||||
|
||||
@@ -46,7 +46,7 @@ def configure(env):
|
||||
if (env["target"].startswith("release")):
|
||||
env.Append(CPPFLAGS=['-DNDEBUG', '-DNS_BLOCK_ASSERTIONS=1'])
|
||||
if (env["optimize"] == "speed"): #optimize for speed (default)
|
||||
env.Append(CPPFLAGS=['-O2', '-ftree-vectorize', '-fomit-frame-pointer', '-ffast-math', '-funsafe-math-optimizations'])
|
||||
env.Append(CPPFLAGS=['-O2', '-ftree-vectorize', '-fomit-frame-pointer'])
|
||||
env.Append(LINKFLAGS=['-O2'])
|
||||
else: #optimize for size
|
||||
env.Append(CPPFLAGS=['-Os', '-ftree-vectorize'])
|
||||
|
||||
@@ -42,7 +42,7 @@ def configure(env):
|
||||
|
||||
if (env["target"] == "release"):
|
||||
if (env["optimize"] == "speed"): #optimize for speed (default)
|
||||
env.Prepend(CCFLAGS=['-O3', '-ffast-math', '-fomit-frame-pointer', '-ftree-vectorize', '-msse2'])
|
||||
env.Prepend(CCFLAGS=['-O3', '-fomit-frame-pointer', '-ftree-vectorize', '-msse2'])
|
||||
else: #optimize for size
|
||||
env.Prepend(CCFLAGS=['-Os','-ftree-vectorize', '-msse2'])
|
||||
|
||||
|
||||
@@ -43,10 +43,10 @@ def configure(env):
|
||||
## Build type
|
||||
|
||||
if (env["target"] == "release"):
|
||||
env.Append(CCFLAGS=['-O2', '-ffast-math', '-fomit-frame-pointer'])
|
||||
env.Append(CCFLAGS=['-O2', '-fomit-frame-pointer'])
|
||||
|
||||
elif (env["target"] == "release_debug"):
|
||||
env.Append(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
|
||||
env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
|
||||
|
||||
elif (env["target"] == "debug"):
|
||||
env.Append(CCFLAGS=['-g2', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
|
||||
|
||||
@@ -86,10 +86,8 @@ def configure(env):
|
||||
## Build type
|
||||
|
||||
if (env["target"] == "release"):
|
||||
# -O3 -ffast-math is identical to -Ofast. We need to split it out so we can selectively disable
|
||||
# -ffast-math in code for which it generates wrong results.
|
||||
if (env["optimize"] == "speed"): #optimize for speed (default)
|
||||
env.Prepend(CCFLAGS=['-O3', '-ffast-math'])
|
||||
env.Prepend(CCFLAGS=['-O3'])
|
||||
else: #optimize for size
|
||||
env.Prepend(CCFLAGS=['-Os'])
|
||||
|
||||
@@ -100,7 +98,7 @@ def configure(env):
|
||||
|
||||
elif (env["target"] == "release_debug"):
|
||||
if (env["optimize"] == "speed"): #optimize for speed (default)
|
||||
env.Prepend(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
|
||||
env.Prepend(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
|
||||
else: #optimize for size
|
||||
env.Prepend(CCFLAGS=['-Os', '-DDEBUG_ENABLED'])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user