Commit graph

323 commits

Author SHA1 Message Date
totlmstr
cae1844c5c
[3.x] Add option modules_enabled_by_default and minimal CI build
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-authored-by: aaronfranke <arnfranke@yahoo.com>
2024-04-18 15:54:54 -07:00
Hugo Locurcio
8f12a01d45
Alias platform=web SCons option to platform=javascript
This makes build scripts forward-compatible, as was already done
for other platforms that were renamed in 4.0.
2023-11-16 15:49:44 +01:00
Rémi Verschelde
1a29530a99
SCons: Enable /WX on LINKFLAGS for MSVC with werror=yes
(cherry picked from commit 30bdb23f03)
2023-08-29 12:42:10 +02:00
Rémi Verschelde
55550da68b
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:34:10 +02:00
lawnjelly
43e181a00a Single Compilation Unit build.
Adds support for simple SCU build.
This speeds up compilation by compiling multiple cpp files within a single translation unit.
2023-07-02 20:13:16 +01:00
jfons
99aa9a99f9
Force optimized builds for thirdparty Embree files
(cherry picked from commit b197fc2079)
2022-12-12 14:49:24 +01:00
Rémi Verschelde
b0b759e6da
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.

(cherry picked from commit 26e9145c26)
2022-12-12 14:49:21 +01:00
Rémi Verschelde
5c81213231 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.

(cherry picked from commit d432fe38a9)
2022-09-20 10:26:17 +02:00
Rémi Verschelde
d5c1baa288 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>
(cherry picked from commit 35a15e6191)
2022-09-20 10:26:17 +02:00
Rémi Verschelde
7957dc7755 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:15:39 +02:00
Rémi Verschelde
953dea1227
Merge pull request #63309 from akien-mga/3.x-scons-refactor-lto 2022-09-08 11:24:54 +02:00
Rémi Verschelde
2969922ba9 SCons: Enforce version 4.0+ when compiledb=yes is used
Fixes #65233.

(cherry picked from commit 6c5e085d13)
2022-09-05 15:35:45 +02:00
Rémi Verschelde
570e6c1730 SCons: Refactor LTO options with lto=<none|thin|full>
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).
2022-09-05 14:45:12 +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