From 54cda5c3b8622c9168fcd5d1c68964ef7697b27e Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Sat, 24 Oct 2020 22:41:30 +0200 Subject: [HTML5] Update syntax for lto. --- platform/javascript/detect.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'platform/javascript/detect.py') diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index 8f2961b33d..c401fd7b30 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -85,7 +85,8 @@ def configure(env): if env["use_lto"]: env.Append(CCFLAGS=["-s", "WASM_OBJECT_FILES=0"]) env.Append(LINKFLAGS=["-s", "WASM_OBJECT_FILES=0"]) - env.Append(LINKFLAGS=["--llvm-lto", "1"]) + env.Append(CCFLAGS=["-flto"]) + env.Append(LINKFLAGS=["-flto"]) # Closure compiler if env["use_closure_compiler"]: -- cgit v1.2.3 From e2083871eb57e56fe637c3d8f6647ddb4ff539e0 Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Fri, 23 Oct 2020 18:33:20 +0200 Subject: [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). --- platform/javascript/detect.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'platform/javascript/detect.py') diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index c401fd7b30..e6e35f6aa9 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -1,6 +1,6 @@ import os -from emscripten_helpers import run_closure_compiler, create_engine_file +from emscripten_helpers import run_closure_compiler, create_engine_file, add_js_libraries from SCons.Util import WhereIs @@ -96,6 +96,9 @@ def configure(env): jscc = env.Builder(generator=run_closure_compiler, suffix=".cc.js", src_suffix=".js") env.Append(BUILDERS={"BuildJS": jscc}) + # Add helper method for adding libraries. + env.AddMethod(add_js_libraries, "AddJSLibraries") + # Add method that joins/compiles our Engine files. env.AddMethod(create_engine_file, "CreateEngineFile") @@ -166,6 +169,6 @@ def configure(env): env.Append(LINKFLAGS=["-s", "OFFSCREEN_FRAMEBUFFER=1"]) # callMain for manual start, FS for preloading, PATH and ERRNO_CODES for BrowserFS. - env.Append(LINKFLAGS=["-s", "EXTRA_EXPORTED_RUNTIME_METHODS=['callMain', 'FS', 'PATH']"]) + env.Append(LINKFLAGS=["-s", "EXTRA_EXPORTED_RUNTIME_METHODS=['callMain']"]) # Add code that allow exiting runtime. env.Append(LINKFLAGS=["-s", "EXIT_RUNTIME=1"]) -- cgit v1.2.3