From f1fc6feca4c372a13640f9eddf6f9b6043db923a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 20 May 2019 16:47:32 +0200 Subject: [PATCH] SCons: Keep exceptions and rtti on Android, iOS and HTML5 tools build Those were disable to keep size small, and on Android avoid the dependency on the STL, but for tools build (editor) this is not really a concern. Note: as of today it's not possible to build tools=yes for those platforms, but this change is one of the necessary steps to enable it. Fixes #25262. (cherry picked from commit 4b20959d99645e591e5214a0883e31f29ef5a8a9) --- platform/android/detect.py | 8 +++++--- platform/iphone/detect.py | 10 ++++++---- platform/javascript/detect.py | 10 ++++++---- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/platform/android/detect.py b/platform/android/detect.py index 56232740500..4be2cc3c906 100644 --- a/platform/android/detect.py +++ b/platform/android/detect.py @@ -212,13 +212,15 @@ def configure(env): lib_sysroot = env["ANDROID_NDK_ROOT"] + "/platforms/" + env['ndk_platform'] + "/" + env['ARCH'] ## Compile flags - - if env['android_stl']: + # Disable exceptions and rtti on non-tools (template) builds + if env['tools'] or env['android_stl']: 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"]) env.Append(CXXFLAGS=['-frtti',"-std=gnu++14"]) else: - env.Append(CXXFLAGS=['-fno-rtti', '-fno-exceptions', '-DNO_SAFE_CAST']) + env.Append(CXXFLAGS=['-fno-rtti', '-fno-exceptions']) + # Don't use dynamic_cast, necessary with no-rtti. + env.Append(CPPFLAGS=['-DNO_SAFE_CAST']) ndk_version = get_ndk_version(env["ANDROID_NDK_ROOT"]) if ndk_version != None and LooseVersion(ndk_version) >= LooseVersion("15.0.4075724"): diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py index 853f24379eb..b5f96171182 100644 --- a/platform/iphone/detect.py +++ b/platform/iphone/detect.py @@ -114,10 +114,12 @@ def configure(env): env.Append(CPPFLAGS=['-DNEED_LONG_INT']) env.Append(CPPFLAGS=['-DLIBYUV_DISABLE_NEON']) - if env['ios_exceptions']: - env.Append(CPPFLAGS=['-fexceptions']) - else: - env.Append(CPPFLAGS=['-fno-exceptions']) + # Disable exceptions on non-tools (template) builds + if not env['tools']: + if env['ios_exceptions']: + env.Append(CCFLAGS=['-fexceptions']) + else: + env.Append(CCFLAGS=['-fno-exceptions']) ## Link flags diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index 12ac7c3a5bd..ca6ece0eb76 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -110,10 +110,12 @@ def configure(env): # once feasible also consider memory buffer size issues. env.Append(CPPDEFINES=['NO_THREADS']) - # 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']) + # Disable exceptions and rtti on non-tools (template) builds + if not env['tools']: + # 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']) if env['javascript_eval']: env.Append(CPPDEFINES=['JAVASCRIPT_EVAL_ENABLED'])