mirror of
https://github.com/godotengine/godot-cpp.git
synced 2026-01-01 05:48:37 +03:00
Added fix for javascript build for godot 4.x
Added changes to tools/javascript.py to add PFlags to fix SharedArrayBuffer memory error. Corrected some small errors in tools/javascript.py to support new target names. Also updated ci to include validation for web build.
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import os
|
||||
from SCons.Util import WhereIs
|
||||
|
||||
|
||||
def exists(env):
|
||||
return "EM_CONFIG" in os.environ
|
||||
return WhereIs("emcc") is not None
|
||||
|
||||
|
||||
def generate(env):
|
||||
@@ -10,9 +11,6 @@ def generate(env):
|
||||
print("Only wasm32 supported on web. Exiting.")
|
||||
env.Exit(1)
|
||||
|
||||
if "EM_CONFIG" in os.environ:
|
||||
env["ENV"] = os.environ
|
||||
|
||||
env["CC"] = "emcc"
|
||||
env["CXX"] = "em++"
|
||||
env["AR"] = "emar"
|
||||
@@ -26,6 +24,10 @@ def generate(env):
|
||||
env["ARCOM_POSIX"] = env["ARCOM"].replace("$TARGET", "$TARGET.posix").replace("$SOURCES", "$SOURCES.posix")
|
||||
env["ARCOM"] = "${TEMPFILE(ARCOM_POSIX)}"
|
||||
|
||||
# Thread support (via SharedArrayBuffer).
|
||||
env.Append(CCFLAGS=["-s", "USE_PTHREADS=1"])
|
||||
env.Append(LINKFLAGS=["-s", "USE_PTHREADS=1"])
|
||||
|
||||
# All intermediate files are just LLVM bitcode.
|
||||
env["OBJPREFIX"] = ""
|
||||
env["OBJSUFFIX"] = ".bc"
|
||||
@@ -39,9 +41,4 @@ def generate(env):
|
||||
env.Replace(SHLINKFLAGS="$LINKFLAGS")
|
||||
env.Replace(SHLINKFLAGS="$LINKFLAGS")
|
||||
|
||||
if env["target"] == "debug":
|
||||
env.Append(CCFLAGS=["-O0", "-g"])
|
||||
elif env["target"] == "release":
|
||||
env.Append(CCFLAGS=["-O3"])
|
||||
|
||||
env.Append(CPPDEFINES=["WEB_ENABLED", "UNIX_ENABLED"])
|
||||
|
||||
Reference in New Issue
Block a user