Commit Graph

1219 Commits

Author SHA1 Message Date
Jiri Suchan c5bd2f9dce ci: add Python static analysis check via mypy 2022-09-30 19:03:17 +07:00
Rémi Verschelde 39facb35a0 SCons: Unify tools/target build type configuration
Implements https://github.com/godotengine/godot-proposals/issues/3371.

New `target` presets
====================

The `tools` option is removed and `target` changes to use three new presets,
which match the builds users are familiar with. These targets control the
default optimization level and enable editor-specific and debugging code:

- `editor`: Replaces `tools=yes target=release_debug`.
  * Defines: `TOOLS_ENABLED`, `DEBUG_ENABLED`, `-O2`/`/O2`
- `template_debug`: Replaces `tools=no target=release_debug`.
  * Defines: `DEBUG_ENABLED`, `-O2`/`/O2`
- `template_release`: Replaces `tools=no target=release`.
  * Defines: `-O3`/`/O2`

New `dev_build` option
======================

The previous `target=debug` is now replaced by a separate `dev_build=yes`
option, which can be used in combination with either of the three targets,
and changes the following:

- `dev_build`: Defines `DEV_ENABLED`, disables optimization (`-O0`/`/0d`),
  enables generating debug symbols, does not define `NDEBUG` so `assert()`
  works in thirdparty libraries, adds a `.dev` suffix to the binary name.

Note: Unlike previously, `dev_build` defaults to off so that users who
compile Godot from source get an optimized and small build by default.
Engine contributors should now set `dev_build=yes` in their build scripts or
IDE configuration manually.

Changed binary names
====================

The name of generated binaries and object files are changed too, to follow
this format:

`godot.<platform>.<target>[.dev][.double].<arch>[.<extra_suffix>][.<ext>]`

For example:
- `godot.linuxbsd.editor.dev.arm64`
- `godot.windows.template_release.double.x86_64.mono.exe`

Be sure to update your links/scripts/IDE config accordingly.

More flexible `optimize` and `debug_symbols` options
====================================================

The optimization level and whether to generate debug symbols can be further
specified with the `optimize` and `debug_symbols` options. So the default
values listed above for the various `target` and `dev_build` combinations
are indicative and can be replaced when compiling, e.g.:

`scons p=linuxbsd target=template_debug dev_build=yes optimize=debug`
will make a "debug" export template with dev-only code enabled, `-Og`
optimization level for GCC/Clang, and debug symbols. Perfect for debugging
complex crashes at runtime in an exported project.
2022-09-26 16:31:46 +02:00
Rémi Verschelde 49fcf4ffad Style: Cleanup header guards for consistency
Fix file names for {Static,Lightmap}RaycasterEmbree.
2022-09-26 13:51:17 +02:00
Rémi Verschelde 26e9145c26 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.
2022-09-23 15:21:26 +02:00
Rémi Verschelde c5c3d13dc0 SCons: Remove redundant `-fomit-frame-pointer` and `-ftree-vectorize`
- `-fomit-frame-pointer` is included automatically by both GCC and
  Clang in `-O1` and above.
- `-ftree-vectorize` is included automatically by GCC in `-O2` and
  beyond, and seems always enabled by Clang.

Closes #66296. See that issue for a detailed investigation.
2022-09-23 13:56:16 +02:00
Rémi Verschelde aa553f4030 Merge pull request #65745 from akien-mga/scons-production-lto-earlier
Refactor handling of `production` flag and per-platform LTO defaults
2022-09-20 09:45:33 +02:00
Rémi Verschelde 7da532275b Merge pull request #65541 from clayjohn/renderer-setting
Split rendering driver project setting into renderer_name and rendering_driver
2022-09-20 09:43:59 +02:00
clayjohn 4a1c7de57c Split rendering driver project setting into renderer_name and rendering_driver. To differentiate between a driver (e.g. Vulkan or D3D12) and a renderer (e.g. clustered or mobile renderer). 2022-09-19 10:26:10 -07:00
Rémi Verschelde 35a15e6191 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>
2022-09-19 18:11:29 +02:00
kobewi 9f2dc68279 Replace File/Directory with FileAccess/DirAccess 2022-09-19 11:03:31 +02:00
MJacred ac9786c525 Add get_distribution_name() and get_version() to OS
supports: LinuxBSD, Windows, macOS, iOS, Android, UWP

