From 35905b11f3b3f6ed88203873cc7122f9945af2c7 Mon Sep 17 00:00:00 2001 From: Kehom Date: Thu, 11 Jan 2024 16:32:26 -0300 Subject: [PATCH] Merge branch 'master' of https://github.com/Kehom/godot-cpp --- SConstruct | 27 ++++++++++++++------------- tools/godotcpp.py | 9 +++++++++ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/SConstruct b/SConstruct index b86ccf6f..53124fff 100644 --- a/SConstruct +++ b/SConstruct @@ -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,11 +38,13 @@ opts.Update(env) Help(opts.GenerateHelpText(env)) # Detect and print a warning listing unknown SCons variables to ease troubleshooting. -unknown = opts.UnknownVariables() -if unknown: - print("WARNING: Unknown SCons variables were passed and will be ignored:") - for item in unknown.items(): - print(" " + item[0] + "=" + item[1]) +# 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:") + for item in unknown.items(): + print(" " + item[0] + "=" + item[1]) scons_cache_path = os.environ.get("SCONS_CACHE") if scons_cache_path is not None: diff --git a/tools/godotcpp.py b/tools/godotcpp.py index 0b02eea2..182ee5a5 100644 --- a/tools/godotcpp.py +++ b/tools/godotcpp.py @@ -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"])