Commit graph

111 commits

Author SHA1 Message Date
Rémi Verschelde
554312a3b2
Android: Use volk instead of NDK Vulkan headers
We no longer build the Vulkan loader, and volk lets us load it dynamically.
Roblox uses volk on Android so it should work well for us too.
2021-08-12 23:39:30 +02:00
bruvzg
d7957a2a20 Use "volk" instead of statically linked Vulkan loader. 2021-08-12 14:25:15 +03:00
Rémi Verschelde
23f7c75126
Android: Remove -fno-integrated-as, it can break arm64v8 build
We found that this flag causes this error on PR #48812 which does not add any
fancy inline assembly:
```
/tmp/tile_set-ce236a.s: Assembler messages:
/tmp/tile_set-ce236a.s:34676: Error: selected processor does not support `bfc x0,#32,#32'
clang++: error: assembler command failed with exit code 1 (use -v to see invocation)
```

That flag is mentioned in various errors related to assembler failures on
arm64v8 with Clang from the Android NDK.

It was added in Godot in #6958 when migrating from GCC to Clang, and is indeed
referenced in the NDK's Clang migration guide:
https://android.googlesource.com/platform/ndk/+/master/docs/ClangMigration.md

> Especially for ARM and ARM64, Clang is much stricter about assembler rules
> than GCC/GAS. Use `-fno-integrated-as` if Clang reports errors in inline
> assembly or assembly files that you don't wish to modernize.

We don't get those errors nowadays so it seems the flag is no longer needed.
2021-05-19 18:55:43 +02:00
Pedro J. Estébanez
469fa47e06
Make all file access 64-bit (uint64_t)
This changes the types of a big number of variables.

General rules:
- Using `uint64_t` in general. We also considered `int64_t` but eventually
  settled on keeping it unsigned, which is also closer to what one would expect
  with `size_t`/`off_t`.
- We only keep `int64_t` for `seek_end` (takes a negative offset from the end)
  and for the `Variant` bindings, since `Variant::INT` is `int64_t`. This means
  we only need to guard against passing negative values in `core_bind.cpp`.
- Using `uint32_t` integers for concepts not needing such a huge range, like
  pages, blocks, etc.

In addition:
- Improve usage of integer types in some related places; namely, `DirAccess`,
  core binds.

Note:
- On Windows, `_ftelli64` reports invalid values when using 32-bit MinGW with
  version < 8.0. This was an upstream bug fixed in 8.0. It breaks support for
  big files on 32-bit Windows builds made with that toolchain. We might add a
  workaround.

Fixes #44363.
Fixes godotengine/godot-proposals#400.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2021-05-17 15:06:19 +02:00
bruvzg
7e557bbec6
[JS, Android] Re-add "no-exceptions" for export templates builds with ICU. 2021-04-20 21:50:48 +03:00
Rafał Mikrut
0b298d201e Allow to not optimize release build 2021-03-14 15:51:05 +01:00
Fredia Huya-Kouadio
edeca16fb6 Override ANDROID_NDK_ROOT based on the project ndk version.
This helps resolve issues where the project ndk version differs from the one pointed by the `ANDROID_NDK_ROOT` environment variable (if it exists).
2021-02-17 19:11:05 -08:00
Rémi Verschelde
c730da8b20
Android: Bump NDK version to 21.4.7075529
This is what GitHub Actions now provide and they removed the previous 21.3.6528147.
A bit annoying to have our hand forced this way but it's still 21.x so should be good
to upgrade.
2021-02-18 00:28:51 +01:00
Fredia Huya-Kouadio
eee213e01a Improve the logic to compile for Android by automatically detecting and setting up the Android NDK if needed. 2021-01-05 15:07:17 -08: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
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
dcf902df85 SCons: Remove unused DEBUG_MEMORY_ENABLED define
Its last use was removed in Godot 3.0, so it no longer makes sense to define.

Also removed `D3D_DEBUG_INFO` for Windows as it's likely a left over from a
long time ago pre-opensourcing when Godot had some form of Direct3D 9 support?
2020-07-23 09:39:10 +02:00
PouleyKetchoupp
af424b1c7c Vulkan rendering for Android 2020-04-03 11:18:59 +02: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
unknown
90cdacd741 Removed unused code in android detect.py and SCsub 2020-03-18 18:12:50 +05:30
PouleyKetchoupp
ed0655cdfb Compilation fixes on Android 2020-03-04 13:15:37 +01:00
Rémi Verschelde
04ac6a43a4 Android: Style fixes to manifest and build.gradle 2019-08-27 11:16:55 +02:00
Rémi Verschelde
2da1614beb Android: Remove unusable android_stl=no option
As of 3.1 and later, we have too many thirdparty C++ dependencies
and some internal uses of `new` and `delete` too for it to make
sense to build without the STL on Android.

The option has been broken since 3.0, and the "System STL" that we
relied on for basic support of `new` and `delete` is likely to be
dropped from the NDK:
https://android.googlesource.com/platform/ndk/+/ndk-release-r20/docs/BuildSystemMaintainers.md#System-STL
2019-07-30 18:53:38 +02:00
Rémi Verschelde
d6ef5daf48 Android: Drop support for NDK < r15
NDK r15c was released over two years ago (July 2017), and we
cannot build against r14b anyway as it seems to fail with our
setup to link the STL.
2019-07-30 15:49:31 +02:00
Rémi Verschelde
b0d41847ed SCons: Use CPPDEFINES instead of CPPFLAGS for pre-processor defines
It's the recommended way to set those, and is more portable
(automatically prepends -D for GCC/Clang and /D for MSVC).

We still use CPPFLAGS for some pre-processor flags which are not
defines.
2019-07-03 09:59:04 +02:00
fhuya
f7200d6960 Deprecate armv6 support for Android 2019-06-19 12:05:58 -07:00
Rémi Verschelde
4b20959d99 SCons: Keep exceptions and rtti on Android, iOS and HTML5 tools build
Those were disable to keep size small, and on Android avoid the dependency on the STL,
but for tools build (editor) this is not really a concern.

Note: as of today it's not possible to build tools=yes for those platforms, but this
change is one of the necessary steps to enable it.

Fixes #25262.
2019-05-20 16:51:20 +02:00
Rémi Verschelde
e0517a12c5
Merge pull request #28518 from clayjohn/GLES2-MSAA
Added MSAA to GLES2 backend
2019-05-13 17:46:11 +02:00
clayjohn
a3d5aec68d added MSAA to GLES backend 2019-05-02 14:24:20 -07: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
Hendrikto
49a81308c0 Remove unused imports 2019-04-06 18:05:05 +02:00
Rémi Verschelde
1807e0f135 SCons: Move platform-specific Opus config to its module 2019-03-02 10:30:25 +01:00
Rémi Verschelde
eebca76be5 SCons: Drop unused MPC_FIXED_POINT define 2019-01-16 12:27:57 +01:00
Rémi Verschelde
7f4ee36469 Android: Add support for x86_64 architecture
Like arm64v8, this is only supported by API 21 and later,
so we enforce 21 as min API for x86_64.

Part of #25030.
2019-01-16 11:39:39 +01:00
Hein-Pieter van Braam
e5b335d367 Don't use -ffast-math or other unsafe math optimizations
Godot supports many different compilers and for production releases we
have to support 3 currently: GCC8, Clang6, and MSVC2017. These compilers
all do slightly different things with -ffast-math and it is causing
issues now. See #24841, #24540, #10758, #10070. And probably other
complaints about physics differences between release and release_debug
builds.

I've done some performance comparisons on Linux x86_64. All tests are
ran 20 times.

Bunnymark: (higher is better)
(bunnies)    min    max  stdev average
fast-math   7332   7597    71     7432
this pr     7379   7779   108     7621 (102%)

FPBench (gdscript port http://fpbench.org/) (lower is better)
(ms)
fast-math  15441  16127   192    15764
this pr    15671  16855   326    16001  (99%)

Float_add (adding floats in a tight loop) (lower is better)
(sec)
fast-math   5.49   5.78  0.07     5.65
this pr     5.65   5.90  0.06     5.76  (98%)

Float_div (dividing floats in a tight loop) (lower is better)
(sec)
fast-math  11.70  12.36  0.18    11.99
this pr    11.92  12.32  0.12    12.12  (99%)

Float_mul (multiplying floats in a tight loop) (lower is better)
(sec)
fast-math  11.72  12.17  0.12    11.93
this pr    12.01  12.62  0.17    12.26  (97%)

I have also looked at FPS numbers for tps-demo, 3d platformer, 2d
platformer, and sponza and could not find any measurable difference.

I believe that given the issues and oft-reported (physics) glitches on
release builds I believe that the couple of percent of tight-loop
floating point performance regression is well worth it.

This fixes #24540 and fixes #24841
2019-01-09 02:06:13 +01:00
Rémi Verschelde
173b342ca7 Remove trailing whitespace
With `sed -i $(rg -l '[[:blank:]]*$' -g'!thirdparty') -e 's/[[:blank:]]*$//g'`
(+ manual revert of some thirdparty code under `platform/android`).
2018-11-20 11:15:02 +01:00
lupoDharkael
edcca5f7ad Dont use equality operators with None singleton in python files 2018-10-27 01:18:15 +02:00
Wojciech Milkowski
3a3ea6d514 No need to link with libandroid_support in NDK 17
According to https://github.com/bytedeco/javacpp/pull/244 in NDK 17
libandroid_support library is not needed any more, and on armv8 is
already gone which breaks compilation.
2018-08-28 02:34:59 +02:00
Rémi Verschelde
d3714d1787
Merge pull request #20507 from rdhafidh/android_libcpp_shared_master
add support libc++_shared on android (master)
2018-08-23 08:44:41 +02:00
Ridwan Abdul Hafidh
b0419db46f add support libc++_shared stl on android 2018-08-23 05:02:47 +07:00
Tiago Quendera
aa594614db
Update detect.py
Fixed a typo in detect.py
2018-08-17 12:08:17 +01:00
Juan Linietsky
2b9902db06 -Fix disable_3d flag
-Add extra flag optimize=[size,speed] to be able to prioritize size
2018-07-21 17:26:49 -03:00
Colin Kinloch
853b1daa49 Fixed android arm64v8 2017-12-23 16:49:04 +00:00
Colin Kinloch
064189c693 Fixed Android NDK unified header detection for python 3 2017-12-17 12:01:16 +00:00
Rémi Verschelde
9f134aa5d1 Cleanup old references to GLES2 renderer
There are still some left in the Android Java code, even stuff to swap between
GLES1 and GLES2 support from early Godot days... would be good to see some cleanup
there too one day.

The "graphics/api" option for Android exports is removed, as only GLES 3.0 is supported.
It can be readded when GLES 2.0 support comes back. Fixes #13004.
2017-11-19 17:52:18 +01:00
Rhody Lugo
7f3ecd4227 change matrix and enable caching for Android, iOS and macOS (cross-compile) 2017-11-13 15:05:26 -04:00
Rhody Lugo
7957bbf558 add missing distutils.version.LooseVersion import 2017-11-09 11:58:29 -04:00
Rhody Lugo
7664a0feac unified headers fix 2017-11-09 09:46:43 -04:00
AndreaCatania
e44408f653 Compile Android with STL enabled by default 2017-11-08 12:51:35 +01:00
Rhody Lugo
ec31b23b33 add support for Android NDK unified headers 2017-11-06 07:51:09 -04:00
Elliott Sales de Andrade
3e69d19116 Use BoolVariable in platform-specific options. 2017-09-25 14:36:30 -04:00
Elliott Sales de Andrade
5be675eb03 Use BoolVariable for module options. 2017-09-25 14:36:30 -04:00
Elliott Sales de Andrade
ffab67b8da Use BoolVariable in target/component/advanced options. 2017-09-25 14:36:02 -04:00