Commit Graph

362 Commits

Author SHA1 Message Date
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
Andrii Doroshenko (Xrayez) 5afe8cd782 SCons: Prefer `Exit()` method over `sys.exit()`
Sconscript provides it's own `Exit()` method which is currently
an alias for `sys.exit()` internally, with the only difference that if
no exit code is specified, it defaults to 0.

This encourages the usage of SCons-implemented methods like
`Glob()` over `glob.glob()`, which may overcome limitations of the
built-in Python features in the future.
2020-05-28 22:54:37 +03:00
Rémi Verschelde 105bef19ff
Merge pull request #39125 from Xrayez/py-modules-order-4.0
SCons: use `OrderedDict` to ensure insertion order of modules
2020-05-28 20:55:56 +02:00
Andrii Doroshenko (Xrayez) 17938fd547 SCons: use `OrderedDict` to ensure insertion order of modules
The insertion order for dictionaries is only a language feature for
Python 3.6/3.7+ implementations, and not prior to that.

This ensures that the engine won't be rebuilt if the order of detected
modules changes in any way, as the `OrderedDict` should guarantee
inerstion order.
2020-05-28 18:17:49 +03:00
Rémi Verschelde 2aa46ee4ae
Merge pull request #37198 from Xrayez/progress-inside
SCons: Move build progress related logic out of main SConstruct
2020-05-27 14:34:04 +02:00
Andrii Doroshenko (Xrayez) a96f0e98d7 Add `custom_modules` build option to compile external user modules
This patch adds ability to include external, user-defined C++ modules
to be compiled as part of Godot via `custom_modules` build option
which can be passed to `scons`.

```
scons platform=x11 tools=yes custom_modules="../project/modules"
```

Features:

- detects all available modules under `custom_modules` directory the
same way as it does for built-in modules (not recursive);
- works with both relative and absolute paths on the filesystem;
- multiple search paths can be specified as a comma-separated list.

Module custom documentation and editor icons collection and generation
process is adapted to work with absolute paths needed by such modules.

Also fixed doctool bug mixing absolute and relative paths respectively.

Implementation details:

- `env.module_list` is a dictionary now, which holds both module name as
  key and either a relative or absolute path to a module as a value.
- `methods.detect_modules` is run twice: once for built-in modules, and
  second for external modules, all combined later.
- `methods.detect_modules` was not doing what it says on the tin. It is
  split into `detect_modules` which collects a list of available modules
  and `write_modules` which generates `register_types` sources for each.
- whether a module is built-in or external is distinguished by relative
  or absolute paths respectively. `custom_modules` scons converter
  ensures that the path is absolute even if relative path is supplied,
  including expanding user paths and symbolic links.
- treats the parent directory as if it was Godot's base directory, so
  that there's no need to change include paths in cases where custom
  modules are included as dependencies in other modules.
2020-05-25 15:33:32 +03:00
Rémi Verschelde 22c718ab17 SCons: Improve registration of compilation_db tool, check version
There's a builtin `toolpath` option we can use for that, so no need to hack
around a custom `scons_site` path.

The script requires SCons 3.1.1 or later, so we enable it conditionally.

Follow-up to #32848.
2020-05-18 14:11:19 +02:00
RevoluPowered 5a6f275b74 Added compilation database support for clang and gcc
This tool is originally from mongodb.

- Updated CPPSUFFIXES to use scons suffixes
- objective-c files will also be loaded into the compilation database where the compiler / tooling is available to compile the files.

Known limitations:

