From 37d7666b7ba2dbdc5a0484c57d5efa61abbb9308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 10 Dec 2020 10:20:00 +0100 Subject: [PATCH 1/2] JS: Re-enable LTO for classical builds I had done this locally already but somehow forgot to commit and lost the changes, so re-doing. Not enabling it for Mono builds as it causes errors (or crashes with threads enabled) with Emscripten 1.39.9. --- build-javascript/build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-javascript/build.sh b/build-javascript/build.sh index 72327fe..05b22e2 100755 --- a/build-javascript/build.sh +++ b/build-javascript/build.sh @@ -6,8 +6,8 @@ set -e export BUILD_NAME=official export SCONS="scons -j${NUM_CORES} verbose=yes warnings=no progress=no" -export OPTIONS="debug_symbols=no use_lto=no" -export OPTIONS_MONO="module_mono_enabled=yes mono_static=yes mono_prefix=/root/mono-installs/wasm-runtime-release" +export OPTIONS="debug_symbols=no use_lto=yes" +export OPTIONS_MONO="module_mono_enabled=yes mono_static=yes mono_prefix=/root/mono-installs/wasm-runtime-release use_lto=no" export TERM=xterm rm -rf godot From 1bd06975a91d9a5a6326fb1ecb9c64d36c40ab48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 10 Dec 2020 10:41:23 +0100 Subject: [PATCH 2/2] JS: Build with threads and gdnative where supported Classical builds now use Emscripten 2.0.10 and have threads and gdnative templates. Mono builds still use Emscripten 1.39.9 for compatibility with Mono 6.12.x, so they cannot have GDNative support which requires 2.0.10+. And threads build triggers wasm-ld errors without LTO, and wasm-ld crash with LTO, so no dice there either. Co-authored-by: Fabio Alessandrelli --- build-javascript/build.sh | 12 ++++++++++++ build-release.sh | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/build-javascript/build.sh b/build-javascript/build.sh index 05b22e2..95df2d4 100755 --- a/build-javascript/build.sh +++ b/build-javascript/build.sh @@ -9,6 +9,8 @@ export SCONS="scons -j${NUM_CORES} verbose=yes warnings=no progress=no" export OPTIONS="debug_symbols=no use_lto=yes" export OPTIONS_MONO="module_mono_enabled=yes mono_static=yes mono_prefix=/root/mono-installs/wasm-runtime-release use_lto=no" export TERM=xterm +export EMSDK_CLASSICAL=2.0.10 +export EMSDK_MONO=1.39.9 rm -rf godot mkdir godot @@ -20,9 +22,17 @@ tar xf /root/godot.tar.gz --strip-components=1 if [ "${CLASSICAL}" == "1" ]; then echo "Starting classical build for JavaScript..." + source /root/emsdk_${EMSDK_CLASSICAL}/emsdk_env.sh + $SCONS platform=javascript ${OPTIONS} target=release_debug tools=no $SCONS platform=javascript ${OPTIONS} target=release tools=no + $SCONS platform=javascript ${OPTIONS} target=release_debug tools=no threads_enabled=yes + $SCONS platform=javascript ${OPTIONS} target=release tools=no threads_enabled=yes + + $SCONS platform=javascript ${OPTIONS} target=release_debug tools=no gdnative_enabled=yes + $SCONS platform=javascript ${OPTIONS} target=release tools=no gdnative_enabled=yes + mkdir -p /root/out/templates cp -rvp bin/*.zip /root/out/templates rm -f bin/*.zip @@ -33,6 +43,8 @@ fi if [ "${MONO}" == "1" ]; then echo "Starting Mono build for JavaScript..." + source /root/emsdk_${EMSDK_MONO}/emsdk_env.sh + cp /root/mono-glue/*.cpp modules/mono/glue/ cp -r /root/mono-glue/GodotSharp/GodotSharp/Generated modules/mono/glue/GodotSharp/GodotSharp/ cp -r /root/mono-glue/GodotSharp/GodotSharpEditor/Generated modules/mono/glue/GodotSharp/GodotSharpEditor/ diff --git a/build-release.sh b/build-release.sh index b30af18..82857a1 100755 --- a/build-release.sh +++ b/build-release.sh @@ -176,6 +176,12 @@ if [ "${build_classical}" == "1" ]; then cp out/javascript/templates/godot.javascript.opt.zip ${templatesdir}/webassembly_release.zip cp out/javascript/templates/godot.javascript.opt.debug.zip ${templatesdir}/webassembly_debug.zip + cp out/javascript/templates/godot.javascript.opt.threads.zip ${templatesdir}/webassembly_threads_release.zip + cp out/javascript/templates/godot.javascript.opt.debug.threads.zip ${templatesdir}/webassembly_threads_debug.zip + + cp out/javascript/templates/godot.javascript.opt.gdnative.zip ${templatesdir}/webassembly_gdnative_release.zip + cp out/javascript/templates/godot.javascript.opt.debug.gdnative.zip ${templatesdir}/webassembly_gdnative_debug.zip + ## Android (Classical) ## # Lib for direct download