Commit Graph

446 Commits

Author SHA1 Message Date
Rémi Verschelde
3bfcbe7946
SCons: Use CXXFLAGS to disable exceptions, it's only for C++
Following discussion in https://github.com/godotengine/godot-cpp/pull/1216.
2023-10-19 16:28:07 +02:00
Mai Lavelle
a1e5ab6644 Add object_prefix scons option
Add `object_prefix` as an scons option to add a custom prefix to
all generated object files, via the `OBJPREFIX` and `SHOBJPREFIX`
environment variables.

This is useful for instance to hide object files on unix-like
systems and make the source directories less cluttered by
setting `object_prefix = '.'` in `custom.py`.
2023-10-05 14:49:14 -04:00
Rémi Verschelde
090a5b028b
Merge pull request #82638 from Repiteo/check_c_headers-to-dictionary
`check_c_headers` from tuple array to dictionary
2023-10-03 17:26:16 +02:00
Thaddeus Crews
e9b2af91cf
check_c_headers from tuple array to dictionary 2023-10-01 14:09:39 -05:00
Ithamar R. Adema
36ff0591f2 Add build option for MP1/MP2 audio format support.
Enabling this adds 3.5k to the template size (Win/64bits).

Co-authored-by: Riteo <riteo@posteo.net>
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2023-09-30 21:46:59 +02:00
smix8
0ee7e3102b Add 2D navigation mesh baking
Adds 2D navigation mesh baking.
2023-09-25 19:48:14 +02:00
bruvzg
1887a9df19
[macOS/Windows] Add optional ANGLE backed OpenGL renderer support. Add EGL_ANDROID_blob_cache caching.
Co-authored-by: Riteo <riteo@posteo.net>
2023-09-21 14:21:00 +03:00
Valery Zhuk
6158578087 fix build options configuration for Visual Studio projects 2023-09-02 19:29:05 +03:00
Rémi Verschelde
30bdb23f03
SCons: Enable /WX on LINKFLAGS for MSVC with werror=yes 2023-08-17 15:51:54 +02:00
Rémi Verschelde
3907e53ff6
SCons: Disable C++ exception handling
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.
2023-08-16 10:23:34 +02:00
Rémi Verschelde
2757c2a495
Merge pull request #78959 from lawnjelly/scu_limit
SCons : Add "scu_limit" argument
2023-08-08 16:56:21 +02:00
Yuri Sizov
661c3954a6 Merge pull request #73443 from akien-mga/unbundle-openxr
Allow unbundling OpenXR (for Linux distros)
2023-07-12 17:15:25 +02:00
Rémi Verschelde
8a06ec979e
Change explicit 'Godot 4.0' references to 'Godot 4'
Fixes #79276.
2023-07-10 13:08:11 +02:00
Rémi Verschelde
153c4a4c4f
Linux: Allow unbundling brotli to use system library 2023-07-06 15:26:38 +02:00
lawnjelly
7b830ebdc1 SCons : Add "scu_limit" argument
"scu_limit" allows specifying the maximum number of includes in a single SCU file (translation unit). A lower limit (e.g. 8) uses less RAM during compilation, but may be slower to compile.
2023-07-02 19:30:52 +01:00
Rémi Verschelde
90446fe9f3
SCons: Move platform logo/run icon to export folder
Follow-up to #75932.
Since these icons are only used by the export plugin, it makes sense to
move them and generate the headers there.

The whole `detect.is_active()` logic seems to be a leftover from before
times, as far back as 1.0-stable it already wasn't used for anything.

So I'm removing it and moving the export icon generation to
`platform_methods`, where it makes more sense.
2023-06-20 13:16:37 +02:00
Rémi Verschelde
34a07b81ae
Allow unbundling OpenXR (for Linux distros)
Copy XrMatrix4x4f_CreateProjectionFov to our OpenXRUtil, instead of relying
on a private header.
2023-06-16 16:25:04 +02:00
RedworkDE
e2aee1a351 MSVC: Disable ICF for optimize=speed_trace 2023-06-11 18:08:56 +02:00
lawnjelly
6d0995b03d SCU build - Change options to "yes / no"
To save confusion for users who prefer yes / no, rather than none / dev / all.
2023-06-08 17:31:22 +01:00
lawnjelly
b69c8b4791 Single Compilation Unit build.
Adds support for simple SCU build (DEV_ENABLED only).
This speeds up compilation by compiling multiple cpp files within a single translation unit.
2023-06-06 15:36:51 +01:00
Rémi Verschelde
64816ff838
SCons: Fixup enabling MSVC warning C4458 on /W3
Follow-up to #76946.
2023-05-12 13:55:34 +02:00
Rémi Verschelde
258fabdbb3
Merge pull request #76836 from Faless/tls/system_certs
[TLS] Add support for platform-specific CA bundles.
2023-05-12 11:17:31 +02:00
Fabio Alessandrelli
6fd9982358 [TLS] Add support for platform-specific CA bundles.
Adds a new OS::get_system_ca_certs method which can be implemented by
platforms to retrieve the list of trusted CA certificates using OS
specific APIs.