- This will not work with msvc as your compiler.
2020-05-12 13:07:50 +02:00
Juan Linietsky 1bea8e1eac New lightmapper
-Added LocalVector (needed it)
-Added stb_rect_pack (It's pretty cool, we could probably use it for other stuff too)
-Fixes and changes all around the place
-Added library for 128 bits fixed point (required for Delaunay3D)
2020-05-10 15:59:09 -03:00
Rémi Verschelde 26ab805c78 SCons: Disable -Werror on 'stable' releases
Stable releases are tagged and need to stay easy to compile in the future.
As new compiler versions introduce new warnings or catch more occurrences,
have -Werror set in tagged releases could be a bother.

We still want it on by default for all Godot developers, so it's now
conditional.
2020-04-17 15:31:51 +02:00
ARebel 7e8f7e642e Fix for Vulkan loader related build error caused by incomplete alias
Fixes #37465. The #37369 commit which added an alias for linuxbsd
platform did not work with the latest branch.
2020-03-31 23:28:30 +08:00
Rémi Verschelde 72ea74bcc1 SCons: Treat all warnings as errors
After an effort spanning several years, we should now be warning-free
on all major compilers, so we can set `-Werror` to ensure that we don't
introduce warnings in new code.

Disable -Werror=strict-overflow on GCC 7 though, as it seems bogus and
was fixed in 8+.
2020-03-30 18:28:51 +02:00
Andrii Doroshenko (Xrayez) d753a7630a 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).
2020-03-30 17:35:13 +03:00
Rémi Verschelde cd4e46ee65 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.
2020-03-30 09:05:53 +02:00
Hugo Locurcio 59fbbdc4af
Alias `platform=x11` to `platform=linuxbsd` in SCons
This makes it possible for users to follow outdated documentation
and still get a working binary.

This closes #37367.
2020-03-28 18:20:37 +01:00
Juan Linietsky f8a79a97c7 Effective DisplayServer separation, rename X11 -> LinuxBSD 2020-03-26 15:49:34 +01:00
Rémi Verschelde 3d2dd79ecd SCons: Drop support for Python 2
We now require SCons 3.0+ (first version with Python 3 support),
and we set min required Python 3 version to 3.5 (3.4 and earlier are
EOL).
2020-03-25 15:25:37 +01:00
Rémi Verschelde 9d8a9ea826 assimp: Clean and document buildsystem, prepare for unbundling
- Improve the SCsub to allow unbundling and remove unnecessary code.
- Move files around to match upstream source.
- Re-sync with upstream commit 308db73d0b3c2d1870cd3e465eaa283692a4cf23
  to ensure we don't have local modifications.
- Doesn't actually build against current version 5.0.1 due to the lack
  of the new ArmaturePopulate API that Gordon authored. We'll have to
  wait for a public release with that API (5.1?) to enable unbundling.
2020-03-06 14:37:52 +01:00
PouleyKetchoupp e888dbbb8d Remove '/permissive-' flag from Windows MSVC build
This flag is causing compilation issues with headers from older versions
of Windows SDK (before 10.0.16299.0).
2020-03-04 13:20:53 +01:00
Rémi Verschelde c7dc5142b5 SCons: Fix get_compiler_version() to return ints
Otherwise comparisons would fail for compiler versions above 10.
Also simplified code somewhat to avoid using subprocess too much
needlessly.
2020-02-26 14:23:34 +01:00
Rémi Verschelde dd4eb5494f SCons: Re-allow upcoming GCC 8.4, fixes C++17 copy elision
Follow-up to #36484.

The patches for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86521 have now
landed in the `releases/gcc-8` branch and will be in GCC 8.4.
2020-02-26 09:06:39 +01:00
Nickolai Korshunov c491232ae2 Scons: fixed build for vanilla clang in mac os x 2020-02-24 12:19:41 +03:00
Rémi Verschelde 214d852ffd SCons: Add GCC/Clang minimum version check
Prevent using GCC 8 as it does not properly support C++17's
guaranteed copy elision which we now need.
(Upstream bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86521)

Follow-up to #36457 and #36436.
2020-02-23 21:13:29 +01:00
Rémi Verschelde 2cf6ac6c50 Replace FALLTHROUGH macro by C++17 [[fallthrough]]
This attribute is now part of the standard we target so we no longer
need compiler-specific hacks.

Also enables -Wimplicit-fallthrough for Clang now that we can properly
support it. It's already on by default for GCC's -Wextra.

Fixes new warnings raised by Clang's -Wimplicit-fallthrough.
2020-02-23 00:52:50 +01:00
Rémi Verschelde 17a81cffb2 SCons: Ensure that MSVC gets /std:c++17 in CCFLAGS
We were running this logic too early, so `env.msvc` was not initialized
yet and MSVC used the same branch as GCC/Clang.
2020-02-22 22:07:08 +01:00
Rémi Verschelde a4801674c5 SCons: Bump required C++ standard to C++17
As per #36436, we now need C++17's guaranteed copy elision feature to
solve ambiguities in Variant.

