|
@@ -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"])
|