Commit graph

409 commits

Author SHA1 Message Date
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
Rémi Verschelde c2c659db32 SCons: Refactor LTO options with lto=<none|thin|full>
Adds support for LTO on macOS and Android. We don't have much experience
with LTO on these platforms so for now we keep it disabled by default
even when `production=yes` is set.

Similarly for iOS where we ship object files for the user to link in
Xcode so LTO makes builds extremely slow to link.

`production=yes` defaults to full LTO.
ThinLTO is much faster for LLVM-based compilers but seems to produce
bigger binaries (at least for the Web platform).
2022-09-08 10:00:02 +02:00
Rémi Verschelde 22381d9d07 SCons: Fix compilation database generation with MSVC
Fixes #54434.

Co-authored-by: Daniel Moody <daniel.moody@mongodb.com>
2022-09-07 08:50:31 +02:00
Almighty Laxz c71b78bbb8 Add float arg to build_assemblies.py 2022-09-04 04:02:39 +09:30
Rémi Verschelde 6c5e085d13 SCons: Enforce version 4.0+ when compiledb=yes is used
Fixes #65233.
2022-09-02 10:32:14 +02:00
Fabio Alessandrelli d20b32186f [Web] Rename JavaScript platform to Web.
Also rename export name from "HTML5" to "Web".
2022-08-29 11:52:00 +02:00
Aaron Franke 27b0f18275 Unify bits, arch, and android_arch into env["arch"]
Fully removes the `bits` option and adapts the code that relied on it.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2022-08-25 11:19:20 +02:00
Rémi Verschelde e3876899d3
Merge pull request #63919 from Faless/scons/4.x_easy_deps 2022-08-07 16:09:02 +02:00
Fabio Alessandrelli 951a1016d3 [Scons] Implement module dependency sorting.
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.
2022-08-04 20:00:19 +02:00
bruvzg 066ca97690
Add Text Server related options to the build profiles editor.
Adds SCons options to disable Brotli and Graphite.
Adds option categories to the build profiles editor.
Adds options default state to the build profiles editor.
Adds Text Server related options to the build profiles editor.
Fix misplaced OpenGL/Vulkan SCons options.
2022-08-03 15:06:43 +03:00
Rémi Verschelde 79463aa5de
Merge pull request #63310 from akien-mga/scons-vsproj-windows
SCons: Prevent using `vsproj` option outside Windows
2022-07-22 17:44:45 +02:00
Rémi Verschelde 4e56f96396 SCons: Prevent using vsproj option outside Windows
Fixes #63305.
2022-07-22 12:53:14 +02:00
Rémi Verschelde 653f95282c
Merge pull request #62996 from reduz/feature-build-profiles 2022-07-22 12:50:20 +02:00
reduz 6236a688b7 Implement Feature Build Profiles
This PR is a continuation of #50381 (which was implemented exactly a year ago!)

* Add a visual interface to select which classes should not be built into Godot (well, they are built if something else uses them, but if not used the optimizer will remove them out).
* Add a detection system to scan the project and figure out the actual classes used.
* Added the ability for SCons to load build profiles.

Obligatory Screen:

A simple test with a couple of nodes in the scene resulted in a 25% reduction for the final binary size

TODO:

* Script languages need to implement used class detection (left for another PR).
* Options to disable servers or server functionalities (like 2D or 3D physics, navigation, etc). Are missing, that should also greatly aid in reducing binary size.
* Options to disable some modules would be desired.
* More options to disable drivers (OpenGL, Vulkan, etc) would be desired.

In general this PR is a starting point for more contributors to improve and enhance this functionality.
2022-07-22 10:53:23 +02:00
bruvzg 8823eae328
Rename OSX to macOS and iPhoneOS to iOS. 2022-07-21 09:37:52 +03:00
Rémi Verschelde ea21122575 SCons: Default num_jobs to max CPUs minus 1 if not specified
This doesn't change the behavior when `--jobs`/`-j` is specified as a
command-line argument or in `SCONSFLAGS`.

The SCons hack used to know if `num_jobs` was set by the user is derived
from the MongoDB setup.

We use `os.cpu_count()` for portability (available since Python 3.4).

