feat: Make C++ exceptions and RTTI configurable#9913
Conversation
|
The extra 290KB is due to the unwind tables (verified with zbloat). |
b5a3070 to
23fd486
Compare
| # Turn off exceptions on iOS debug as well. This fixes an availability error we see when using | ||
| # std::visit, which is not supported on iOS 11.0 when exceptions are enabled. | ||
| if (IOS) | ||
| set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-exceptions") |
There was a problem hiding this comment.
where's this part that disables exception for ios?
There was a problem hiding this comment.
oh, now you have to do it manually. That's why the default for iOS is off.
I did this because someone might want to compile with exceptions for iOS, and it works as long as you're not using iOS 11. In fact it worked locally for me, but failed only in CI.
So on iOS it's off by default. But if someone wants exceptions they can turn them on at compile time. If we updated our lowest iOS version on the CI, I could have it on by default.
| endif() | ||
| if (ANDROID OR WEBGL) | ||
| # On Android and WebGL RELEASE builds, we omit unwind info to save space. | ||
| # Omitting unwind info prevents the generation of readable stack traces in crash reports on iOS. |
There was a problem hiding this comment.
this comment seems unreleated
|
btw the sizeguard failure can be bypassed by adding this in the commit message (not the PR message) |
Introduced the FILAMENT_ENABLE_EXCEPTIONS (default ON) and FILAMENT_ENABLE_RTTI (default OFF) CMake options to control these features globally. This replaces previous hardcoded, platform-specific overrides. Added a -E flag to build.sh to easily disable exceptions during build configuration. Removed hardcoded -fno-exceptions and -fno-rtti from android/build.gradle to allow CMake to control these flags, but kept -fno-rtti enabled by default for the Java/Android build as requested. Documented in CMakeLists.txt and BUILDING.md that the JNI library (Android/Java build) requires exceptions to be enabled. Enabled RTTI specifically for the assimp target in third_party/libassimp/tnt/CMakeLists.txt to fix compilation errors caused by its use of dynamic_cast. SIZEGUARD_BYPASS
23fd486 to
c145c4d
Compare
Introduced the
FILAMENT_ENABLE_EXCEPTIONSCMake option (default ON) to control both C++ exceptions and RTTI globally. This replaces previous hardcoded, platform-specific overrides and allows users to opt-out to save binary size.Added a
-Eflag tobuild.shto easily disable exceptions and RTTI during build configuration.Removed hardcoded
-fno-exceptionsand-fno-rttifromandroid/build.gradleto allow CMake to control these flags uniformly.Documented in
CMakeLists.txtandBUILDING.mdthat the JNI library (Android/Java build) requires exceptions to be enabled. Users of Filament as a pure native library on Android can disable them to save space.Maintained hardcoded
-fno-rttifor WebGL and Cygwin due to specific platform constraints (e.g.,emscripten::valusage).