Commit Graph

312 Commits

Author SHA1 Message Date
Rémi Verschelde
1b48e17ab8 SCons: Fix compilation database generation with MSVC
Fixes #54434.

Co-authored-by: Daniel Moody <daniel.moody@mongodb.com>
(cherry picked from commit 22381d9d07)
2022-09-09 14:34:13 +02:00
Rémi Verschelde
c4179fb179 SCons: Enforce version 4.0+ when compiledb=yes is used
Fixes #65233.

(cherry picked from commit 6c5e085d13)
2022-09-05 15:47:29 +02:00
Rémi Verschelde
83a00d17ea SCons: Prevent using vsproj option outside Windows
Fixes #63305.

(cherry picked from commit 4e56f96396)
2022-07-25 11:44:25 +02:00
bruvzg
6efae6f05b
Add ios and macos platform name aliases. 2022-07-21 15:32:58 +03:00
Rémi Verschelde
e1e22be3bc 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.

(cherry picked from commit ea21122575)
2022-07-18 10:25:42 +02:00
Marcel Admiraal
12c5348180 Only include editor/SCsub when building the editor: tools=yes
(cherry picked from commit 2efe9a89bb)
2022-07-07 23:23:27 +02:00
Marcel Admiraal
061c280873 Upgrade Android NDK to r23 LTS 2022-06-25 16:02:19 +01:00
Rémi Verschelde
af65c6dfe8 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.

(cherry picked from commit e55d30768a)
2022-05-05 13:39:41 +02:00
Rémi Verschelde
07545b0063 SCons: Disable -Werror=return-type for GCC 12+ due to regression
Works around and thus closes #58747.
Supersedes #60613.

(cherry picked from commit 01f8f17b67)
2022-05-05 13:39:41 +02:00
Rémi Verschelde
6dbb67cc73
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`.

(cherry picked from commit f94df6fa2b)
2022-02-09 17:36:39 +01:00
Rémi Verschelde
ec12e24e18
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.

(cherry picked from commit d4553c5126)
2022-02-09 17:35:55 +01:00
Hugo Locurcio
9753fe7aec
Print a notice when compiling with target=debug
Debug builds are considerably slower than release builds or even
release_debug builds. `target=debug` is still the default SCons
target option, so unsuspecting users may be compiling unoptimized
debug builds for their personal use.
2022-01-19 17:09:32 +01:00
Hugo Locurcio
89da3d7103
Improve error when attempting to build with tools=yes target=release
(cherry picked from commit 44b68bd3b6)
2022-01-12 17:39:13 +01:00
Jake Young
09bc9eb101
Backport NavigationServer with RVO2 to 3.x
Change the entire navigation system.
Remove editor prefix from nav mesh generator class. It is now used for baking
at runtime as well.
Navigation supports obstacle avoidance now with the RVO2 library.
Nav system will also automatically link all nav meshes together to form one
overall complete nav map.
2022-01-05 16:00:56 +01:00
Rémi Verschelde
93808ce6cb
Revert "Print a warning with unknown SCons variables to ease troubleshooting"
This reverts commit c3f4d3afbe.
2021-12-08 12:13:08 +01:00
lawnjelly
3d981b8265 Add option to use handles to RID
Adds an option to compile an alternative implementation for RIDs, which allows checks for erroneous usage patterns as well as providing leak tests.
2021-12-06 14:43:34 +00:00
Rémi Verschelde
f9bafe4ba4
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.

(cherry picked from commit c283fce698)
2021-12-01 14:18:29 +01:00
Hugo Locurcio
c3f4d3afbe
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`.

(cherry picked from commit 69b2d3f791)
2021-11-25 22:24:49 +01:00
Rémi Verschelde
9657559b66
SCons: Set DEBUG_ENABLED and DEV_ENABLED in SConstruct
They're the same for all platforms so they don't need to be repeated in all
platform definitions.

(cherry picked from commit cd21cc683a)
2021-10-15 12:54:16 +02:00
Rémi Verschelde
8c6e341876
SCons: Remove MD5-timestamp and implicit cache optimizations
They haven't really helped save much time on incremental rebuilds, and they do
cause potential issues with build correctness (and possibly even one of the cause
for overly eager incremental rebuilds).

(cherry picked from commit 0433d0f54d)
2021-10-15 12:51:43 +02:00
Aaron Franke
6c4928fe69
[3.x] Allow disabling the RegEx module in the editor 2021-09-21 08:49:17 -05:00
Omar Polo
abe5760a2d
automatically detect BSDs as platform=linuxbsd
(cherry picked from commit 78cd0ffdba)
2021-08-12 16:42:16 +02:00
Rémi Verschelde
e7f7d5f330
SCons: Add method to detect Emscripten and use it for warnings config
Emscripten is LLVM-based so we want to follow the same logic. But we can't just
put it as a match in `methods.using_clang()` as that would mess with the
compiler version detection logic used to restrict old GCC and Clang releases.

