Commit graph

342 commits

Author SHA1 Message Date
Rémi Verschelde
d1b39f0a14
SCons: Avoid using Python f-string to preserve Python 3.5 compat
Fixes #50629.
2021-07-20 10:12:46 +02:00
reduz
5ad4f26659 Implement the ability to disable classes
* This PR adds the ability to disable classes when building.
* For now it's only possible to do this via command like:
  `scons disable_classes=RayCast2D,Area3D`
* Eventually, a proper UI will be implemented to create a build config file to do this at large scale, as well as detect what is used in the project.
2021-07-13 09:25:14 -03:00
Hendrik Brucker
d070159094 Add elapsed time print statement to build system 2021-07-08 13:52:39 +02:00
Hugo Locurcio
89b5a569fb
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.
2021-06-21 16:55:43 +02:00
Fabio Alessandrelli
8594613f94 LinuxBSD now compiles without vulkan/x11. 2021-06-01 16:27:54 +02:00
Fabio Alessandrelli
ae04dac2db Remove server platform 2021-06-01 16:27:54 +02:00
MmAaXx500
c759b7b235 Improve compiler version extraction 2021-05-31 20:31:12 +02:00
jfons
575543ce53 Port changes to the "raycast" module build files from 3.x 2021-05-04 17:21:41 +02:00
totlmstr
634ed3e128 Add option modules_enabled_by_default 2021-04-10 14:17:20 -07:00
Rémi Verschelde
eeba8d63f8
Merge pull request #44398 from RevoluPowered/unit-tests-for-export-templates
Add unit tests for export templates
2021-03-23 00:42:29 +01:00
Gordon MacPherson
6b4ff3b44b Add unit tests for export templates 2021-03-22 18:57:08 +00:00
Rémi Verschelde
fcddd8c53a
Merge pull request #46966 from qarmin/faster_release
Allow to not optimize release build
2021-03-20 22:44:47 +01:00
Rafał Mikrut
0b298d201e Allow to not optimize release build 2021-03-14 15:51:05 +01:00
Rémi Verschelde
dc038bd7c3
Merge pull request #46799 from goostengine/module-includes
Provide missing include path for custom modules
2021-03-14 01:16:11 +01:00
Anshul7sp1
91181c2086 Fixes small typos and grammar correction 2021-03-12 19:05:16 +05:30
Rémi Verschelde
b7ebd22314 SCons: Use default env["ENV"] and prepend PATH to it
See discussion in #46814. Now going with the safe option again (like in 3.2)
as it turns out that we can't rely on user environments on Windows, since each
shell has a different set of env variables (especially the ones necessary to
use MSVC).

SCons does its own magic when we don't pass it an `ENV` dictionary, so we
should preserve it and only add things in a second step.

Fixes this warning when compiling with MSVC using git-bash.exe:
```
Missing environment variable: WindowsSdkDir
```

Possibly fixes build issues when having both MinGW and MSVC installed and an
older SCons version.
2021-03-10 11:07:34 +01:00
Rémi Verschelde
20b171cc5a SCons: Propagate the user's OS environment in env["ENV"]
This fixes a regression from #46774 where `env["ENV"]` would miss some
important env variables on Windows, such as `SystemRoot`, `PATHEXT`, etc.

To have those, we can either use the default `ENV` created by SCons, or
propagate the whole external environment.

