Skip to content

Commit

Permalink
Move tools to site_scons/site_tools, which is the canonical scons too…
Browse files Browse the repository at this point in the history
…ls directory.
  • Loading branch information
Ivorforce committed Nov 20, 2024
1 parent c20a84e commit 55cc681
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 10 deletions.
11 changes: 10 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,16 @@ if profile:
elif os.path.isfile(profile + ".py"):
customs.append(profile + ".py")
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)
opts.Update(env)

Expand Down
File renamed without changes.
File renamed without changes.
18 changes: 9 additions & 9 deletions tools/godotcpp.py → site_scons/site_tools/godotcpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,6 @@ def validate_parent_dir(key, val, env):
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):
path = env.get("custom_tools", None)
if path is None:
Expand Down Expand Up @@ -189,6 +182,13 @@ def options(opts, 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)

opts.Add(
Expand Down Expand Up @@ -340,7 +340,7 @@ def options(opts, env):

# Add platform options (custom tools can override 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"):
tool.options(opts)

Expand Down Expand Up @@ -451,7 +451,7 @@ def generate(env):
env["optimize"] = ARGUMENTS.get("optimize", opt_level)
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):
raise ValueError("Required toolchain not found for platform " + env["platform"])
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 55cc681

Please sign in to comment.