mirror of
https://github.com/godotengine/godot-nir-static.git
synced 2025-12-31 13:48:20 +03:00
Allow setting additional defines and an extra suffix from the command line
We need to do some builds with additional defines for Xbox because the dxil validator code uses a different DLL name depending on the active defines. It's not really worth adding a whole new platform for this, everything else is just the normal Windows build, so this PR just adds the ability to pass in additional defines from the CLI, and an option to set an additional suffix to the binary, so we can tell builds apart.
This commit is contained in:
15
SConstruct
15
SConstruct
@@ -113,6 +113,13 @@ opts.Add(
|
||||
)
|
||||
)
|
||||
|
||||
opts.Add("cppdefines", "Custom defines for the pre-processor")
|
||||
opts.Add("ccflags", "Custom flags for both the C and C++ compilers")
|
||||
opts.Add("cxxflags", "Custom flags for the C++ compiler")
|
||||
opts.Add("cflags", "Custom flags for the C compiler")
|
||||
opts.Add("linkflags", "Custom flags for the linker")
|
||||
opts.Add("extra_suffix", "Custom extra suffix added to the base filename of all generated binary files.", "")
|
||||
|
||||
# Targets flags tool (optimizations, debug symbols)
|
||||
target_tool = Tool("targets", toolpath=["godot-tools"])
|
||||
target_tool.options(opts)
|
||||
@@ -157,6 +164,12 @@ if unknown:
|
||||
|
||||
print("Building for architecture " + env["arch"] + " on platform " + env["platform"])
|
||||
|
||||
env.Append(CPPDEFINES=env.get("cppdefines", "").split())
|
||||
env.Append(CCFLAGS=env.get("ccflags", "").split())
|
||||
env.Append(CXXFLAGS=env.get("cxxflags", "").split())
|
||||
env.Append(CFLAGS=env.get("cflags", "").split())
|
||||
env.Append(LINKFLAGS=env.get("linkflags", "").split())
|
||||
|
||||
# Require C++17
|
||||
if env.get("is_msvc", False):
|
||||
env.Append(CXXFLAGS=["/std:c++17"])
|
||||
@@ -321,6 +334,8 @@ env.Append(CPPPATH=".")
|
||||
env.Append(CPPPATH="#vulkan/include")
|
||||
|
||||
suffix = ".{}.{}".format(env["platform"], env["arch"])
|
||||
if env.get("extra_suffix", "") != "":
|
||||
suffix += "." + env["extra_suffix"]
|
||||
|
||||
# Expose it when included from another project
|
||||
env["suffix"] = suffix
|
||||
|
||||
Reference in New Issue
Block a user