mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
SCons: Set explicit standards to C++98 and C11
Godot 1.0 was developed at a time where compilers defaulted to C++98. Also disable `-Wall` on debug builds, there are now hundreds of warnings from newer compilers that would need to be fixed. This would best be done by adding a new `warnings` SCons option, which would also affect non-debug builds, but I have no intention to fix warnings in the 1.0 branch, the goal here is just to get it to compile for archival and game preservation.
This commit is contained in:
parent
7eb5d049c2
commit
a68e96b8c2
10 changed files with 28 additions and 13 deletions
15
SConstruct
15
SConstruct
|
|
@ -189,6 +189,21 @@ if selected_platform in platform_list:
|
|||
|
||||
detect.configure(env)
|
||||
|
||||
# Set our C and C++ standard requirements.
|
||||
# Prepending to make it possible to override.
|
||||
# This MSVC "detection" is an extreme hack.
|
||||
is_msvc = (os.name=="nt") and (os.getenv("VSINSTALLDIR")!=None or os.getenv("VCINSTALLDIR")!=None) and (selected_platform in ["windows", "winrt"])
|
||||
if (not is_msvc):
|
||||
# Specifying GNU extensions support explicitly, which are supported by both GCC and Clang.
|
||||
# We don't support C++17 so stick to earlier standards.
|
||||
# Godot 1.0 definitely started as a C++98 codebase.
|
||||
env.Prepend(CFLAGS=["-std=gnu11"])
|
||||
env.Prepend(CXXFLAGS=["-std=gnu++98"])
|
||||
# Disable these auto-enabled warnings which are treated as errors by modern compilers.
|
||||
env.Prepend(CCFLAGS=["-Wno-error=implicit-function-declaration", "-Wno-error=incompatible-pointer-types"])
|
||||
else:
|
||||
# MSVC doesn't support setting C++ to pre-C++14 standards, so do nothing and hope it works.
|
||||
pass
|
||||
|
||||
flag_list = platform_flags[selected_platform]
|
||||
for f in flag_list:
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ def configure(env):
|
|||
|
||||
elif (env["target"]=="debug"):
|
||||
|
||||
env.Append(CCFLAGS=['-D_DEBUG', '-g1', '-Wall', '-O0', '-DDEBUG_ENABLED'])
|
||||
env.Append(CCFLAGS=['-D_DEBUG', '-g1', '-O0', '-DDEBUG_ENABLED'])
|
||||
env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC'])
|
||||
|
||||
if env["armv6"] == "no" and env['x86'] != 'yes':
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ def configure(env):
|
|||
|
||||
elif (env["target"]=="debug"):
|
||||
|
||||
env.Append(CCFLAGS=['-D_DEBUG', '-g0', '-Wall', '-O0', '-DDEBUG_ENABLED'])
|
||||
env.Append(CCFLAGS=['-D_DEBUG', '-g0', '-O0', '-DDEBUG_ENABLED'])
|
||||
env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC'])
|
||||
|
||||
env.Append(CPPFLAGS=['-DFLASH_ENABLED', '-DGLES1_ENABLED', '-DNO_FCNTL', '-DUNIX_ENABLED'])
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ def configure(env):
|
|||
env['AR'] = 'ar'
|
||||
|
||||
import string
|
||||
#env['CCFLAGS'] = string.split('-arch armv7 -Wall -fno-strict-aliasing -fno-common -D__IPHONE_OS_VERSION_MIN_REQUIRED=20000 -isysroot $IPHONESDK -fvisibility=hidden -mmacosx-version-min=10.5 -DCUSTOM_MATRIX_TRANSFORM_H=\\\"build/iphone/matrix4_iphone.h\\\" -DCUSTOM_VECTOR3_TRANSFORM_H=\\\"build/iphone/vector3_iphone.h\\\" -DNO_THUMB')
|
||||
#env['CCFLAGS'] = string.split('-arch armv7 -fno-strict-aliasing -fno-common -D__IPHONE_OS_VERSION_MIN_REQUIRED=20000 -isysroot $IPHONESDK -fvisibility=hidden -mmacosx-version-min=10.5 -DCUSTOM_MATRIX_TRANSFORM_H=\\\"build/iphone/matrix4_iphone.h\\\" -DCUSTOM_VECTOR3_TRANSFORM_H=\\\"build/iphone/vector3_iphone.h\\\" -DNO_THUMB')
|
||||
env['CCFLAGS'] = string.split('-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -gdwarf-2 -fvisibility=hidden -Wno-sign-conversion -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=4.3 -MMD -MT dependencies -isysroot $IPHONESDK')
|
||||
|
||||
|
||||
|
|
@ -95,17 +95,17 @@ def configure(env):
|
|||
|
||||
if (env["target"]=="release"):
|
||||
|
||||
env.Append(CCFLAGS=['-O3', '-ffast-math', '-DNS_BLOCK_ASSERTIONS=1','-Wall'])
|
||||
env.Append(CCFLAGS=['-O3', '-ffast-math', '-DNS_BLOCK_ASSERTIONS=1'])
|
||||
env.Append(LINKFLAGS=['-O3', '-ffast-math'])
|
||||
|
||||
elif env["target"] == "release_debug":
|
||||
env.Append(CCFLAGS=['-Os', '-ffast-math', '-DNS_BLOCK_ASSERTIONS=1','-Wall','-DDEBUG_ENABLED'])
|
||||
env.Append(CCFLAGS=['-Os', '-ffast-math', '-DNS_BLOCK_ASSERTIONS=1','-DDEBUG_ENABLED'])
|
||||
env.Append(LINKFLAGS=['-Os', '-ffast-math'])
|
||||
env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ENABLED'])
|
||||
|
||||
elif (env["target"]=="debug"):
|
||||
|
||||
env.Append(CCFLAGS=['-D_DEBUG', '-DDEBUG=1', '-gdwarf-2', '-Wall', '-O0', '-DDEBUG_ENABLED'])
|
||||
env.Append(CCFLAGS=['-D_DEBUG', '-DDEBUG=1', '-gdwarf-2', '-O0', '-DDEBUG_ENABLED'])
|
||||
env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ENABLED'])
|
||||
|
||||
elif (env["target"]=="profile"):
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ def configure(env):
|
|||
env['AR'] = 'ar'
|
||||
|
||||
import string
|
||||
env['CCFLAGS'] = string.split('-arch i386 -fobjc-abi-version=2 -fobjc-legacy-dispatch -fmessage-length=0 -fpascal-strings -fasm-blocks -Wall -D__IPHONE_OS_VERSION_MIN_REQUIRED=40100 -isysroot $ISIMSDK -mios-simulator-version-min=4.3 -DCUSTOM_MATRIX_TRANSFORM_H=\\\"build/iphone/matrix4_iphone.h\\\" -DCUSTOM_VECTOR3_TRANSFORM_H=\\\"build/iphone/vector3_iphone.h\\\"')
|
||||
env['CCFLAGS'] = string.split('-arch i386 -fobjc-abi-version=2 -fobjc-legacy-dispatch -fmessage-length=0 -fpascal-strings -fasm-blocks -D__IPHONE_OS_VERSION_MIN_REQUIRED=40100 -isysroot $ISIMSDK -mios-simulator-version-min=4.3 -DCUSTOM_MATRIX_TRANSFORM_H=\\\"build/iphone/matrix4_iphone.h\\\" -DCUSTOM_VECTOR3_TRANSFORM_H=\\\"build/iphone/vector3_iphone.h\\\"')
|
||||
|
||||
env.Append(LINKFLAGS=['-arch', 'i386',
|
||||
'-mios-simulator-version-min=4.3',
|
||||
|
|
@ -84,7 +84,7 @@ def configure(env):
|
|||
|
||||
elif (env["target"]=="debug"):
|
||||
|
||||
env.Append(CCFLAGS=['-DDEBUG', '-D_DEBUG', '-gdwarf-2', '-Wall', '-O0', '-DDEBUG_ENABLED'])
|
||||
env.Append(CCFLAGS=['-DDEBUG', '-D_DEBUG', '-gdwarf-2', '-O0', '-DDEBUG_ENABLED'])
|
||||
env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC'])
|
||||
|
||||
elif (env["target"]=="profile"):
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ def configure(env):
|
|||
env.Append(CCFLAGS=['-O2','-DDEBUG_ENABLED'])
|
||||
|
||||
elif (env["target"]=="debug"):
|
||||
env.Append(CCFLAGS=['-D_DEBUG', '-Wall', '-O2', '-DDEBUG_ENABLED'])
|
||||
env.Append(CCFLAGS=['-D_DEBUG', '-O2', '-DDEBUG_ENABLED'])
|
||||
env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC'])
|
||||
|
||||
env.Append(CPPFLAGS=["-fno-exceptions",'-DNO_SAFE_CAST','-fno-rtti'])
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ def configure(env):
|
|||
|
||||
elif (env["target"]=="debug"):
|
||||
|
||||
env.Append(CCFLAGS=['-g', '-O0', '-Wall','-DDEBUG_ENABLED'])
|
||||
env.Append(CCFLAGS=['-g', '-O0', '-DDEBUG_ENABLED'])
|
||||
|
||||
|
||||
elif (env["target"]=="profile"):
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ def configure(env):
|
|||
|
||||
elif (env["target"]=="debug"):
|
||||
|
||||
env.Append(CCFLAGS=['-g3', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
|
||||
env.Append(CCFLAGS=['-g3', '-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
|
||||
|
||||
|
||||
if (env["freetype"]!="no"):
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ def configure(env):
|
|||
|
||||
elif (env["target"]=="debug"):
|
||||
|
||||
env.Append(CCFLAGS=['-g2', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
|
||||
env.Append(CCFLAGS=['-g2', '-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
|
||||
|
||||
env.Append(CPPFLAGS=['-DSERVER_ENABLED','-DUNIX_ENABLED'])
|
||||
env.Append(LIBS=['pthread','z']) #TODO detect linux/BSD!
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ def configure(env):
|
|||
|
||||
elif (env["target"]=="debug"):
|
||||
|
||||
env.Append(CCFLAGS=['-g', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
|
||||
env.Append(CCFLAGS=['-g', '-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
|
||||
|
||||
if (env["freetype"]!="no"):
|
||||
env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue