You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-24 15:26:15 +00:00
SCons: Fix handling of platform-specific tools, notably mingw
Add optional `detect.py` `get_tools` method to let platforms register SCons tools they need. This helps move this logic out of SConstruct, keeping platforms more self contained, and helping thirdparty platforms define their own custom tools. This logic was also unreliable (the `use_mingw` one would only work if passed manually on the command line, not in e.g. `get_flags`). Co-authored-by: Thaddeus Crews <repiteo@outlook.com>
This commit is contained in:
@@ -155,6 +155,13 @@ def detect_build_env_arch():
|
||||
return ""
|
||||
|
||||
|
||||
def get_tools(env: "SConsEnvironment"):
|
||||
if os.name != "nt" or env["use_mingw"]:
|
||||
return ["mingw"]
|
||||
else:
|
||||
return ["default"]
|
||||
|
||||
|
||||
def get_opts():
|
||||
from SCons.Variables import BoolVariable, EnumVariable
|
||||
|
||||
@@ -326,10 +333,6 @@ def setup_mingw(env: "SConsEnvironment"):
|
||||
print_error("No valid compilers found, use MINGW_PREFIX environment variable to set MinGW path.")
|
||||
sys.exit(255)
|
||||
|
||||
env.Tool("mingw")
|
||||
env.AppendUnique(CCFLAGS=env.get("ccflags", "").split())
|
||||
env.AppendUnique(RCFLAGS=env.get("rcflags", "").split())
|
||||
|
||||
print("Using MinGW, arch %s" % (env["arch"]))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user