Skip to content

Commit 2bd330f

Browse files
committed
chore: placeholder for jsc.impl
1 parent 57ff438 commit 2bd330f

File tree

4 files changed

+50
-15
lines changed

4 files changed

+50
-15
lines changed

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,20 @@ For more information on how to use `GodotJS` in a project, check out [GodotJSExa
4242

4343
## Supported Platforms
4444

45-
| | v8.impl | quickjs.impl | quickjs.impl (quickjs-ng) | web.impl |
46-
| -------------- | ------------------- | ---------------- | ------------------------------ | -------------------- |
47-
| Windows:x86_64 |||||
48-
| Windows:arm64 |||||
49-
| MacOS:x86_64 | ✅ (not tested) | ✅ (not tested) | ✅ (not tested) ||
50-
| MacOS:arm64 |||||
51-
| Linux:x86_64 | ✅ (not tested) | ✅ (not tested) |||
52-
| Linux:arm64 |||||
53-
| Android:x86_64 | ✅ (not tested) | ✅ (not tested) | ✅ (not tested) ||
54-
| Android:arm64 || ✅ (not tested) | ✅ (not tested) ||
55-
| iOS:x86_64 | ✅ (not tested) | ✅ (not tested) | ✅ (not tested) ||
56-
| iOS:arm64 | ✅ (not tested) | ✅ (not tested) | ✅ (not tested) ||
57-
| Web:wasm32 || ✅ (not tested) | ✅ (not tested) | ✅ (debugging) |
58-
| Debugger | ✅ Chrome/VSCode ||| ✅ browser devtools |
45+
| | v8.impl | quickjs.impl | quickjs.impl (quickjs-ng) | web.impl | jsc.impl (JavaScriptCore) |
46+
| -------------- | ------------------- | ---------------- | ------------------------------ | -------------------- | ------------------------- |
47+
| Windows:x86_64 ||||||
48+
| Windows:arm64 ||||||
49+
| MacOS:x86_64 | ✅ (not tested) | ✅ (not tested) | ✅ (not tested) || 🟡 |
50+
| MacOS:arm64 ||||| 🟡 |
51+
| Linux:x86_64 | ✅ (not tested) | ✅ (not tested) ||||
52+
| Linux:arm64 ||||||
53+
| Android:x86_64 | ✅ (not tested) | ✅ (not tested) | ✅ (not tested) |||
54+
| Android:arm64 || ✅ (not tested) | ✅ (not tested) |||
55+
| iOS:x86_64 | ✅ (not tested) | ✅ (not tested) | ✅ (not tested) || 🟡 |
56+
| iOS:arm64 | ✅ (not tested) | ✅ (not tested) | ✅ (not tested) || 🟡 |
57+
| Web:wasm32 || ✅ (not tested) | ✅ (not tested) | ✅ (debugging) ||
58+
| Debugger | ✅ Chrome/VSCode ||| ✅ browser devtools | 🟡 Safari |
5959

6060

6161
> Android: only tested on ndk_platform=android-24

SCsub

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,9 @@ def read_macro_value(name, def_val = None):
125125
raise ValueError(f"no {name} defined in jsb.config.h")
126126

127127
use_quickjs = "quickjs" if env["use_quickjs"] else ("quickjs-ng" if env["use_quickjs_ng"] else None)
128+
jsc_support = "jsc" if env["use_jsc"] and use_quickjs is None else None
128129
quickjs_support = get_thirdparty_support(quickjs_src_descs, use_quickjs)
129-
v8_support = get_library_support(v8_prebuilt_libs) if quickjs_support is None else None
130+
v8_support = get_library_support(v8_prebuilt_libs) if quickjs_support is None and jsc_support is None else None
130131
lws_support = get_library_support(lws_prebuilt_libs)
131132

132133
jsb_defines = [
@@ -149,6 +150,11 @@ jsb_defines = [
149150
"NOTE: web.impl is experimental and may not work as expected.",
150151
"NOTE: Obfuscation may not work in the current version. It'll be improved in the future versions. Report an issue if it breaks.",
151152
]),
153+
CompileDefines("JSB_WITH_JAVASCRIPTCORE", 1 if jsc_support is not None else 0, [
154+
"Use JavaScriptCore as the javascript engine.",
155+
"NOTE: JavaScriptCore is only supported on macOS/iOS.",
156+
"NOTE: THIS FEATURE IS WORK-IN-PROGRESS, DO NOT USE IT.",
157+
]),
152158

153159
CompileDefines("JSB_WITH_EDITOR_UTILITY_FUNCS", 1 if jsb_platform != "web" and env.editor_build else 0, [
154160
"Enables 'jsb.editor'",
@@ -477,6 +483,10 @@ if is_defined("JSB_WITH_WEB"):
477483
env.AddJSPre([ "impl/web/js/jsbb.impl.js" ])
478484
env.AddJSLibraries([ "impl/web/js/library_godotjs_jsbi.js" ])
479485

486+
if is_defined("JSB_WITH_JAVASCRIPTCORE"):
487+
env_jsb.add_source_files(module_obj, "impl/jsc/*.cpp")
488+
env.Append(LINKFLAGS=[ "-framework", "JavaScriptCore" ])
489+
480490
generate_code([\
481491
# presets for runtime
482492
PresetDefine("scripts/out/jsb.runtime.bundle.js", "", zero_terminated, AMDSourceTransformer()),

config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def get_opts(platform):
1414

1515
return [
1616
BoolVariable("use_typescript", "Build with typescript support (enabled by default)", True),
17+
BoolVariable("use_jsc", "Prefer to use JavaScriptCore (only for macos and ios)", False),
1718
BoolVariable("use_quickjs", "Prefer to use QuickJS rather than the default VM on the current platform", False),
1819
BoolVariable("use_quickjs_ng", "Prefer to use QuickJS-NG rather than the default VM on the current platform", False),
1920
]

impl/jsc/jsb_jsc.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#ifndef GODOTJS_JSC_H
2+
#define GODOTJS_JSC_H
3+
4+
// #include "jsb_jsc_typedef.h"
5+
// #include "jsb_jsc_isolate.h"
6+
// #include "jsb_jsc_context.h"
7+
// #include "jsb_jsc_handle.h"
8+
//
9+
// #include "jsb_jsc_data.h"
10+
// #include "jsb_jsc_primitive.h"
11+
// #include "jsb_jsc_object.h"
12+
// #include "jsb_jsc_container.h"
13+
// #include "jsb_jsc_function.h"
14+
// #include "jsb_jsc_function_interop.h"
15+
// #include "jsb_jsc_promise_reject.h"
16+
//
17+
// #include "jsb_jsc_helper.h"
18+
//
19+
// #include "jsb_jsc_catch.h"
20+
// #include "jsb_jsc_class.h"
21+
// #include "jsb_jsc_class_builder.h"
22+
// #include "jsb_jsc_global_init.h"
23+
24+
#endif

0 commit comments

Comments
 (0)