(cherry picked from commit 34421683eb)
2021-08-12 16:37:38 +02:00
Rémi Verschelde
4c79dcc3e7
SCons: Disable Clang -Wordered-compare-function-pointers warning
It's raised for us on many comparators implemented to be able to store a struct
in `Set` or `Map` (who rely on `operator<` internally). In the cases I reviewed
we don't actually care about the ordering and we use the struct's function
pointers as that's the only distinctive data available.

(cherry picked from commit 802810c371)
2021-08-12 16:37:38 +02:00
Rémi Verschelde
3c8faed9e9
SCons: Avoid using Python f-string to preserve Python 3.5 compat
Fixes #50629.

(cherry picked from commit d1b39f0a14)
2021-07-20 13:05:13 +02:00
Rémi Verschelde
875045adde
Use modules_enabled.gen.h to improve inter dependency checks
- Fix build with gdscript module disabled. Fixes #31011.
- Remove unused `gdscript` compile option.
- Fix build with regex module disabled.
- Fix ImageLoaderSVG to forward declare thirdparty structs.

(cherry picked from commit f3726ee994)
2021-07-14 23:36:38 +02:00
Hendrik Brucker
55dbf24b98
Add elapsed time print statement to build system
(cherry picked from commit d070159094)
2021-07-13 10:20:02 +02:00
Yuri Sizov
dbd4b45ca2 Correct pre-deprication warning message regarding linuxbsd/x11 platform 2021-04-22 21:54:35 +03:00
Rémi Verschelde
b266cc2315
embree: Allow building against system library on Linux 2021-04-22 17:06:28 +02:00
Rafał Mikrut
6b6324441f
Allow to not optimize release build
(cherry picked from commit 0b298d201e)
2021-03-20 23:05:13 +01:00
Andrii Doroshenko (Xrayez)
a33b0c5319
Provide additional include paths for custom modules
Allows to use a module as a library, where an include path may start
with module's name itself.

(cherry picked from commit f712d68ceb)
2021-03-14 12:03:22 +01:00
Rémi Verschelde
0431241935 SCons: Use default env["ENV"] and prepend PATH to it
This fixes a regression from #46774 where `env["ENV"]` would miss some
important env variables on Windows, such as `SystemRoot`, `PATHEXT`, etc.

So we go back to the previous setup (letting SCons initialize `env["ENV"]`
as it sees fit for the host OS) but use `PrependENVPath` instead of
`AppendENVPath` to preserve the intended fix from #46774.

Fixes #46790 for 3.2.
2021-03-09 09:39:43 +01:00
Rémi Verschelde
6b48fce2b5 SCons: Fix parsing PATH when constructing base environment
We constructed the SCons environment without taking any (shell) environment
variables into account, and then appended a few, but too late. This would
cause variables like `env[CXX]` not to be properly expanded to respect a
non-standard `PATH`.

With this fix, setting:
```
PATH=$GODOT_SDK/bin:$PATH
```
will now properly use `$GODOT_SDK/bin/gcc` if available over `/usr/bin/gcc`.

(cherry picked from commit 5d217a9441)
2021-03-07 22:51:33 +01:00
Mateo Kuruk Miccino
bdf335d369 SCons: Fix profile type. It is a string
(cherry picked from commit 42f6d7a401)
2021-02-26 11:30:19 +01:00
Rémi Verschelde
92d59d0879 SCons: Properly handle overriding default values to bool options
The `dev=yes` and `production=yes` options work as aliases to set a number of
options, while still aiming to allow overriding specific options if the user
wishes so. (E.g. `production=yes use_lto=no` should work to enable production
defaults *but* disable LTO.)

That wasn't working as `ARGUMENTS.get()` returns a string and not a boolean as
expected by `BoolVariable`, and this wasn't flagged as a bug... So added a
helper method using SCons' `BoolVariable._text2bool` to do the conversion
manually.
2021-02-24 10:20:46 +01:00
Rémi Verschelde
1a740e87be
SCons: Make freetype module a mandatory editor dependency
Fixes #28650.

(cherry picked from commit 6b13f33fb0)
2021-02-18 15:00:23 +01:00
Andrii Doroshenko (Xrayez)
65a2f0dfd4
SCons: Add an option to detect C++ modules recursively
This adds `custom_modules_recursive` which allows to detect and collect
all nested C++ modules which may reside in any directory specified by
`custom_modules` option.

The detection logic is made to be more strict because `SCSub` may be
used for organizing hierarchical builds within a module itself, so the
existence of `register_types.h` and `config.py` is checked as well
(these are all required for a C++ module to be compiled by Godot).

For performance reasons, built-in modules are not checked recursively,
and there's no benefit of doing so in the first place.

It's now possible to specify a directory path pointing to a *single*
module, as it may contain nested modules which are detected recursively.

(cherry picked from commit a3c2c1e18a)
2021-02-08 22:36:37 +01:00
Rémi Verschelde
f3c030aa47 SCons: Add production=yes option to use production defaults
This is meant for users making custom builds to match the options used on
optimized, official builds.

