diff options
author | Leon Krause <lk@leonkrause.com> | 2018-01-13 18:47:28 +0100 |
---|---|---|
committer | Leon Krause <lk@leonkrause.com> | 2018-01-13 19:40:59 +0100 |
commit | bd1750c076a51d668dbb07f0ad5927ba621884a7 (patch) | |
tree | 4438d7a97157ef9fc29a3a38170128b4cda4c9bb /platform | |
parent | 892568abeeb6837a801f6d3769c7dd75f3ac5f92 (diff) |
Wrap Emscripten module into JS Engine singleton per SCons
Emscripten's meta DCE changes in 1.37.27(/28?) make it impossible to
keep using --pre-js for this
Diffstat (limited to 'platform')
-rw-r--r-- | platform/javascript/SCsub | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/platform/javascript/SCsub b/platform/javascript/SCsub index 05992ebac8..66a8a8d93c 100644 --- a/platform/javascript/SCsub +++ b/platform/javascript/SCsub @@ -23,6 +23,7 @@ env.Append(LINKFLAGS=["-s", "EXPORTED_FUNCTIONS=\"['_main','_main_after_fs_sync' target_dir = env.Dir("#bin") build = env.add_program(['#bin/godot', target_dir.File('godot' + env['PROGSUFFIX'] + '.wasm')], javascript_objects, PROGSUFFIX=env['PROGSUFFIX'] + '.js'); +js, wasm = build js_libraries = [] js_libraries.append(env.File('http_request.js')) @@ -30,12 +31,10 @@ for lib in js_libraries: env.Append(LINKFLAGS=['--js-library', lib.path]) env.Depends(build, js_libraries) -prejs = env.File('pre.js') -postjs = env.File('engine.js') -env.Append(LINKFLAGS=['--pre-js', prejs.path]) -env.Append(LINKFLAGS=['--post-js', postjs.path]) -env.Depends(build, [prejs, postjs]) +wrapper_start = env.File('pre.js') +wrapper_end = env.File('engine.js') +js_final = env.Textfile('#bin/godot', [wrapper_start, js, wrapper_end], TEXTFILESUFFIX=env['PROGSUFFIX'] + '.wrapped.js') zip_dir = target_dir.Dir('.javascript_zip') -zip_files = env.InstallAs([zip_dir.File('godot.js'), zip_dir.File('godot.wasm'), zip_dir.File('godot.html')], build + ['#misc/dist/html/default.html']) +zip_files = env.InstallAs([zip_dir.File('godot.js'), zip_dir.File('godot.wasm'), zip_dir.File('godot.html')], [js_final, wasm, '#misc/dist/html/default.html']) Zip('#bin/godot', zip_files, ZIPSUFFIX=env['PROGSUFFIX'] + env['ZIPSUFFIX'], ZIPROOT=zip_dir, ZIPCOMSTR="Archving $SOURCES as $TARGET") |