|
@@ -131,6 +131,7 @@ opts.Add(EnumVariable("lto", "Link-time optimization (production builds)", "none
|
|
|
opts.Add(BoolVariable("deprecated", "Enable deprecated features", True))
|
|
|
opts.Add(BoolVariable("minizip", "Enable ZIP archive support using minizip", True))
|
|
|
opts.Add(BoolVariable("xaudio2", "Enable the XAudio2 audio driver", False))
|
|
|
+opts.Add(BoolVariable("disable_exceptions", "Force disabling exception handling code", True))
|
|
|
opts.Add("custom_modules", "A list of comma-separated directory paths containing custom modules to build.", "")
|
|
|
opts.Add(BoolVariable("custom_modules_recursive", "Detect custom modules recursively for each specified path.", True))
|
|
|
|
|
@@ -480,6 +481,16 @@ if selected_platform in platform_list:
|
|
|
print(" Please adjust your scripts accordingly.")
|
|
|
Exit(255)
|
|
|
|
|
|
+ # Disable exception handling. Godot doesn't use exceptions anywhere, and this
|
|
|
+ # saves around 20% of binary size and very significant build time (GH-80513).
|
|
|
+ if env["disable_exceptions"]:
|
|
|
+ if env.msvc:
|
|
|
+ env.Append(CPPDEFINES=[("_HAS_EXCEPTIONS", 0)])
|
|
|
+ else:
|
|
|
+ env.Append(CCFLAGS=["-fno-exceptions"])
|
|
|
+ elif env.msvc:
|
|
|
+ env.Append(CCFLAGS=["/EHsc"])
|
|
|
+
|
|
|
# Configure compiler warnings
|
|
|
if env.msvc: # MSVC
|
|
|
# Truncations, narrowing conversions, signed/unsigned comparisons...
|
|
@@ -492,8 +503,6 @@ if selected_platform in platform_list:
|
|
|
env.Append(CCFLAGS=["/W2"] + disable_nonessential_warnings)
|
|
|
else: # 'no'
|
|
|
env.Append(CCFLAGS=["/w"])
|
|
|
- # Set exception handling model to avoid warnings caused by Windows system headers.
|
|
|
- env.Append(CCFLAGS=["/EHsc"])
|
|
|
|
|
|
if env["werror"]:
|
|
|
env.Append(CCFLAGS=["/WX"])
|