This enables, on the platforms which support them:
- `use_static_cpp=yes` (portable binaries for Linux and Windows)
- `use_lto=yes` (link time optimizations - note: requires a lot of RAM!)
- `debug_symbols=no` (no debug symbols, smaller binaries)

Also abort when using MSVC with `production=yes`, as:
- It cannot optimize the GDScript VM like GCC or Clang do, leading to
  significant performance drops.
- Its LTO support is unreliable, at least used to trigger crashes last
  we tried it extensively.

All options can still be overridden if specified, and the `dev=yes` option
was changed to also support overrides.

(cherry picked from commit db26871210)
2021-02-05 09:26:09 +01:00
Hugo Locurcio
c344bf88c6
Fix incorrect version requirement in the SCons compilation DB comment
(cherry picked from commit 9479bfe5f5)
2021-02-02 13:30:54 +01:00
Rémi Verschelde
ee77567cac
SCons: Fix build with p alias or platform auto-detection
Fixes a pre-existing bug that #44433 exposed.

It's pretty hacky, but we use `platform` in `env` both as an optional command
line option (instead it can be autodetected, or passed via the `p` alias, and
on Linux it might be overridden if you pass one of the convenience alias
values), and as the reference value for what platform we're building on.

Thus we override `env_base["platform"]` with the autodetected or validated
platform, but any call to `opts.Update(env_base)` overrides it with the
original command line option... causing e.g. #44448.

The proper fix would be to refactor all this so that we don't reuse
`env["platform"]` for platform detection (it could instead be e.g.
`env.platform` as a member variable which holds the validated value),
but for now I'm tapering over the immediate breakage.

Fixes #44448 and other breakages induced by #44433.

(cherry picked from commit 8f660393fe)
2020-12-29 16:02:00 +01:00
Rémi Verschelde
60959b085d
SCons: Add only selected platform's opts to env
Otherwise we can get situations where platform-specific opts with the same name
can override each other depending on the order at which platforms are parsed,
as was the case with `use_static_cpp` in Linux/Windows.

Fixes #44304.

This also has the added benefit that the `scons --help` output will now only
include the options which are relevant for the selected (or detected) platform.

(cherry picked from commit 0f84d8dc49)
2020-12-29 16:02:00 +01:00
Marcel Admiraal
e21adf2bc6 Don't handle BaseException in build scripts 2020-12-12 10:10:23 +00:00
Rémi Verschelde
f33ca5444a
SCons: Refactor and cleanup warnings definition
(cherry picked from commits 97f116d36b
and 56f3aba7b2)
2020-10-19 16:09:59 +02:00
Bartłomiej T. Listwon
858bdbacfd
Add all headers to VS Project
(cherry picked from commit 317c2b194d)
2020-09-29 13:57:56 +02:00
Hugo Locurcio
9790168b48
Alias the "linuxbsd" platform to "x11" for forward compatibility
This makes it possible to follow documentation designed for the
`master` branch while building the `3.2` branch.
2020-08-29 18:09:48 +02:00
Gordon MacPherson
5db6095bde update to use scons compile db tool
(cherry picked from commit 974a4cde9d)
2020-08-14 00:32:05 +02:00
Aaron Franke
8cd317b551 Disable "misleading indentation" warning on GCC
(cherry picked from commit 611fd8cb72)
2020-07-13 15:13:48 +02:00
Andrii Doroshenko (Xrayez)
23ef1e0f70 SCons: Dump construction environment to a file
A new `methods.dump(env)` is added to dump the construction environment
used by SCons to build Godot to a `.scons_env.json`. The file can be used
for debugging purposes and any external tool.

(cherry picked from commit 42bee75e86)
2020-06-10 15:30:52 +02:00
Andrii Doroshenko (Xrayez)
bc21cd8592 Moved to methods.py as a show_progress method.
Some required changes are made:
- locally imported SCons-specific packages within the method;
- `global` variables converted to `nonlocal` (used in nested functions).

(cherry picked from commit d753a7630a)
2020-06-10 15:30:52 +02:00
Rémi Verschelde
7bf9787921 SCons: Format buildsystem files with psf/black
Configured for a max line length of 120 characters.

psf/black is very opinionated and purposely doesn't leave much room for
configuration. The output is mostly OK so that should be fine for us,
but some things worth noting:

- Manually wrapped strings will be reflowed, so by using a line length
  of 120 for the sake of preserving readability for our long command
  calls, it also means that some manually wrapped strings are back on
  the same line and should be manually merged again.

- Code generators using string concatenation extensively look awful,
  since black puts each operand on a single line. We need to refactor
  these generators to use more pythonic string formatting, for which
  many options are available (`%`, `format` or f-strings).

- CI checks and a pre-commit hook will be added to ensure that future
  buildsystem changes are well-formatted.

(cherry picked from commit cd4e46ee65)
2020-06-10 15:30:52 +02:00