Add THREADS_ENABLED macro in order to compile Godot to run on the main thread

This commit is contained in:
Adam Scott
2023-12-01 13:39:09 -05:00
parent 107f2961cc
commit bd70b8e1f6
33 changed files with 447 additions and 72 deletions

View File

@ -183,6 +183,7 @@ opts.Add(BoolVariable("separate_debug_symbols", "Extract debugging symbols to a
opts.Add(EnumVariable("lto", "Link-time optimization (production builds)", "none", ("none", "auto", "thin", "full")))
opts.Add(BoolVariable("production", "Set defaults to build Godot for use in production", False))
opts.Add(BoolVariable("generate_apk", "Generate an APK/AAB after building Android library by calling Gradle", False))
opts.Add(BoolVariable("threads", "Enable threading support", True))
# Components
opts.Add(BoolVariable("deprecated", "Enable compatibility code for deprecated and removed features", True))
@ -832,6 +833,10 @@ if selected_platform in platform_list:
suffix += ".double"
suffix += "." + env["arch"]
if not env["threads"]:
suffix += ".nothreads"
suffix += env.extra_suffix
sys.path.remove(tmppath)
@ -972,6 +977,9 @@ if selected_platform in platform_list:
env.Tool("compilation_db")
env.Alias("compiledb", env.CompilationDatabase())
if env["threads"]:
env.Append(CPPDEFINES=["THREADS_ENABLED"])
Export("env")
# Build subdirs, the build order is dependent on link order.