summaryrefslogtreecommitdiffstats
path: root/platform/javascript/emscripten_helpers.py
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2020-10-23 18:33:20 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2020-11-10 11:42:51 +0100
commite2083871eb57e56fe637c3d8f6647ddb4ff539e0 (patch)
treea58669c68065541e0062f82d7edb45789d8f354f /platform/javascript/emscripten_helpers.py
parent54cda5c3b8622c9168fcd5d1c68964ef7697b27e (diff)
downloadredot-engine-e2083871eb57e56fe637c3d8f6647ddb4ff539e0.tar.gz
[HTML5] Port JavaScript inline code to libraries.
The API is implemented in javascript, and generates C functions that can be called from godot. This allows much cleaner code replacing all `EM_ASM` calls in our C++ code with plain C function calls. This also gets rid of few hacks and comes with few optimizations (e.g. custom cursor shapes should be much faster now).
Diffstat (limited to 'platform/javascript/emscripten_helpers.py')
-rw-r--r--platform/javascript/emscripten_helpers.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/platform/javascript/emscripten_helpers.py b/platform/javascript/emscripten_helpers.py
index f6db10fbbd..cc874c432e 100644
--- a/platform/javascript/emscripten_helpers.py
+++ b/platform/javascript/emscripten_helpers.py
@@ -19,3 +19,9 @@ def create_engine_file(env, target, source, externs):
if env["use_closure_compiler"]:
return env.BuildJS(target, source, JSEXTERNS=externs)
return env.Textfile(target, [env.File(s) for s in source])
+
+
+def add_js_libraries(env, libraries):
+ if "JS_LIBS" not in env:
+ env["JS_LIBS"] = []
+ env.Append(JS_LIBS=env.File(libraries))