2019-03-26 23:51:51 +00:00
|
|
|
#!/usr/bin/env python
|
2017-04-18 00:16:57 +00:00
|
|
|
|
2019-03-26 23:51:51 +00:00
|
|
|
import os
|
2022-12-19 08:46:00 +00:00
|
|
|
|
2023-07-22 15:59:11 +00:00
|
|
|
EnsureSConsVersion(4, 0)
|
2022-12-19 08:46:00 +00:00
|
|
|
|
2018-02-22 22:16:25 +00:00
|
|
|
|
2023-07-09 13:27:31 +00:00
|
|
|
try:
|
|
|
|
Import("env")
|
2024-06-24 17:20:55 +00:00
|
|
|
except Exception:
|
2023-07-09 13:27:31 +00:00
|
|
|
# Default tools with no platform defaults to gnu toolchain.
|
|
|
|
# We apply platform specific toolchains via our custom tools.
|
|
|
|
env = Environment(tools=["default"], PLATFORM="")
|
|
|
|
|
2023-06-14 15:30:24 +00:00
|
|
|
env.PrependENVPath("PATH", os.getenv("PATH"))
|
2020-03-30 21:58:20 +00:00
|
|
|
|
2022-09-24 16:44:25 +00:00
|
|
|
# Custom options and profile flags.
|
|
|
|
customs = ["custom.py"]
|
2023-08-17 13:28:44 +00:00
|
|
|
try:
|
|
|
|
customs += Import("customs")
|
2024-06-24 17:20:55 +00:00
|
|
|
except Exception:
|
2023-08-17 13:28:44 +00:00
|
|
|
pass
|
2022-09-24 16:44:25 +00:00
|
|
|
profile = ARGUMENTS.get("profile", "")
|
|
|
|
if profile:
|
|
|
|
if os.path.isfile(profile):
|
|
|
|
customs.append(profile)
|
|
|
|
elif os.path.isfile(profile + ".py"):
|
|
|
|
customs.append(profile + ".py")
|
|
|
|
opts = Variables(customs, ARGUMENTS)
|
2024-11-19 23:19:39 +00:00
|
|
|
|
|
|
|
# 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"])
|
|
|
|
|
2023-07-22 15:59:11 +00:00
|
|
|
cpp_tool.options(opts, env)
|
2018-08-16 14:14:35 +00:00
|
|
|
opts.Update(env)
|
2022-05-29 08:51:33 +00:00
|
|
|
|
2023-07-22 15:59:11 +00:00
|
|
|
Help(opts.GenerateHelpText(env))
|
2022-05-29 08:51:33 +00:00
|
|
|
|
2021-11-23 21:41:52 +00:00
|
|
|
# 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])
|
|
|
|
|
2022-09-13 08:37:58 +00:00
|
|
|
scons_cache_path = os.environ.get("SCONS_CACHE")
|
|
|
|
if scons_cache_path is not None:
|
|
|
|
CacheDir(scons_cache_path)
|
|
|
|
Decider("MD5")
|
|
|
|
|
2023-07-22 15:59:11 +00:00
|
|
|
cpp_tool.generate(env)
|
|
|
|
library = env.GodotCPP()
|
2021-09-30 02:29:42 +00:00
|
|
|
|
|
|
|
Return("env")
|