Move tools to site_scons/site_tools, which is the canonical scons tools directory. Pass toolpath down the tool chain in godotcpp.py.

pull/1645/head
Lukas Tenbrink 2024-11-20 00:19:39 +01:00
parent c20a84e483
commit 4ec54f32b8
10 changed files with 19 additions and 10 deletions

View File

@ -27,7 +27,16 @@ if profile:
elif os.path.isfile(profile + ".py"): elif os.path.isfile(profile + ".py"):
customs.append(profile + ".py") customs.append(profile + ".py")
opts = Variables(customs, ARGUMENTS) opts = Variables(customs, ARGUMENTS)
cpp_tool = Tool("godotcpp", toolpath=["tools"])
# Some environments do not have setdefault yet.
if "toolpath" not in env:
env["toolpath"] = []
# Needed because if we're called as SConscript, our site_tools are not automatically appended to toolpath.
env["toolpath"].append("site_scons/site_tools")
cpp_tool = Tool("godotcpp", toolpath=env["toolpath"])
cpp_tool.options(opts, env) cpp_tool.options(opts, env)
opts.Update(env) opts.Update(env)

View File

@ -49,13 +49,6 @@ def validate_parent_dir(key, val, env):
raise UserError("'%s' is not a directory: %s" % (key, os.path.dirname(val))) raise UserError("'%s' is not a directory: %s" % (key, os.path.dirname(val)))
def get_platform_tools_paths(env):
path = env.get("custom_tools", None)
if path is None:
return ["tools"]
return [normalize_path(path, env), "tools"]
def get_custom_platforms(env): def get_custom_platforms(env):
path = env.get("custom_tools", None) path = env.get("custom_tools", None)
if path is None: if path is None:
@ -189,6 +182,13 @@ def options(opts, env):
opts.Update(env) opts.Update(env)
# Some environments do not have setdefault yet.
if "toolpath" not in env:
env["toolpath"] = []
if env.get("custom_tools", None) is not None:
env["toolpath"].append(normalize_path(env["custom_tools"], env))
custom_platforms = get_custom_platforms(env) custom_platforms = get_custom_platforms(env)
opts.Add( opts.Add(
@ -340,7 +340,7 @@ def options(opts, env):
# Add platform options (custom tools can override platforms) # Add platform options (custom tools can override platforms)
for pl in sorted(set(platforms + custom_platforms)): for pl in sorted(set(platforms + custom_platforms)):
tool = Tool(pl, toolpath=get_platform_tools_paths(env)) tool = Tool(pl, toolpath=env["toolpath"])
if hasattr(tool, "options"): if hasattr(tool, "options"):
tool.options(opts) tool.options(opts)
@ -451,7 +451,7 @@ def generate(env):
env["optimize"] = ARGUMENTS.get("optimize", opt_level) env["optimize"] = ARGUMENTS.get("optimize", opt_level)
env["debug_symbols"] = get_cmdline_bool("debug_symbols", env.dev_build) env["debug_symbols"] = get_cmdline_bool("debug_symbols", env.dev_build)
tool = Tool(env["platform"], toolpath=get_platform_tools_paths(env)) tool = Tool(env["platform"], toolpath=env["toolpath"])
if tool is None or not tool.exists(env): if tool is None or not tool.exists(env):
raise ValueError("Required toolchain not found for platform " + env["platform"]) raise ValueError("Required toolchain not found for platform " + env["platform"])