summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-01-05 00:19:50 +0100
committerGitHub <noreply@github.com>2021-01-05 00:19:50 +0100
commitc13bb0b5415299ae69cd698d7f300859f2e85c16 (patch)
tree8abfd8bdcc59e1b344f7644e073dc99cde2c0c48 /platform
parent569dd6f11a85a3b53ba4c4c80e8d64aa2fcbe87d (diff)
parenta54a2d65e16cea409c8a876f517451d3168da13b (diff)
Merge pull request #44154 from dsnopek/webxr-master
Add WebXR support (for Godot 4.0)
Diffstat (limited to 'platform')
-rw-r--r--platform/javascript/.eslintrc.libs.js3
-rw-r--r--platform/javascript/SCsub10
-rw-r--r--platform/javascript/detect.py4
-rw-r--r--platform/javascript/emscripten_helpers.py12
4 files changed, 28 insertions, 1 deletions
diff --git a/platform/javascript/.eslintrc.libs.js b/platform/javascript/.eslintrc.libs.js
index e5f0c3d147..81b1b8c864 100644
--- a/platform/javascript/.eslintrc.libs.js
+++ b/platform/javascript/.eslintrc.libs.js
@@ -18,5 +18,8 @@ module.exports = {
"GodotRuntime": true,
"GodotFS": true,
"IDHandler": true,
+ "Browser": true,
+ "GL": true,
+ "XRWebGLLayer": true,
},
};
diff --git a/platform/javascript/SCsub b/platform/javascript/SCsub
index 7a8005fe30..1d3f96a6b8 100644
--- a/platform/javascript/SCsub
+++ b/platform/javascript/SCsub
@@ -67,6 +67,16 @@ else:
sys_env.Depends(build[0], sys_env["JS_LIBS"])
+if "JS_PRE" in env:
+ for js in env["JS_PRE"]:
+ env.Append(LINKFLAGS=["--pre-js", env.File(js).path])
+ env.Depends(build, env["JS_PRE"])
+
+if "JS_EXTERNS" in env:
+ for ext in env["JS_EXTERNS"]:
+ env["ENV"]["EMCC_CLOSURE_ARGS"] += " --externs " + ext.path
+ env.Depends(build, env["JS_EXTERNS"])
+
engine = [
"js/engine/preloader.js",
"js/engine/utils.js",
diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py
index d53c774e77..7d501e94b2 100644
--- a/platform/javascript/detect.py
+++ b/platform/javascript/detect.py
@@ -1,7 +1,7 @@
import os
import sys
-from emscripten_helpers import run_closure_compiler, create_engine_file, add_js_libraries
+from emscripten_helpers import run_closure_compiler, create_engine_file, add_js_libraries, add_js_pre, add_js_externs
from methods import get_compiler_version
from SCons.Util import WhereIs
@@ -133,6 +133,8 @@ def configure(env):
# Add helper method for adding libraries.
env.AddMethod(add_js_libraries, "AddJSLibraries")
+ env.AddMethod(add_js_pre, "AddJSPre")
+ env.AddMethod(add_js_externs, "AddJSExterns")
# Add method that joins/compiles our Engine files.
env.AddMethod(create_engine_file, "CreateEngineFile")
diff --git a/platform/javascript/emscripten_helpers.py b/platform/javascript/emscripten_helpers.py
index cc874c432e..278186e4c0 100644
--- a/platform/javascript/emscripten_helpers.py
+++ b/platform/javascript/emscripten_helpers.py
@@ -25,3 +25,15 @@ def add_js_libraries(env, libraries):
if "JS_LIBS" not in env:
env["JS_LIBS"] = []
env.Append(JS_LIBS=env.File(libraries))
+
+
+def add_js_pre(env, js_pre):
+ if "JS_PRE" not in env:
+ env["JS_PRE"] = []
+ env.Append(JS_PRE=env.File(js_pre))
+
+
+def add_js_externs(env, externs):
+ if "JS_EXTERNS" not in env:
+ env["JS_EXTERNS"] = []
+ env.Append(JS_EXTERNS=env.File(externs))