From f1174e188358f0d181bfcbe585424fc7e22703c9 Mon Sep 17 00:00:00 2001 From: ialex32x Date: Sat, 14 Sep 2024 12:23:25 +0800 Subject: [PATCH] fix: crash on android --- README.md | 11 ++++++----- SCsub | 8 ++++++-- TODO | 1 - 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 0d6f55d..f341767 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ git clone https://github.com/ialex32x/GodotJS.git ```sh # download the archive of prebuilt v8 -curl https://github.com/ialex32x/GodotJS-Dependencies/releases/download/v8_r9/v8_r9.zip --output your/download/path/v8.zip +curl https://github.com/ialex32x/GodotJS-Dependencies/releases/download/v8_r11/v8_r11.zip --output your/download/path/v8.zip # extract the zip file into your `GodotJS` directory, # NOTE: no white space after the switch `-o` @@ -56,7 +56,8 @@ The module directroy structure looks like this: ┃ ┣━ include ┃ ┣━ linux.x86_64.release ┃ ┣━ macos.arm64.release - ┃ ┗━ windows.x86_64.release + ┃ ┣━ windows_x86_64_release + ┃ ┗━ ... ┣━ gridmap ┣━ ... ``` @@ -108,9 +109,9 @@ For more information on how to use `GodotJS` in a project, check out [GodotJSExa - [x] Windows: x86_64 - [ ] Windows: arm64, UWP - [x] MacOS: arm64 -- [ ] MacOS: x86_64 +- [x] MacOS: x86_64 (not tested) - [x] Linux: x86_64 - [ ] Linux: arm64 -- [ ] Android -- [ ] iOS +- [x] Android: arm32, arm64, x86_64 (`ndk_platform=android-24`) +- [x] iOS: arm64, x86_64 (not tested) - [ ] WebAssembly (quickjs only) diff --git a/SCsub b/SCsub index cd0073b..6ffd049 100644 --- a/SCsub +++ b/SCsub @@ -14,7 +14,7 @@ def check(condition, text): jsb_platform = "linux" if env["platform"] == "linuxbsd" else env["platform"] jsb_arch = env["arch"] -prebuilt_deps_url = "https://github.com/ialex32x/GodotJS-Dependencies/releases/download/v8_r10/v8_r10.zip" +prebuilt_deps_url = "https://github.com/ialex32x/GodotJS-Dependencies/releases/download/v8_r11/v8_r11.zip" module_path = os.path.dirname(os.path.abspath("jsb.h")) module_name = os.path.basename(module_path) javascript_engine = "v8" if jsb_platform in ["windows", "linux", "macos", "android", "ios"] else "quickjs" @@ -26,6 +26,10 @@ print("websocket lib:", websocket_lib) print("platform:", jsb_platform) print("arch:", jsb_arch) +if jsb_platform == "android": + print("ndk_platform:", env["ndk_platform"]) + print("ANDROID_NDK_ROOT:", env["ANDROID_NDK_ROOT"]) + class CompileDefines: def __init__(self, name, value, help = None): self.name = name @@ -245,7 +249,7 @@ if javascript_engine == "v8": check(False, f'v8 is not supported on {env["platform"]}') # platform-specific defines - if jsb_platform != "ios": + if jsb_platform not in ["ios", "android"]: env_jsb.AppendUnique(CPPDEFINES=["V8_COMPRESS_POINTERS"]) pass diff --git a/TODO b/TODO index e77a4bc..3f2147d 100644 --- a/TODO +++ b/TODO @@ -3,7 +3,6 @@ Core: ✔ directly use typescripts in `godot editor`, hide compiled results (.js files) @done(24-07-08) ✔ global scope defined constants (such as PropertyHint) @done ☐ source-map: incorrect Ln:Col on bundle scripts - ☐ core: possible to call virtual methods even if not defined by scripts ✔ embed jsb sources in C++ @done(24-08-15 23:16) ✔ exception is swallowed if thrown in GodotJS ScriptInstance::callp method @started(24-04-30 17:52) @done(24-07-05 21:42) ✔ SArray: return a simple wrapper with address guarded scope instead of a barebone reference? (`Env::get_object_class` etc.) @done(24-08-15)