Adds support for using SCons's variant_dir feature to specify the build
path for where to build a variant of the the library.
Correct paths in SConstruct and godotcpp tool for the following, even
when the current directory is not the root of the repository:
- the binding_generator python module
- godotcpp tools
- source code and includes
- generated source code
This PR make it possible to import `env` and use it instead of creating
one from scratch every time.
Handy because we encourage users to use the godot-cpp SConstruct file as
a base to their projects (see the test project). So, if a project want
to override specific settings, (eg. make a path local to their SConstruct
file, not local to the godot-cpp/SConstruct file), it can do so.
Create the SCons Environment with an empty PLATFORM variable to force
the default tools to use the GNU toolchain.
Platform specific toolchains are then setup in our custom tools.
Changes the `<godot/gdextension_interface.h>` include to simply
`<gdextension_interface.h>`.
Refactor and better document the SCons and CMake logic around setting
the paths to the header and API JSON file.
Non-exhaustive list of case-sensitive renames:
GDExtension -> GDNative
GDNATIVE -> GDEXTENSION
gdextension -> gdnative
ExtensionExtension -> Extension (for where there was GDNativeExtension)
EXTENSION_EXTENSION -> EXTENSION (for where there was GDNATIVE_EXTENSION)
gdnlib -> gdextension
gdn_interface -> gde_interface
gdni -> gde_interface
Now matches Godot `master` target names and supports the same flags with
the following notable exceptions:
- The default target is "template_debug", since it's compatible with
editor builds (and TOOLS_ENABLED is never used internally).
- separate_debug_symbols is still not supported, and will be done in a
separate commit.
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.
Using a scons Builder we now regenerate the bindings automatically
when the Godot API json or header has changed.
The option to force bindings regeneration (generate_bindings=yes) is
retained.
Works by executing project `SConstruct`s file in a cloned env (a bit
like Godot does for modules) so you don't have to worry about platform
and toolchain setup.
Convert the project test file to work as submodule, add it to CI
Run with:
```
scons build_projects=test,/path/to/other/project
```