Skip to content

Commit

Permalink
Merge pull request #86036 from adamscott/web-stack-size
Browse files Browse the repository at this point in the history
Set what were default values for web platform linkerflags `-sSTACK_SIZE` and `-sDEFAULT_PTHREAD_STACK_SIZE`
  • Loading branch information
akien-mga authored Dec 11, 2023
2 parents a9f444b + 8e5fbd4 commit 0c03d25
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions platform/web/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,18 @@ def configure(env: "Environment"):
env["LIBPREFIXES"] = ["$LIBPREFIX"]
env["LIBSUFFIXES"] = ["$LIBSUFFIX"]

# Get version info for checks below.
cc_version = get_compiler_version(env)
cc_semver = (cc_version["major"], cc_version["minor"], cc_version["patch"])

env.Prepend(CPPPATH=["#platform/web"])
env.Append(CPPDEFINES=["WEB_ENABLED", "UNIX_ENABLED"])

if cc_semver >= (3, 1, 25):
env.Append(LINKFLAGS=["-s", "STACK_SIZE=5MB"])
else:
env.Append(LINKFLAGS=["-s", "TOTAL_STACK=5MB"])

if env["opengl3"]:
env.AppendUnique(CPPDEFINES=["GLES3_ENABLED"])
# This setting just makes WebGL 2 APIs available, it does NOT disable WebGL 1.
Expand All @@ -203,13 +212,10 @@ def configure(env: "Environment"):
env.Append(CPPDEFINES=["PTHREAD_NO_RENAME"])
env.Append(CCFLAGS=["-s", "USE_PTHREADS=1"])
env.Append(LINKFLAGS=["-s", "USE_PTHREADS=1"])
env.Append(LINKFLAGS=["-s", "DEFAULT_PTHREAD_STACK_SIZE=2MB"])
env.Append(LINKFLAGS=["-s", "PTHREAD_POOL_SIZE=8"])
env.Append(LINKFLAGS=["-s", "WASM_MEM_MAX=2048MB"])

# Get version info for checks below.
cc_version = get_compiler_version(env)
cc_semver = (cc_version["major"], cc_version["minor"], cc_version["patch"])

if env["lto"] != "none":
# Workaround https://github.com/emscripten-core/emscripten/issues/19781.
if cc_semver >= (3, 1, 42) and cc_semver < (3, 1, 46):
Expand Down

0 comments on commit 0c03d25

Please sign in to comment.