Core developers discussed the idea to move from C++14 to C++17 as our
minimum required C++ standard, and all agreed. Note that this doesn't
mean that Godot is going to be written in "modern C++", but we'll use
modern features where they make sense to simplify our "C with classes"
codebase. Apart from new code written recently, most of the codebase
still has to be ported to use newer features where relevant.

Proper support for C++17 means that we need recent compiler versions:

 - GCC 7+
 - Clang 6+
 - VS 2017 15.7+

Additionally, C++17's `std::shared_mutex` (conditionally used by
`vk_mem_alloc.h` when C++17 support is enabled) is only available in
macOS 10.12+, so we increase our minimum supported version.
2020-02-22 20:00:21 +01:00
Rémi Verschelde 342f127362 SCons: Explicitly define our C (C11) and C++ (C++14) standards
On GCC and Clang, we use C11 and C++14 with GNU extensions (`std=gnu11`
and `std=gnu++14`). Those are the defaults for current GCC and Clang,
and also match the feature sets we want to use in Godot.

On MSVC, we require C++14 support explicitly with `/std:c++14`, and
make it strict with the use of `/permissive-` (so features of C++17 or
later can't be used).

Moves the definition before querying environment flags and platform
config so that it can be overridden when necessary.
2020-02-20 11:37:52 +01:00
Rémi Verschelde 49fec646cb Fix compilation warnings and re-enable werror=yes on Travis
Fix -Wunused-variable, -Wunused-but-set-variable and -Wswitch warnings
raised by GCC 8 and 9.

Fix -Wunused-function, -Wunused-private-field and
-Wtautological-constant-out-of-range-compare raised by Clang.

Fix MSVC 2019 warning C4804 (unsafe use of type 'bool' in comparison
operation).

GCC -Wcpp warnings/Clang -W#warnings (`#warning`) are no longer raising
errors and will thus not abort compilation with `werror=yes`.

Treat glslang headers are system headers to avoid raising warnings.

Re-enables us to build with `werror=yes` on Linux and macOS, thus
catching warnings that would be introduced by new code.

Fixes #36132.
2020-02-18 20:51:25 +01:00
Rémi Verschelde 54ac8eaba6 Remove more deprecated methods and code 2020-02-13 12:37:45 +01:00
Rémi Verschelde 386968ea97 Remove obsolete GLES3 backend
Due to the port to Vulkan and complete redesign of the rendering backend,
the `drivers/gles3` code is no longer usable in this state and is not
planned to be ported to the new architecture.

The GLES2 backend is kept (while still disabled and non-working) as it
will eventually be ported to serve as the low-end renderer for Godot 4.0.

Some GLES3 features might be selectively ported to the updated GLES2
backend if there's a need for them, and extensions we can use for that.

So long, OpenGL driver bugs!
2020-02-13 10:36:44 +01:00
Rémi Verschelde 65ad12e79a glslang: Disable warnings and allow unbundling 2020-02-11 12:02:50 +01:00
Rémi Verschelde 511f65214f SCons: Streamline Vulkan buildsystem + fixups
- Renamed option to `builtin_vulkan`, since that's the name of the
  library and if we were to add new components, we'd likely use that
  same option.
- Merge `vulkan_loader/SCsub` in `vulkan/SCsub`.
- Accordingly, don't use built-in Vulkan headers when not building
  against the built-in loader library.
- Drop Vulkan registry which we don't appear to need currently.
- Style and permission fixes.
2020-02-11 11:59:04 +01:00
bruvzg b456bfad5c Add runtime GLES2 / Vulkan context selection. 2020-02-11 11:57:34 +01:00
bruvzg eb48be51db Add static Vulkan loader.
Initial Vulkan support for Windows.
Initial Vulkan support for macOS.
2020-02-11 11:57:11 +01:00
Juan Linietsky 9b0dd4f571 A lot of progress with canvas rendering, still far from working. 2020-02-11 11:53:27 +01:00
Andrea Catania e6be3f68da - Integrated NavigationServer and Navigation2DServer.
- Added Navigation Agents and Obstacles.
- Integrated Collision Avoidance.

This work has been kindly sponsored by IMVU.
2020-02-10 14:38:52 +01:00
Rémi Verschelde 4e2dbb1bc0 SCons: Split libmodules.a in folder-based libs
This removes the need for the hacky split_libmodules logic on Windows,
since all libs are now of manageable size.
2020-02-07 14:19:51 +01:00
Rémi Verschelde f3726ee994 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.
2020-02-07 11:50:40 +01:00
Rémi Verschelde b7297fb39c SCons: Generate header with info on which modules are enabled
We already had `MODULE_*_ENABLED` defines but only in the modules
environment, and a few custom `*_ENABLED` defines in the main env
when we needed the information in core.

Now this is defined in a single header which can be included in the
files that need this information.
2020-02-07 11:31:37 +01:00
Fabian Mathews 7f62bed238 Added support to allow to compile Godot from the same directory while using different versions of python
(cherry picked from commit beee8b3776)
2020-01-01 11:52:11 +01:00
Rémi Verschelde c320a82213 SCons: Add 'split_libmodules' option to workaround linker issue
The new 'split_libmodules=yes' option is useful to work around linker
command line size limitations when linking a huge number of objects.
We're currently over 64k chars when linking libmodules.a on Windows
with MinGW, which triggers issues as seen in #30892.

Even on Linux, we can also reach linker command line size limitations
by adding more custom modules.

We force this option to True for MinGW on Windows, which fixes #30892.

Additional changes to lib splitting:

- Fix linking of the split module libs with interdependent symbols,
  hacking our way into LINKCOM and SHLINKCOM to set the `--start-group`
  and `--end-group` flags.
- Fix Python 3 compatibility in `methods.split_lib()`.
- Drop seemingly obsolete condition for 'msys' on 'posix'.
- Drop the unnecessary 'split_drivers' as the drivers lib is no longer
  too big since we moved all thirdparty builds to modules.

Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
2019-12-11 15:40:28 +01:00
Rémi Verschelde 02913f53d3 pcre2: Use scons option to disable JIT on some platforms
Third-party platforms (e.g. console ports) need to be able to
disable JIT support in the regex module too, so it can't be
hardcoded in the module SCsub. This is cleaner this way anyway.

Fixes #19316.
2019-11-20 08:54:52 +01:00
Marcel Admiraal a8836ba28d Remove dependency on the editor directory being in the build's include path.
- Add or remove the necessary subdirectorires to the includes to remove
dependency on the editor directory being in the build's include path.
- Ensure includes in modified files conform to style guideline.
- Remove editor from the build include path.
2019-10-10 08:57:00 +02:00
PouleyKetchoupp a1a0fb1467 Prevent editor compilation with regex module disabled, which is not supported 2019-08-11 19:07:59 +02:00
Rémi Verschelde 5dae2ea777 SCons: Enable C++11 on the whole codebase
**Important:** This does not mean *yet* that C++11 features should be used
in contributions to Godot's codebase.

For now this change is done solely for feature branches working on Vulkan
support and GDScript typed instruction sets for Godot 4.0, which will both
use C++11 features and are based on the master branch.

The plan is to start porting the codebase to C++11 after Godot 3.2 is
released, following upcoming guidelines on the subset of new features that
should be used, and when/how to use them.

We will advertise clearly when C++11 contributions are open, especially
once we start a coordinated effort to port Godot's massive codebase. In the
meantime, please bear with us and good ol' C++03. :)
2019-07-22 17:17:30 +02:00
Hugo Locurcio b07e46c59f
Add a `platform=list` SCons argument to list platforms
This also improves the message display and makes an invalid selection
exit with a non-zero status code.
2019-07-17 11:28:07 +02:00
Fabio Alessandrelli aae6c075aa Remove libwebsocket. No longer used, yay! 2019-07-04 15:03:04 +02:00
Andrii Doroshenko (Xrayez) 7c11a1b162 Add support for creating editor icons per module
The functionality is similar to how `doc_classes` are retrieved per module.
The build system will search for custom icons path defined per module via
`get_icons_path()` method in `config.py` or default icons path.
If such paths don't exist, only the editor's own icons will be built.

Most module icons were moved from editor/icons to respective modules.
2019-06-28 23:42:26 +03:00
Rémi Verschelde 4853870a18 SCons: Enable -Wclobbered in warnings=extra for GCC 2019-06-20 11:11:44 +02:00
Andrii Doroshenko (Xrayez) 33f55369cb Enforce Unicode encoding in MSVC
This can help to solve compilation issues on systems with Japanese
locale with encodings like Shift_JIS and UTF-8-BOM.

Also be more consistent using String::utf8() to represent cyrilic
unicode characters in test_string.cpp

Clarified some comments in test_string.cpp for some Unicode characters.
2019-06-19 14:42:09 +03:00
Rémi Verschelde beb34a0458 SCons: Enable -Werror and -Wextra in 'dev' build option
We're close to being able to compile all platforms with -Werror -Wextra,
so it's best if developers use those options when compiling their code
as those checks are also done on CI.

Also enabled -Wduplicated-branches on GCC.
2019-06-15 19:06:15 +02:00
Hugo Locurcio 1772bb1657
Fix SCons automatic platform detection on Linux 2019-05-27 13:42:52 +02:00
Rémi Verschelde 8d766ddef1
Merge pull request #29199 from mhilbrunner/no-platform-no-more
Scons: Fix .editorconfig, autodetect platform argument if missing
2019-05-27 11:57:15 +02:00
dankan1890 03c210f7b2 Fixed typo in SConstruct 2019-05-26 23:59:14 +02:00
Max Hilbrunner be80b0b83c Scons: Autodetect platform if not specified
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2019-05-26 19:05:40 +02:00
Rémi Verschelde e0574e1d98 Fix typos with codespell
Using codespell 1.15.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
doubleclick
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2019-05-19 13:10:35 +02:00
marxin cdf54d6c5f Ignore a warning in _get_socket_error (-Wlogical-op).
drivers/unix/net_socket_posix.cpp: In member function 'NetSocketPosix::NetError NetSocketPosix::_get_socket_error()':
drivers/unix/net_socket_posix.cpp:197:22: warning: logical 'or' of equal expressions [-Wlogical-op]
  197 |  if (errno == EAGAIN || errno == EWOULDBLOCK)
      |                      ^

and:

modules/mono/utils/string_utils.cpp: In function 'int {anonymous}::sfind(const String&, int)':
modules/mono/utils/string_utils.cpp:68:48: error: logical 'or' of collectively exhaustive tests is always true [-Werror=logical-op]
      found = src[read_pos] == 's' || (c >= '0' || c <= '4');
                                       ~~~~~~~~~^~~~~~~~~~~
2019-05-02 11:11:52 +02:00
Rémi Verschelde d52b70fb5e SCons: Always use env.Prepend for CPPPATH
Include paths are processed from left to right, so we use Prepend to
ensure that paths to bundled thirdparty files will have precedence over
system paths (e.g. `/usr/include` should have lowest priority).
2019-04-30 13:12:06 +02:00
Rémi Verschelde c2a669a9f0 SCons: Review uses of CCFLAGS, CXXFLAGS and CPPFLAGS
Many contributors (me included) did not fully understand what CCFLAGS,
CXXFLAGS and CPPFLAGS refer to exactly, and were thus not using them
in the way they are intended to be.

As per the SCons manual: https://www.scons.org/doc/HTML/scons-user/apa.html

- CCFLAGS: General options that are passed to the C and C++ compilers.
- CFLAGS: General options that are passed to the C compiler (C only;
  not C++).
- CXXFLAGS: General options that are passed to the C++ compiler. By
  default, this includes the value of $CCFLAGS, so that setting
  $CCFLAGS affects both C and C++ compilation.
- CPPFLAGS: User-specified C preprocessor options. These will be
  included in any command that uses the C preprocessor, including not
  just compilation of C and C++ source files [...], but also [...]
  Fortran [...] and [...] assembly language source file[s].

TL;DR: Compiler options go to CCFLAGS, unless they must be restricted
to either C (CFLAGS) or C++ (CXXFLAGS). Preprocessor defines go to
CPPFLAGS.
2019-04-24 16:57:58 +02:00
Juan Linietsky dd03dcbd5a Android now (optionally) builds the template when exporting
Added new way to create add-ons
Removed old way to create add-ons
2019-04-07 15:46:52 -03:00
Hein-Pieter van Braam 4068e79a32
Merge pull request #27868 from marxin/add-more-warnings
Add more warnings on top of -Wall and -Wextra.
2019-04-23 06:00:49 +03:00
Rémi Verschelde 6640f397f1 Drop unused thekla_atlas dependency
Since f12cb82 @reduz dropped the use of the thirdparty thekla_atlas
library, which is replaced by xatlas.

Fixes #28180.
Fixes #28182.
2019-04-19 11:42:58 +02:00
marxin 4134f9e161 Add more warnings on top of -Wall and -Wextra. 2019-04-10 09:33:55 +02:00
Hendrikto 49a81308c0 Remove unused imports 2019-04-06 18:05:05 +02:00
Rémi Verschelde fc370b3feb Fix -Wimplicit-fallthrough warnings from GCC 8
Adds `FALLTHROUGH` macro to specify when a fallthrough is intentional.
Can be replaced by `[[fallthrough]]` if/when we switch to C++17.

The warning is now enabled by default for GCC on `extra` warnings level
(part of GCC's `-Wextra`). It's not enabled in Clang's `-Wextra` yet,
but we could enable it manually once we switch to C++11. There's no
equivalent feature in MSVC for now.

Fixes #26135.
2019-04-05 15:14:53 +02:00
Rémi Verschelde e4a96164b6 SCons: add `methods.using_clang` to check used compiler
Also rename `use_gcc` to `using_gcc` to make it clear that it returns
a config but does not alter it.
2019-04-05 12:51:15 +02:00
marxin e7f22ebdcd Enable warnings=extra on clang and GCC testers.
And remove 2 warnings from warnings=extra.
2019-04-02 17:14:47 +02:00
marxin e5f665c718 Fix -Wsign-compare warnings.
I decided to modify code in a defensive way. Ideally functions
like size() or length() should return an unsigned type.
2019-02-27 07:45:57 +01:00
Juan Linietsky a32b26dfa2 Several fixes to make GLES2 on HTML5 work much better.
Changed math class error reporting to be a bit less paranoid.
2019-02-25 21:47:29 -03:00
Hein-Pieter van Braam fc5792f2ea
Merge pull request #26160 from marxin/come-up-with-use_gcc
Come up with use_gcc.
2019-02-25 00:50:53 +01:00
marxin 0d2a105e6b Come up with use_gcc.
Add new method. Fix wrong version condition for -fpie.
2019-02-23 09:17:11 +01:00
marxin 40cd35489d Add -Wwrite-strings into all and extra warnings. 2019-02-23 09:16:36 +01:00
marxin 8d51618949 Add -Wshadow=local to warnings and fix reported issues.
Fixes #25316.
2019-02-20 19:44:12 +01:00
Rémi Verschelde 17809ca9a9
Merge pull request #25764 from akien-mga/scons-relative-import
SCons: Fix import clash between Godot and system modules
2019-02-10 15:39:32 +01:00
Rémi Verschelde 644b266bae SCons: Fix import clash between Godot and system modules
See #24965 for details. `sys.path.insert` is hacky, but should work
relatively well for both Python 2 and Python 3. When we eventually
deprecate Python 2 support, we could look into using importlib.

Fixes #24965.
2019-02-10 15:22:36 +01:00
Rémi Verschelde 2be62587ee SCons: Make MD5-timestamp decider and implicit_cache debug-only
As advised by @bdbaddog in #25403, those options reduce the certainty
that all everything will be rebuilt as it should, so they are not advised
for release builds.
2019-02-10 15:13:03 +01:00
Michael Alexsander Silva Dias 48935816dd Fix possible error in "disable_advanced_gui" flag's description 2018-12-21 00:21:10 -02:00
Rémi Verschelde 9cb18232c2 Core: Drop unused global_defaults logic
It used to be used for Android and iOS to specify platform-specific
project settings overrides, but we now have feature tags for that.
2018-12-20 11:02:49 +01:00
Erik 0cd8b27b56 SCons: Corrects $LIBSUFFIXES environment variable for Windows
Maxes only .lib to be recoginzed as a valid input extension for linker on Windows.

Closes issue #23769.
2018-11-18 20:50:27 +01:00
Rémi Verschelde 4d9b8a98ba
Merge pull request #23279 from marcelofg55/osx_server
Server platform works on OS X too
2018-10-29 21:25:46 +01:00
Marcelo Fernandez fe93bb03fe Server platform works on OS X too 2018-10-29 12:54:51 -03:00