The function should return the certificates in PEM format, and is
currently implemented for Windows/macOS/LinuxBSD(*)/Android.

mbedTLS will fall back to bundled certificates when the OS returns no
certificates.

(*) LinuxBSD does not have a standardized certificates store location.
    The current implementation will test for common locations and may
    return an empty string on some distributions (falling back to the
    bundled certificates).
2023-05-12 09:58:23 +02:00
Ninni Pipping
71ee65dc57 Enable shadow warnings and fix raised errors 2023-05-11 16:00:59 +02:00
smix8
a6ac305f96 Rework Navigation Avoidance
Rework Navigation Avoidance.
2023-05-10 05:01:58 +02:00
Rémi Verschelde
c16821e71b
Merge pull request #74980 from YuriSizov/build-err-without-required-editor-modules
Err when trying to build the editor without its required modules
2023-04-26 11:42:07 +02:00
Rémi Verschelde
efb42c3101
Merge pull request #75447 from bruvzg/brotli_packedarray
Expose brotli decompression to the scripting API.
2023-04-25 16:16:56 +02:00
bruvzg
a5128e71bb
[Export docs] Move docs to platform folders. 2023-04-20 11:02:12 +03:00
Yuri Sizov
a145194268 Err when trying to build the editor without its required modules 2023-04-07 19:27:53 +02:00
bruvzg
0e4bd964cc
Expose brotli decompression to the scripting API. 2023-03-29 22:43:36 +03:00
Rémi Verschelde
b7ecb9584a
Windows: Workaround missing DWRITE_FONT_WEIGHT value in old MinGW
Fixes #74339.
2023-03-05 18:18:04 +01:00
Rémi Verschelde
cefe1e0654
Merge pull request #73441 from akien-mga/linux-unbundling-fixes
Fix includes of thirdparty libs which can be unbundled on Linux
2023-02-17 09:56:02 +01:00
Pedro J. Estébanez
ef6e21bf76 Let VS solution name be overridden 2023-02-16 20:08:26 +01:00
Rémi Verschelde
e2fc0acd36
Fix includes of thirdparty libs which can be unbundled on Linux
Changes `builtin_icu` and `builtin_recast` to match the folder names in
`thirdparty`.
2023-02-16 15:52:13 +01:00
Rémi Verschelde
1033dfcb3d
SCons: Fix wrong debug_symbols default value in --help
The actual default value is neither true nor false but depends on the value
of `dev_build`.
Fixes #71812.
2023-02-01 11:27:25 +01:00
Rémi Verschelde
ec3c804ea6
SCons: Fix feature build profile being parsed too late
Also renames the option to just `build_profile`, the previous one was
too verbose and had words in the wrong order.

Fixes #70643.
2023-01-16 12:22:27 +01:00
Ekaterina Vaartis
5e041eee11 Alter linux debug stacktraces handling to support more environments
- Use -gdwarf-4 to support both LLVM and GCC when calling addr2line
- Subtract position-independant execuable relocation when passing the
  address to addr2line
2023-01-15 02:48:33 +03:00
Hugo Locurcio
063637ec77
Rename float=64 SCons option to precision=double
This avoids confusion with the old `bits=64` option and building
for 64-bit CPUs in general.
2022-12-10 16:43:45 +01:00
Rémi Verschelde
01ae54615e
SCons: Strip symbol table for builds with debug_symbols=no
This is equivalent to calling `strip` on the resulting binary, which is what
we do for official builds.

This applies for GCC/Clang.
For MSVC `/DEBUG:NONE` should already be the default.
2022-12-02 13:23:46 +01:00
bruvzg
9a33c97c2a
Add console wrapper app to handle console i/o redirection on Windows. 2022-10-31 14:37:49 +02:00
Rémi Verschelde
3306ffefd1 Merge pull request #67000 from RandomShaper/split_render_further
Polish rendering driver refactor further
2022-10-11 09:23:32 +02:00
Rémi Verschelde
8017827144 SCons: Re-enable treating #warning as error with werror
Replace all TODO uses of `#warning` by proper TODO comments, and will open
matching bug reports to keep track of them.

