[SCons] Add option to build without threads
This is relevant for the Web platform, where builds with and without
threads are incompatible.
(cherry picked from commit b0296bb562
)
pull/1570/head
parent
1f9a0b7171
commit
aeb8be98ed
|
@ -29,8 +29,10 @@ android.debug.arm64 = "res://bin/libgdexample.android.template_debug.arm64.so"
|
||||||
android.release.arm64 = "res://bin/libgdexample.android.template_release.arm64.so"
|
android.release.arm64 = "res://bin/libgdexample.android.template_release.arm64.so"
|
||||||
ios.debug = "res://bin/libgdexample.ios.template_debug.xcframework"
|
ios.debug = "res://bin/libgdexample.ios.template_debug.xcframework"
|
||||||
ios.release = "res://bin/libgdexample.ios.template_release.xcframework"
|
ios.release = "res://bin/libgdexample.ios.template_release.xcframework"
|
||||||
web.debug.wasm32 = "res://bin/libgdexample.web.template_debug.wasm32.wasm"
|
web.debug.threads.wasm32 = "res://bin/libgdexample.web.template_debug.wasm32.wasm"
|
||||||
web.release.wasm32 = "res://bin/libgdexample.web.template_release.wasm32.wasm"
|
web.release.threads.wasm32 = "res://bin/libgdexample.web.template_release.wasm32.wasm"
|
||||||
|
web.debug.wasm32 = "res://bin/libgdexample.web.template_debug.wasm32.nothreads.wasm"
|
||||||
|
web.release.wasm32 = "res://bin/libgdexample.web.template_release.wasm32.nothreads.wasm"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ios.debug = {
|
ios.debug = {
|
||||||
|
|
|
@ -267,6 +267,8 @@ def options(opts, env):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
opts.Add(BoolVariable(key="threads", help="Enable threading support", default=env.get("threads", True)))
|
||||||
|
|
||||||
# compiledb
|
# compiledb
|
||||||
opts.Add(
|
opts.Add(
|
||||||
BoolVariable(
|
BoolVariable(
|
||||||
|
@ -403,6 +405,9 @@ def generate(env):
|
||||||
|
|
||||||
tool.generate(env)
|
tool.generate(env)
|
||||||
|
|
||||||
|
if env["threads"]:
|
||||||
|
env.Append(CPPDEFINES=["THREADS_ENABLED"])
|
||||||
|
|
||||||
if env.use_hot_reload:
|
if env.use_hot_reload:
|
||||||
env.Append(CPPDEFINES=["HOT_RELOAD_ENABLED"])
|
env.Append(CPPDEFINES=["HOT_RELOAD_ENABLED"])
|
||||||
|
|
||||||
|
@ -446,6 +451,8 @@ def generate(env):
|
||||||
suffix += "." + env["arch"]
|
suffix += "." + env["arch"]
|
||||||
if env["ios_simulator"]:
|
if env["ios_simulator"]:
|
||||||
suffix += ".simulator"
|
suffix += ".simulator"
|
||||||
|
if not env["threads"]:
|
||||||
|
suffix += ".nothreads"
|
||||||
|
|
||||||
env["suffix"] = suffix # Exposed when included from another project
|
env["suffix"] = suffix # Exposed when included from another project
|
||||||
env["OBJSUFFIX"] = suffix + env["OBJSUFFIX"]
|
env["OBJSUFFIX"] = suffix + env["OBJSUFFIX"]
|
||||||
|
|
|
@ -34,8 +34,9 @@ def generate(env):
|
||||||
env["SHLIBSUFFIX"] = ".wasm"
|
env["SHLIBSUFFIX"] = ".wasm"
|
||||||
|
|
||||||
# Thread support (via SharedArrayBuffer).
|
# Thread support (via SharedArrayBuffer).
|
||||||
env.Append(CCFLAGS=["-s", "USE_PTHREADS=1"])
|
if env["threads"]:
|
||||||
env.Append(LINKFLAGS=["-s", "USE_PTHREADS=1"])
|
env.Append(CCFLAGS=["-s", "USE_PTHREADS=1"])
|
||||||
|
env.Append(LINKFLAGS=["-s", "USE_PTHREADS=1"])
|
||||||
|
|
||||||
# Build as side module (shared library).
|
# Build as side module (shared library).
|
||||||
env.Append(CPPFLAGS=["-s", "SIDE_MODULE=1"])
|
env.Append(CPPFLAGS=["-s", "SIDE_MODULE=1"])
|
||||||
|
|
Loading…
Reference in New Issue