summaryrefslogtreecommitdiffstats
path: root/tools/web.py
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2024-06-14 01:42:39 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2024-06-14 01:46:04 +0200
commit1bb543b6f4234a967f1d89dca78e380208177635 (patch)
treec0c731a5f6cba4298d795d426dfebf8926d5374a /tools/web.py
parent6c4064125b6b86c9457497c5101661ac270b65c5 (diff)
downloadredot-cpp-1bb543b6f4234a967f1d89dca78e380208177635.tar.gz
[Web] Force emcc to use "wasm" longjmp mode
SUPPORT_LONGJMP have changed since emscripten 3.1.32 to default to "wasm" mode when exceptions are enabled, and "emscripten" mode when disabled. While we generally doesn't use exception in core, linked libraries may need them, and emscripten don't plan to support WASM EH + Emscripten SjLj in the long term.
Diffstat (limited to 'tools/web.py')
-rw-r--r--tools/web.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/web.py b/tools/web.py
index 61fe96d..c6e57b8 100644
--- a/tools/web.py
+++ b/tools/web.py
@@ -36,12 +36,16 @@ def generate(env):
# Thread support (via SharedArrayBuffer).
if env["threads"]:
- env.Append(CCFLAGS=["-s", "USE_PTHREADS=1"])
- env.Append(LINKFLAGS=["-s", "USE_PTHREADS=1"])
+ env.Append(CCFLAGS=["-sUSE_PTHREADS=1"])
+ env.Append(LINKFLAGS=["-sUSE_PTHREADS=1"])
# Build as side module (shared library).
- env.Append(CPPFLAGS=["-s", "SIDE_MODULE=1"])
- env.Append(LINKFLAGS=["-s", "SIDE_MODULE=1"])
+ env.Append(CPPFLAGS=["-sSIDE_MODULE=1"])
+ env.Append(LINKFLAGS=["-sSIDE_MODULE=1"])
+
+ # Force wasm longjmp mode.
+ env.Append(CCFLAGS=["-sSUPPORT_LONGJMP='wasm'"])
+ env.Append(LINKFLAGS=["-sSUPPORT_LONGJMP='wasm'"])
env.Append(CPPDEFINES=["WEB_ENABLED", "UNIX_ENABLED"])