We don't have a great track record fixing TODOs, but I'd wager we're even
worse for fixing these "TODO #warning" so we should prohibit this usage.
2022-10-10 16:12:26 +02:00
Rémi Verschelde
4e4e16f9a9 SCons: Cleanup GCC warnings configuration
- Outright disable spammy warnings due to past or present GCC bugs:
  * `-Wno-strict-overflow` for GCC 7.
  * `-Wno-type-limits` for GCC before 11 (regressed in 9/10, might work in
    earlier releases but at this stage we don't care).
  * `-Wno-return-type` for GCC 12/13 (regression, still not fixed).
- Enable extra warnings conditionally when broken on earlier GCC:
  * `-Wnoexcept` was removed due to an upstream regression in GCC 9, could
    be re-enabled (but commented out for now as we actually have `-Wnoexcept`
    warnings to fix.
  * `-Wlogical-op` was broken on our variadic templates before GCC 11, now
    seems fine.
2022-10-10 16:12:26 +02:00
bruvzg
0103af1ddd
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4. 2022-10-07 11:32:33 +03:00
Pedro J. Estébanez
24ff292999 Polish rendering driver refactor further
Mainly:
- Make `max_descriptors_per_pool` project setting Vulkan-specific.
- Use a common, render driver agnostic magic FourCC for shader binary data.
- Downgrade spirv_reflect to Vulkan-only dependency.
- Add a `RENDER_DRIVER_*` macro to GLSL shader code for per-driver customizations.
2022-10-06 21:08:54 +02:00
Aaron Franke
267d267f3d
Fix CODEOWNERS and fix missing quote in "Building for platform" message 2022-10-01 01:57:50 -05:00
Rémi Verschelde
39facb35a0 SCons: Unify tools/target build type configuration
Implements https://github.com/godotengine/godot-proposals/issues/3371.

New `target` presets
====================

The `tools` option is removed and `target` changes to use three new presets,
which match the builds users are familiar with. These targets control the
default optimization level and enable editor-specific and debugging code:

- `editor`: Replaces `tools=yes target=release_debug`.
  * Defines: `TOOLS_ENABLED`, `DEBUG_ENABLED`, `-O2`/`/O2`
- `template_debug`: Replaces `tools=no target=release_debug`.
  * Defines: `DEBUG_ENABLED`, `-O2`/`/O2`
- `template_release`: Replaces `tools=no target=release`.
  * Defines: `-O3`/`/O2`

New `dev_build` option
======================

The previous `target=debug` is now replaced by a separate `dev_build=yes`
option, which can be used in combination with either of the three targets,
and changes the following:

- `dev_build`: Defines `DEV_ENABLED`, disables optimization (`-O0`/`/0d`),
  enables generating debug symbols, does not define `NDEBUG` so `assert()`
  works in thirdparty libraries, adds a `.dev` suffix to the binary name.

Note: Unlike previously, `dev_build` defaults to off so that users who
compile Godot from source get an optimized and small build by default.
Engine contributors should now set `dev_build=yes` in their build scripts or
IDE configuration manually.

Changed binary names
====================

The name of generated binaries and object files are changed too, to follow
this format:

`godot.<platform>.<target>[.dev][.double].<arch>[.<extra_suffix>][.<ext>]`

For example:
- `godot.linuxbsd.editor.dev.arm64`
- `godot.windows.template_release.double.x86_64.mono.exe`

Be sure to update your links/scripts/IDE config accordingly.

More flexible `optimize` and `debug_symbols` options
====================================================

The optimization level and whether to generate debug symbols can be further
specified with the `optimize` and `debug_symbols` options. So the default
values listed above for the various `target` and `dev_build` combinations
are indicative and can be replaced when compiling, e.g.:

`scons p=linuxbsd target=template_debug dev_build=yes optimize=debug`
will make a "debug" export template with dev-only code enabled, `-Og`
optimization level for GCC/Clang, and debug symbols. Perfect for debugging
complex crashes at runtime in an exported project.
2022-09-26 16:31:46 +02:00
Rémi Verschelde
26e9145c26 SCons: Cleanup DEBUG, _DEBUG and NDEBUG defines
- `_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.
2022-09-23 15:21:26 +02:00
Rémi Verschelde
35a15e6191 SCons: Refactor handling of production flag and per-platform LTO defaults
Fixup to #63288.
See #65583 for the bug report.

Co-authored-by: Cyberrebell <chainsaw75@web.de>
2022-09-19 18:11:29 +02:00
Rémi Verschelde
d432fe38a9 SCons: Add methods.get_version_info() method returning a Dict
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.
2022-09-14 11:32:51 +02:00