Kehom 2024-01-12 15:16:11 +00:00 committed by GitHub
commit a2142bec3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 13 deletions

View File

@ -21,16 +21,15 @@ env.PrependENVPath("PATH", os.getenv("PATH"))
# Custom options and profile flags.
customs = ["custom.py"]
try:
customs += Import("customs")
except:
pass
profile = ARGUMENTS.get("profile", "")
if profile:
if os.path.isfile(profile):
customs.append(profile)
elif os.path.isfile(profile + ".py"):
customs.append(profile + ".py")
if not profile.endswith('.py'):
profile += '.py'
path = str(Entry('#' + profile))
if (os.path.isfile(path)):
customs.append(path)
opts = Variables(customs, ARGUMENTS)
cpp_tool = Tool("godotcpp", toolpath=["tools"])
cpp_tool.options(opts, env)
@ -39,6 +38,8 @@ opts.Update(env)
Help(opts.GenerateHelpText(env))
# Detect and print a warning listing unknown SCons variables to ease troubleshooting.
# But only do that if this is top level SConstruct, not subsidiary
if Dir("#").abspath == Dir(".").abspath:
unknown = opts.UnknownVariables()
if unknown:
print("WARNING: Unknown SCons variables were passed and will be ignored:")

View File

@ -198,6 +198,15 @@ def options(opts, env):
)
)
opts.Add(
PathVariable(
key="profile",
help="Allow specification of customization file other than `custom.py`.",
default=env.get("profile", None),
validator=validate_file,
)
)
# Add platform options
for pl in platforms:
tool = Tool(pl, toolpath=["tools"])