[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.

(cherry picked from commit 1bb543b6f4)
pull/1572/head
Fabio Alessandrelli 2024-06-14 01:42:39 +02:00 committed by David Snopek
parent 9b4c5f0562
commit 9e860a84a0
1 changed files with 8 additions and 4 deletions

View File

@ -35,12 +35,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"])