diff options
author | David Snopek <dsnopek@gmail.com> | 2024-05-16 10:39:57 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-16 10:39:57 -0500 |
commit | 340dde31a28222ed09a68176b5c658e531fd73d9 (patch) | |
tree | e94ba662aa993da4613cb6505db72c328e8ce167 /tools | |
parent | 6b39ed0732116766c667cf509b99a769e2c41776 (diff) | |
parent | b0296bb562af0ff812b732586c06ae6b3f96ef84 (diff) | |
download | redot-cpp-340dde31a28222ed09a68176b5c658e531fd73d9.tar.gz |
Merge pull request #1451 from Faless/build/to_threads_or_not_to_threads
[SCons] Add option to build without threads
Diffstat (limited to 'tools')
-rw-r--r-- | tools/godotcpp.py | 7 | ||||
-rw-r--r-- | tools/web.py | 5 |
2 files changed, 10 insertions, 2 deletions
diff --git a/tools/godotcpp.py b/tools/godotcpp.py index 2e61e2b..d5285dc 100644 --- a/tools/godotcpp.py +++ b/tools/godotcpp.py @@ -266,6 +266,8 @@ def options(opts, env): ) ) + opts.Add(BoolVariable(key="threads", help="Enable threading support", default=env.get("threads", True))) + # compiledb opts.Add( BoolVariable( @@ -438,6 +440,9 @@ def generate(env): tool.generate(env) + if env["threads"]: + env.Append(CPPDEFINES=["THREADS_ENABLED"]) + if env.use_hot_reload: env.Append(CPPDEFINES=["HOT_RELOAD_ENABLED"]) @@ -481,6 +486,8 @@ def generate(env): suffix += "." + env["arch"] if env["ios_simulator"]: suffix += ".simulator" + if not env["threads"]: + suffix += ".nothreads" env["suffix"] = suffix # Exposed when included from another project env["OBJSUFFIX"] = suffix + env["OBJSUFFIX"] diff --git a/tools/web.py b/tools/web.py index c7440bc..61fe96d 100644 --- a/tools/web.py +++ b/tools/web.py @@ -35,8 +35,9 @@ def generate(env): env["SHLIBSUFFIX"] = ".wasm" # Thread support (via SharedArrayBuffer). - env.Append(CCFLAGS=["-s", "USE_PTHREADS=1"]) - env.Append(LINKFLAGS=["-s", "USE_PTHREADS=1"]) + if env["threads"]: + env.Append(CCFLAGS=["-s", "USE_PTHREADS=1"]) + env.Append(LINKFLAGS=["-s", "USE_PTHREADS=1"]) # Build as side module (shared library). env.Append(CPPFLAGS=["-s", "SIDE_MODULE=1"]) |