Added compile options for rtti and exceptions. They are disabled by default. They used to be enabled on most platforms, it does not seem to break anything.

This commit is contained in:
Relintai 2022-03-18 17:04:14 +01:00
parent a3ee13ecbc
commit 3e97039c99
3 changed files with 12 additions and 14 deletions

View File

@ -122,6 +122,8 @@ opts.Add(EnumVariable("bits", "Target platform bits", "default", ("default", "32
opts.Add(EnumVariable("optimize", "Optimization type", "speed", ("speed", "size", "none")))
opts.Add(BoolVariable("production", "Set defaults to build Godot for use in production", False))
opts.Add(BoolVariable("use_lto", "Use link-time optimization", False))
opts.Add(BoolVariable("use_rtti", "Use RTTI", False))
opts.Add(BoolVariable("use_exceptions", "Use exceptions", False))
# Components
opts.Add(BoolVariable("deprecated", "Enable deprecated features", True))
@ -198,6 +200,16 @@ opts.Add("LINKFLAGS", "Custom flags for the linker")
# in following code (especially platform and custom_modules).
opts.Update(env_base)
if env_base["use_rtti"]:
env_base.Append(CXXFLAGS=["-frtti"])
else:
env_base.Append(CXXFLAGS=["-fno-rtti"])
# Don't use dynamic_cast, necessary with no-rtti.
env_base.Append(CPPDEFINES=["NO_SAFE_CAST"])
if not env_base["use_exceptions"]:
env_base.Append(CXXFLAGS=["-fno-exceptions"])
# Platform selection: validate input, and add options.
selected_platform = ""

View File

@ -253,14 +253,6 @@ def configure(env):
env.Append(CPPFLAGS=["-isystem", env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++/include"])
env.Append(CPPFLAGS=["-isystem", env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++abi/include"])
# Disable exceptions and rtti on non-tools (template) builds
if env["tools"]:
env.Append(CXXFLAGS=["-frtti"])
else:
env.Append(CXXFLAGS=["-fno-rtti", "-fno-exceptions"])
# Don't use dynamic_cast, necessary with no-rtti.
env.Append(CPPDEFINES=["NO_SAFE_CAST"])
lib_sysroot = env["ANDROID_NDK_ROOT"] + "/platforms/" + env["ndk_platform"] + "/" + env["ARCH"]
# Using NDK unified headers (NDK r15+)

View File

@ -93,12 +93,6 @@ def configure(env):
if env["initial_memory"] < 64:
print('Note: Forcing "initial_memory=64" as it is required for the web editor.')
env["initial_memory"] = 64
else:
# Disable exceptions and rtti on non-tools (template) builds
# These flags help keep the file size down.
env.Append(CCFLAGS=["-fno-exceptions", "-fno-rtti"])
# Don't use dynamic_cast, necessary with no-rtti.
env.Append(CPPDEFINES=["NO_SAFE_CAST"])
env.Append(LINKFLAGS=["-s", "INITIAL_MEMORY=%sMB" % env["initial_memory"]])