With 4 CPUs or less, we use the max. With more than 4 we use max - 1 to
preserve some bandwidth for the user's other programs.
2022-07-17 12:38:41 +02:00
Marcel Admiraal 2efe9a89bb Only include editor/SCsub when building the editor: tools=yes 2022-07-07 12:44:40 +01:00
Marcel Admiraal 48efd563e4 Upgrade Android NDK to r23 LTS 2022-06-25 14:58:30 +01:00
Rémi Verschelde e55d30768a SCons: Don't enable any -Werror=return-type outside werror=yes
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.
2022-05-03 11:30:24 +02:00
Rémi Verschelde 01f8f17b67 SCons: Disable -Werror=return-type for GCC 12+ due to regression
Works around and thus closes #58747.
Supersedes #60613.
2022-04-30 12:07:04 +02:00
Rémi Verschelde 45ec0e31c3 Remove last editor code dependencies in template build
SConstruct change also makes it possible to outright delete the `editor`
folder in a `tools=no` build, which we use in CI to ensure no invalid
cross-dependencies are added.
2022-03-28 21:13:01 +02:00
bruvzg f19cd44346
Unify TextServer built-in module and GDExtension code. 2022-03-17 08:15:29 +02:00
Rémi Verschelde 3d7f155586 Remove unused Bullet module and thirdparty code
It has been disabled in `master` since one year (#45852) and our plan
is for Bullet, and possibly other thirdparty physics engines, to be
implemented via GDExtension so that they can be selected by the users
who need them.
2022-03-09 21:45:47 +01:00
Bastiaan Olij a78a9fee71 Implementing OpenXR driver 2022-02-23 12:02:24 +01:00
Rémi Verschelde f94df6fa2b
SCons: Make compilation database generation optional
Saves around 3 s on incremental rebuilds to have it disabled by default.
Can be enabled with `compiledb=yes`.
2022-02-09 09:20:53 +01:00
Rémi Verschelde d4553c5126
SCons: Add fast_unsafe option for faster rebuilds
This reverts #53828 which had caused a significant drop in incremental
rebuild time for debug builds (from 10s to 23s on my laptop).

The "faster but unsafe" options are re-added, as well as adding
`max_drift=60` which we didn't use previously.

These options speed up SCons' own processing of the codebase to decide
what to build/rebuild (i.e. the first step before actually calling the
compiler). This will therefore not make much difference for scratch
builds, and is mostly useful for incremental rebuilds (including "null"
rebuilds with no change).

These options are enabled automatically for `debug` builds, unless
`fast_unsafe=no` is passed.
They are disabled by default for `release` and `release_debug` builds,
unless `fast_unsafe=yes` is passed.
2022-02-08 15:45:22 +01:00
Emmanuel Leblond 9b781d24c0
Improve python helper modules declaration in SConstruct for compatibility with Python 3.6 and import against helper modules's parent path 2022-01-13 21:54:04 +01:00
Emmanuel Leblond ad2b0ac8bd Explicitly declare python helper modules in SConstruct to avoid unexpected shadowing 2022-01-12 15:09:46 +01:00
Rémi Verschelde d98d327868
Merge pull request #56308 from Calinou/scons-tweak-target-release-error-message 2022-01-12 12:24:34 +01:00
Rémi Verschelde 6bb6d36816
Revert "Print a warning with unknown SCons variables to ease troubleshooting" 2022-01-06 12:23:14 +01:00
Hugo Locurcio 44b68bd3b6
Improve error when attempting to build with tools=yes target=release 2021-12-29 01:46:36 +01:00
Rémi Verschelde 7ac9ea75cc
Rename VideoPlayer to VideoStreamPlayer for consistency
It's a player for `VideoStream` resources, just like `AudioStreamPlayer` is a
player for `AudioStream` resources.

Closes https://github.com/godotengine/godot-proposals/issues/3624.
2021-12-06 19:01:28 +01:00
Rémi Verschelde c283fce698
Remove editor splash screen with sponsors logo
The Godot Project Leadership Committe has decided to update the sponsoring
tiers so that the Platinum Sponsorship no longer includes a logo on the
editor splash screen.

This lets us reclaim the editor splash screen space for community-related
content instead of sponsors (e.g. a different community-designed splash
screen for each stable branch?).

Also removes two Platinum Sponsors whose sponsorship has expired earlier this
year.
2021-11-30 12:47:25 +01:00
Hugo Locurcio 69b2d3f791
Print a warning with unknown SCons variables to ease troubleshooting
When disabling specific modules, misspellings can occur. Additionally,
when switching between the `3.x` and `master` branches frequently,
it's possible to forget about renamed modules such as `lightmapper_cpu`
versus `lightmapper_rd`.
2021-11-21 17:32:15 +01:00
Fabio Alessandrelli 46fdba5f8b [HTML5] Add WebGL2 (GLES3) support using the OpenGL renderer.
Note, the editor build requires the mbedtls module to be manually
enabled, as it is currently needed as a ResourceUID dependency.

This will need to be addressed in a separate PR.
2021-11-19 16:59:27 +01:00
bruvzg 1ad14eb14b [macOS] Add support for OpenGLES3 video driver. 2021-11-02 13:11:55 +02:00
Clay John 8a10bb7d0d
Use OpenGL 3.3 core profile instead of compatibility profile
- Rename OpenGL to GLES3 in the source code per community feedback.
  - The renderer is still exposed as "OpenGL 3" to the user.
- Hide renderer selection dropdown until OpenGL support is more mature.
  - The renderer can still be changed in the Project Settings or using
    the `--rendering-driver opengl` command line argument.
- Remove commented out exporter code.
- Remove some OpenGL/DisplayServer-related debugging prints.
2021-10-31 15:56:45 +01:00
Hugo Locurcio ce97ddbcb1
Rename GLES2 driver to OpenGL to prepare for the upgrade to GLES3
- Use lowercase driver names for the `--rendering-driver`
  command line argument.
2021-10-30 02:05:49 +02:00