Upon investigating the extremely slow MSVC build times in #80513, I noticed
that while Godot policy is to never use exceptions, we weren't enforcing it
with compiler flags, and thus still included exception handling code and
stack unwinding.
This is wasteful on multiple aspects:
- Binary size: Around 20% binary size reduction with exceptions disabled
for both MSVC and GCC binaries.
- Compile time:
* More than 50% build time reduction with MSVC.
* 10% to 25% build time reduction with GCC + LTO.
- Performance: Possibly, needs to be benchmarked.
Since users may want to re-enable exceptions in their own thirdparty code
or the libraries they compile with Godot, this behavior can be toggled with
the `disable_exceptions` SCons option, which defaults to true.
- akien-mga
55550da68b
- `_DEBUG` is MSVC specific so it didn't make much sense to define for
Android and iOS builds.
- iOS was the only platform to define `DEBUG`. We don't use it anywhere
outside thirdparty code, which we usually don't intend to debug, so it
seems better to be consistent with other platforms.
- Consistently define `NDEBUG` to disable assert behavior in both `release`
and `release_debug` targets. This used to be set for `release` for all
platforms, and `release_debug` for Android and iOS only.
- Due to the above, I removed the only use we made of `assert()` in Godot
code, which was only implemented for Unix anyway, should have been
`DEV_ENABLED`, and is in PoolAllocator which we don't actually use.
- The denoise and recast modules keep defining `NDEBUG` even for the `debug`
target as we don't want OIDN and Embree asserting all over the place.
- akien-mga
b0b759e6da
This makes it possible to retrieve all relevant versioning info used to
generate `core/version_generated.gen.h` in the buildsystem.
Notably it makes the custom logic parsing the `GODOT_VERSION_STATUS`
environment variable to override status easy to reuse.
(cherry picked from commit d432fe38a9a65b9e84964a7393c9fe4ce22361a3)
Fixup to #63288.
See #65583 for the bug report.
Co-authored-by: Cyberrebell <chainsaw75@web.de>
(cherry picked from commit 35a15e619161798820b2bd6ff46178c5b7ccebcf)
Adds support for LTO on macOS and Android.
Disable LTO by default on iOS even if `production=yes` is set.
Also add `linker` option to `server` platform missed in #63283.
Refactor code handling old arguments to make it simpler (breaks compat,
but is explicit enough about it and scripts are easy to fix).
Modules can now call:
env.module_add_dependencies(name: str, deps: list, optional: bool)
To add required or optional dependencies during the "can_build" step.
Required dependencies will be checked and the module will be not be
enabled when they are missing, printing a warning to notify the user.
- Faless
951a1016d3
This is still a bit hacky and eventually we should rework the way we handle
optional dependencies (especially with regard to builtin/system libs), but
it's a simple first step.
- akien-mga
7c74312217
We shouldn't presume that future compilers will not have false positives or
find new occurrences of this warning, which would break compiling old versions
of the engine without passing custom `CXXFLAGS`.
Follow-up to #60652.
(cherry picked from commit e55d30768a83f027f2c36e106e0ad5320723709d)