diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/javascript/SCsub | 11 | ||||
-rw-r--r-- | platform/javascript/detect.py | 20 | ||||
-rw-r--r-- | platform/javascript/emscripten_helpers.py | 9 | ||||
-rw-r--r-- | platform/javascript/export/export.cpp | 1 | ||||
-rw-r--r-- | platform/javascript/js/dynlink.pre.js | 1 | ||||
-rw-r--r-- | platform/javascript/js/engine/engine.js | 2 | ||||
-rw-r--r-- | platform/uwp/os_uwp.cpp | 2 | ||||
-rw-r--r-- | platform/windows/os_windows.cpp | 2 |
8 files changed, 34 insertions, 14 deletions
diff --git a/platform/javascript/SCsub b/platform/javascript/SCsub index b0302a5f88..11a45d2811 100644 --- a/platform/javascript/SCsub +++ b/platform/javascript/SCsub @@ -42,8 +42,6 @@ if env["gdnative_enabled"]: sys_env["LIBS"] = [] # We use IDBFS. Since Emscripten 1.39.1 it needs to be linked explicitly. sys_env.Append(LIBS=["idbfs.js"]) - # JS prepended to the module code loading the side library. - sys_env.Append(LINKFLAGS=["--pre-js", sys_env.File("js/dynlink.pre.js")]) # Configure it as a main module (dynamic linking support). sys_env.Append(CCFLAGS=["-s", "MAIN_MODULE=1"]) sys_env.Append(LINKFLAGS=["-s", "MAIN_MODULE=1"]) @@ -53,7 +51,6 @@ if env["gdnative_enabled"]: sys_env["ENV"]["EMCC_FORCE_STDLIBS"] = "libc,libc++,libc++abi" # The main emscripten runtime, with exported standard libraries. sys = sys_env.Program(build_targets, ["javascript_runtime.cpp"]) - sys_env.Depends(sys, "js/dynlink.pre.js") # The side library, containing all Godot code. wasm_env = env.Clone() @@ -97,7 +94,13 @@ out_files = [ zip_dir.File(binary_name + ".html"), zip_dir.File(binary_name + ".audio.worklet.js"), ] -html_file = "#misc/dist/html/editor.html" if env["tools"] else "#misc/dist/html/full-size.html" +html_file = "#misc/dist/html/full-size.html" +if env["tools"]: + subst_dict = {"\$GODOT_VERSION": env.GetBuildVersion()} + html_file = env.Substfile( + target="#bin/godot${PROGSUFFIX}.html", source="#misc/dist/html/editor.html", SUBST_DICT=subst_dict + ) + in_files = [js_wrapped, build[1], html_file, "#platform/javascript/js/libs/audio.worklet.js"] if env["gdnative_enabled"]: in_files.append(build[2]) # Runtime diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index 0d57f8aad1..76683da947 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -1,7 +1,14 @@ import os import sys -from emscripten_helpers import run_closure_compiler, create_engine_file, add_js_libraries, add_js_pre, add_js_externs +from emscripten_helpers import ( + run_closure_compiler, + create_engine_file, + add_js_libraries, + add_js_pre, + add_js_externs, + get_build_version, +) from methods import get_compiler_version from SCons.Util import WhereIs @@ -51,11 +58,13 @@ def get_flags(): def configure(env): if not isinstance(env["initial_memory"], int): - print("Initial memory must be a valid integer") - sys.exit(255) + try: + env["initial_memory"] = int(env["initial_memory"]) + except: + print("Initial memory must be a valid integer") + sys.exit(255) ## Build type - if env["target"] == "release": # Use -Os to prioritize optimizing for reduced file size. This is # particularly valuable for the web platform because it directly @@ -139,6 +148,9 @@ def configure(env): env.AddMethod(add_js_pre, "AddJSPre") env.AddMethod(add_js_externs, "AddJSExterns") + # Add method for getting build version string. + env.AddMethod(get_build_version, "GetBuildVersion") + # 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 8b8c492e22..d08555916b 100644 --- a/platform/javascript/emscripten_helpers.py +++ b/platform/javascript/emscripten_helpers.py @@ -15,6 +15,15 @@ def run_closure_compiler(target, source, env, for_signature): return " ".join(cmd) +def get_build_version(env): + import version + + name = "custom_build" + if os.getenv("BUILD_NAME") != None: + name = os.getenv("BUILD_NAME") + return "%d.%d.%d.%s.%s" % (version.major, version.minor, version.patch, version.status, name) + + def create_engine_file(env, target, source, externs): if env["use_closure_compiler"]: return env.BuildJS(target, source, JSEXTERNS=externs) diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp index 48ccc1f87a..dd0938ee3e 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -135,6 +135,7 @@ public: s += "Access-Control-Allow-Origin: *\r\n"; s += "Cross-Origin-Opener-Policy: same-origin\r\n"; s += "Cross-Origin-Embedder-Policy: require-corp\r\n"; + s += "Cache-Control: no-store, max-age=0\r\n"; s += "\r\n"; CharString cs = s.utf8(); Error err = connection->put_data((const uint8_t *)cs.get_data(), cs.size() - 1); diff --git a/platform/javascript/js/dynlink.pre.js b/platform/javascript/js/dynlink.pre.js deleted file mode 100644 index 34bc371ea9..0000000000 --- a/platform/javascript/js/dynlink.pre.js +++ /dev/null @@ -1 +0,0 @@ -Module['dynamicLibraries'] = [Module['thisProgram'] + '.side.wasm'].concat(Module['dynamicLibraries'] ? Module['dynamicLibraries'] : []); diff --git a/platform/javascript/js/engine/engine.js b/platform/javascript/js/engine/engine.js index 4b8a7dde69..01232cbece 100644 --- a/platform/javascript/js/engine/engine.js +++ b/platform/javascript/js/engine/engine.js @@ -62,7 +62,7 @@ const Engine = (function () { // Emscripten configuration. config['thisProgram'] = me.executableName; config['noExitRuntime'] = true; - config['dynamicLibraries'] = me.gdnativeLibs; + config['dynamicLibraries'] = [`${me.executableName}.side.wasm`].concat(me.gdnativeLibs); Godot(config).then(function (module) { module['initFS'](me.persistentPaths).then(function (fs_err) { me.rtenv = module; diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp index 5760bcc72c..f43c4ecdaf 100644 --- a/platform/uwp/os_uwp.cpp +++ b/platform/uwp/os_uwp.cpp @@ -39,7 +39,6 @@ #include "drivers/windows/dir_access_windows.h" #include "drivers/windows/file_access_windows.h" #include "drivers/windows/mutex_windows.h" -#include "drivers/windows/rw_lock_windows.h" #include "drivers/windows/semaphore_windows.h" #include "main/main.h" #include "platform/windows/windows_terminal_logger.h" @@ -132,7 +131,6 @@ void OS_UWP::initialize_core() { //RedirectIOToConsole(); ThreadUWP::make_default(); - RWLockWindows::make_default(); FileAccess::make_default<FileAccessWindows>(FileAccess::ACCESS_RESOURCES); FileAccess::make_default<FileAccessWindows>(FileAccess::ACCESS_USERDATA); diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index f0848ff880..3c38c715c1 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -39,7 +39,6 @@ #include "core/version_generated.gen.h" #include "drivers/windows/dir_access_windows.h" #include "drivers/windows/file_access_windows.h" -#include "drivers/windows/rw_lock_windows.h" #include "drivers/windows/thread_windows.h" #include "joypad_windows.h" #include "lang_table.h" @@ -178,7 +177,6 @@ void OS_Windows::initialize() { //RedirectIOToConsole(); ThreadWindows::make_default(); - RWLockWindows::make_default(); FileAccess::make_default<FileAccessWindows>(FileAccess::ACCESS_RESOURCES); FileAccess::make_default<FileAccessWindows>(FileAccess::ACCESS_USERDATA); |