Co-authored-by: bruvzg
2022-09-16 11:17:36 +02:00
Fredia Huya-Kouadio 9d5e48f873 Disable menus and functionality that are not relevant on the Android Editor port 2022-09-13 20:48:33 -07:00
Rémi Verschelde ff824b6f9d Merge pull request #65509 from gotnospirit/master-os-get_datetime
get_datetime_* functions can return wrong values
2022-09-13 11:01:12 +02:00
Fredia Huya-Kouadio 1efafa9dfe Exclude small screens from the set of supported devices. 2022-09-12 09:47:34 -07:00
Fredia Huya-Kouadio 67b38d0ac2 Update the versioning logic for the Godot Android Editor
This is necessary to separate subsequent uploads to the Google Play store as each upload needs to increment the version code.
2022-09-12 09:47:07 -07:00
James 0aecfc9254 Fixes #65377: get_datetime_* functions can return wrong values 2022-09-10 07:58:38 +08:00
Rémi Verschelde c2c659db32 SCons: Refactor LTO options with `lto=<none|thin|full>`
Adds support for LTO on macOS and Android. We don't have much experience
with LTO on these platforms so for now we keep it disabled by default
even when `production=yes` is set.

Similarly for iOS where we ship object files for the user to link in
Xcode so LTO makes builds extremely slow to link.

`production=yes` defaults to full LTO.
ThinLTO is much faster for LLVM-based compilers but seems to produce
bigger binaries (at least for the Web platform).
2022-09-08 10:00:02 +02:00
Rémi Verschelde df5a356e6c Merge pull request #65501 from m4gr3d/fix_invalid_project_manager_path_main
Fix issue causing the project manager to crash because of missing path argument
2022-09-08 09:19:25 +02:00
Fredia Huya-Kouadio cd544fd86b Fix issue causing the project manager to crash because of missing path argument
In the process, the initialization logic is updated to show an error message and gracefully close the engine when setup errors occur.
2022-09-07 14:21:34 -07:00
Fredia Huya-Kouadio c3c0bea615 Enable long press, pan and scale gestures for the Godot Android Editor
Fix the bug causing the editor to crash when running the project.
2022-09-07 13:30:10 -07:00
Fredia Huya-Kouadio 1b3511ad49 Cleanup the Android input logic implementation 2022-09-07 13:30:10 -07:00
Fredia Huya-Kouadio f916dff26d Additional fixes to the Android `get_current_dir()` implementation. 2022-08-30 10:04:12 -07:00
Aaron Franke 10a56981dc
Rename String `plus_file` to `path_join` 2022-08-29 19:38:13 -05:00
Rémi Verschelde 1b8f2e20bf
Merge pull request #64912 from m4gr3d/fix_android_arch_mapping_main
Revert the architecture values update made to the Android export logic
2022-08-26 07:45:02 +02:00
Fredia Huya-Kouadio ba9e2cf512 Revert the architecture values update made to the Android export logic 2022-08-25 20:06:48 -07:00
Hugo Locurcio ce56743aa1
Improve platform-specific READMEs to add useful links
This also adds READMEs for all platforms.
2022-08-25 17:50:53 +02:00
Aaron Franke 27b0f18275 Unify bits, arch, and android_arch into env["arch"]
Fully removes the `bits` option and adapts the code that relied on it.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2022-08-25 11:19:20 +02:00
Rémi Verschelde 9085409492
Merge pull request #64414 from m4gr3d/fix_get_current_dir_main 2022-08-23 16:15:02 +02:00
kobewi 8be27dc59e Replace Array return types with TypedArray 2022-08-22 22:42:36 +02:00
Fredia Huya-Kouadio a356e49803 Fix issue with `get_current_dir()` returning the wrong path on Android 2022-08-19 20:08:19 -07:00
Fredia Huya-Kouadio 44dc24ec38 Disable threads used to check on plugins to load
The functionality is unavailable on Android (requires export capability) and unnecessarily consumes resources
2022-08-15 02:30:43 -07:00
Fredia Huya-Kouadio b3117b6369 Fix issue preventing the Android Editor from displaying the project content
The issue was causing by a bug within the logic for `FileAccessFilesystemJAndroid#eof_reached()` causing that value to remain false after the eof was reached.
This in turn caused an infinite loop in the file scanner preventing the project's content from showing up.
2022-08-15 02:22:10 -07:00
Fredia Huya-Kouadio 45c7377556 Refactor the export checking logic to improve separation of concerns 2022-08-14 09:12:04 -07:00
Rémi Verschelde 557c16bb88
Merge pull request #62885 from madmiraal/fix-59931 2022-08-08 15:53:48 +02:00
Brian Semrau 103c0fa6e6 Add support for multiple virtual keyboard types 2022-08-04 10:41:33 -04:00
Marcel Admiraal cafb19e608 Add override keywords to FileAccess derived classes 2022-08-02 16:35:15 +01:00
Rémi Verschelde 1418f97c70 File: Re-add support to skip CR (`\r`) in `File::get_as_text`
This was removed in #63481, and we confirmed that it's better like this,
but we add back the possibility to strip CR as an option, to optionally
restore the previous behavior.