Fixes #46790.
2021-03-09 09:21:40 +01:00
Andrii Doroshenko (Xrayez)
f712d68ceb 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.
2021-03-08 19:36:26 +02:00
Rémi Verschelde
5d217a9441 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`.
2021-03-07 22:28:46 +01:00
Mateo Kuruk Miccino
42f6d7a401 SCons: Fix profile type. It is a string 2021-02-25 19:45:36 -03:00
Rémi Verschelde
b97ef35585 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:23:00 +01:00
Rémi Verschelde
6b13f33fb0
SCons: Make freetype module a mandatory editor dependency
Fixes #28650.
2021-02-18 14:18:06 +01:00
Rémi Verschelde
c05d205a5c
Merge pull request #43057 from Xrayez/custom_modules_recursive
SCons: Add an option to detect C++ modules recursively
2021-02-08 16:00:03 +01:00
Rémi Verschelde
db26871210 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.
2021-02-03 11:48:17 +01:00
Hugo Locurcio
9479bfe5f5
Fix incorrect version requirement in the SCons compilation DB comment 2021-02-01 17:09:42 +01:00
Rémi Verschelde
8f660393fe
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.
2020-12-17 11:36:50 +01:00
Rémi Verschelde
0f84d8dc49
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.
2020-12-16 16:31:19 +01:00
Marcel Admiraal
8ef5e3201c Don't handle BaseException in build scripts 2020-12-12 10:05:42 +00:00
bruvzg
b9f441e81e
[Complex Text Layouts] Add third-party TextServer dependencies (ICU, HarfBuzz, Graphite). 2020-11-26 13:55:27 +02:00
Rémi Verschelde
d76806d322
Core: Always enable ptrcall, remove PTRCALL_ENABLED define
ptrcall is now also used to optimize calls in GDScript, on top of the existing
use by the GDNative and Mono modules.

It no longer makes sense to make it optional.
2020-11-25 14:08:17 +01:00
Andrii Doroshenko (Xrayez)
a3c2c1e18a 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.
2020-10-24 22:22:58 +03:00
Rémi Verschelde
97f116d36b
SCons: Refactor and cleanup warnings definition 2020-10-08 10:58:05 +02:00
Bartłomiej T. Listwon
317c2b194d Add all headers to VS Project 2020-09-27 18:03:51 +02:00
Marcel Admiraal
e3d698dae9 Remove unused Python imports. 2020-09-10 11:38:52 +01:00
Rémi Verschelde
0d815ed157
Merge pull request #41219 from akien-mga/gles2-takes-holidays
Remove obsolete GLES2 backend code
2020-08-13 10:52:38 +02:00
Rémi Verschelde
33b2070d2e Remove obsolete GLES2 backend code
This code currently isn't compiled (and cannot compile).

We plan to re-add OpenGL ES-based renderer(s) in Godot 4.0 alongside Vulkan
(probably ES 3.0, possibly also a low-end ES 2.0), but the code will be quite
different so it's not relevant to keep this old Godot 3.2 code.

The `drivers/gles2` code from the `3.2` branch can be used as a reference for
a potential new implementation.
2020-08-13 10:04:53 +02:00
Gordon MacPherson
974a4cde9d update to use scons compile db tool 2020-08-12 15:11:45 +01:00
Andrii Doroshenko (Xrayez)
d86de6c98e SCons: Refactor running commands through builders
A new `env.Run` method is added which allows to control the verbosity
of builders output automatically depending on whether the "verbose"
option is set. It also allows to optionally run any SCons commands in a
subprocess using the existing `run_in_subprocess` method, unifying
the interface. `Action` objects wrap all builder functions to include a
short build message associated with any action.

Notably, this removes quite verbose output generated by `make_doc_header`
and `make_editor_icons_action` builders.
2020-07-28 00:09:21 +03:00
Rémi Verschelde
f940e5e000 CI: Install master version of psf/black
Until https://github.com/psf/black/pull/1328 makes it in a stable release,
we have to use the latest from Git.

Apply new style fixes done by latest black.
2020-07-26 19:48:25 +02:00
Rémi Verschelde
a3a980eb0d SCons: Build tests/ and main/ in cloned environments
Allows switching `tests=yes`/`no` and rebuilding only tests and main,
instead of the whole engine.

Co-authored-by: Andrii Doroshenko (Xrayez) <xrayez@gmail.com>
2020-07-26 16:03:11 +02:00
Andrii Doroshenko (Xrayez)
9f649efe5d Move tests to the top-level directory 2020-07-26 00:06:07 +03:00
Andrii Doroshenko (Xrayez)
f6465f46b4 SCons: Add tests option to enable or disable unit tests 2020-07-25 18:44:18 +03:00
RevoluPowered
579342810f t Add unit testing to Godot using DocTest and added to GitHub Actions CI
Implements exit codes into the engine so tests can return their statuses.
Ideally we don't do this, and we use FIXUP logic to 'begin' and 'end' the engine execution for tests specifically.

Since realistically we're initialising the engine here we don't want to do that, since String should not require an engine startup to test a single header.

This lowers the complexity of running the unit tests and even for
physics should be possible to implement such a fix.
2020-07-24 13:05:33 +01:00
Rémi Verschelde
8391ec256d SCons: Do not enable werror=yes by default
There are too many users who compile Godot from source and are not familiar
with the buildsystem or C/C++ compilation warnings, and thus report any kind
of yet-unfixed warning as a (often duplicate) bug.

Compiler warnings change at every compiler version and are different for each
compiler, so it's difficult to ensure that the codebase would always be 100%
warning-free, especially in the future.

I already disabled it for stable releases in #37958, but having it on non
stable commits could also become an annoyance in the future when trying to
bisect issues with a new compiler version which emits warnings unknown at
the time of commit.

TL;DR: Contributors, use `dev=yes` or `werror=yes`. CI does and won't let you
create new warnings ;)
2020-07-14 12:33:17 +02:00
Aaron Franke
611fd8cb72
Disable "misleading indentation" warning on GCC 2020-07-12 23:15:41 -04:00
Rémi Verschelde
1aeb88205d
Merge pull request #37248 from Xrayez/env-dump
SCons: Dump construction environment to a file
2020-06-10 15:20:59 +02:00
Andrii Doroshenko (Xrayez)
42bee75e86 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.
2020-06-10 15:05:43 +03:00
Rémi Verschelde
7c74312217 SCons: Validate dependencies for linked multimedia modules
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.

Fixes #39219.
2020-06-03 11:00:10 +02:00
Rémi Verschelde
6aa399be59
Merge pull request #39137 from Xrayez/custom-modules-profile
SCons: Allow to read `custom_modules` option via a file
2020-05-29 11:42:53 +02:00
Andrii Doroshenko (Xrayez)
6304d16915 SCons: Allow to read custom_modules option via a file
The `custom_modules` option was only read via the command line
by fetching `ARGUMENTS` dictionary directly.

Instead, the option's value can now be read via any existing
configuration files (`custom.py`) as well as command line, while also
updating the environment.
2020-05-29 12:11:53 +03:00