Fix emscripten 3.1.51 breaking change about `*glGetProcAddress()`

(cherry picked from commit 5922ac0fb1)
This commit is contained in:
Adam Scott 2024-02-05 11:42:28 -05:00 committed by Rémi Verschelde
parent 00e3aa9b07
commit c8ae076c1a
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 9 additions and 4 deletions

View File

@ -185,12 +185,21 @@ def configure(env: "Environment"):
env.Prepend(CPPPATH=["#platform/web"]) env.Prepend(CPPPATH=["#platform/web"])
env.Append(CPPDEFINES=["WEB_ENABLED", "UNIX_ENABLED"]) env.Append(CPPDEFINES=["WEB_ENABLED", "UNIX_ENABLED"])
# 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["opengl3"]: if env["opengl3"]:
env.AppendUnique(CPPDEFINES=["GLES3_ENABLED"]) env.AppendUnique(CPPDEFINES=["GLES3_ENABLED"])
# This setting just makes WebGL 2 APIs available, it does NOT disable WebGL 1. # This setting just makes WebGL 2 APIs available, it does NOT disable WebGL 1.
env.Append(LINKFLAGS=["-s", "USE_WEBGL2=1"]) env.Append(LINKFLAGS=["-s", "USE_WEBGL2=1"])
# Allow use to take control of swapping WebGL buffers. # Allow use to take control of swapping WebGL buffers.
env.Append(LINKFLAGS=["-s", "OFFSCREEN_FRAMEBUFFER=1"]) env.Append(LINKFLAGS=["-s", "OFFSCREEN_FRAMEBUFFER=1"])
# Breaking change since emscripten 3.1.51
# https://github.com/emscripten-core/emscripten/blob/main/ChangeLog.md#3151---121323
if cc_semver >= (3, 1, 51):
# Enables the use of *glGetProcAddress()
env.Append(LINKFLAGS=["-s", "GL_ENABLE_GET_PROC_ADDRESS=1"])
if env["javascript_eval"]: if env["javascript_eval"]:
env.Append(CPPDEFINES=["JAVASCRIPT_EVAL_ENABLED"]) env.Append(CPPDEFINES=["JAVASCRIPT_EVAL_ENABLED"])
@ -202,10 +211,6 @@ def configure(env: "Environment"):
env.Append(LINKFLAGS=["-s", "PTHREAD_POOL_SIZE=8"]) env.Append(LINKFLAGS=["-s", "PTHREAD_POOL_SIZE=8"])
env.Append(LINKFLAGS=["-s", "WASM_MEM_MAX=2048MB"]) 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": if env["lto"] != "none":
# Workaround https://github.com/emscripten-core/emscripten/issues/19781. # Workaround https://github.com/emscripten-core/emscripten/issues/19781.
if cc_semver >= (3, 1, 42) and cc_semver < (3, 1, 46): if cc_semver >= (3, 1, 42) and cc_semver < (3, 1, 46):