For performance this is done directly in `String::parse_utf8`.

Also fixes Android `FileAccess::get_line()` as this one _should_ strip CR.

Supersedes #63717.
2022-08-01 00:40:35 +02:00
Rémi Verschelde 3e5ad8213f
Merge pull request #63563 from aaronfranke/export-arch 2022-07-30 11:22:25 +02:00
Aaron Franke 17c4cd6412
Update export dialog to handle many architectures 2022-07-29 10:24:58 -05:00
Aaron Franke a0072ba39f
Make some editor export methods const 2022-07-29 10:24:13 -05:00
Juan Linietsky d4433ae6d3 Remove Signal connect binds
Remove the optional argument p_binds from `Object::connect` since it was deprecated by Callable.bind().
Changed all uses of it to Callable.bind()
2022-07-29 16:26:13 +02:00
Rémi Verschelde f3fbb157ca
Merge pull request #63121 from aaronfranke/editor-export-split 2022-07-27 11:19:40 +02:00
Fredia Huya-Kouadio 9679c67904 Address remaining scoped storage regressions
- Accelerate common path used to check the storage scope for a given path
- Update the logic for the `get_as_text()` method - previous logic loads the content of a text file one byte at a time
2022-07-26 07:44:08 -07:00
Aaron Franke e53ae13178
Split up editor export code into multiple files 2022-07-26 08:28:19 -05:00
Rémi Verschelde 90019676b0 Code quality: Fix header guards consistency
Adds `header_guards.sh` bash script, used in CI to validate future
changes. Can be run locally to fix invalid header guards.
2022-07-25 11:17:40 +02:00
Marcel Admiraal 6661141c21 Fix incorrect Android scancodes 2022-07-13 16:24:01 +01:00
kobewi d2900429e8 Add static methods for creating Image and ImageTexture 2022-07-08 13:40:47 +02:00
bruvzg e873778561 Use clang as assembler to ensure preprocessing is done, and add assembler "target" flag. 2022-07-07 14:15:12 +03:00
Fredia Huya-Kouadio f9c19298ce Add full support for Android scoped storage.
This was done by refactoring directory and file access handling for the Android platform so that any general filesystem access type go through the Android layer.
This allows us to validate whether the access is unrestricted, or whether it falls under scoped storage and thus act appropriately.
2022-07-05 03:00:37 -07:00
Rémi Verschelde e79cb76146
Merge pull request #62611 from akien-mga/android-preset-refactor-custom-build 2022-07-03 18:38:39 +02:00