[SCons] Platform agnostic default toolchain (GNU).

Create the SCons Environment with an empty PLATFORM variable to force
the default tools to use the GNU toolchain.

Platform specific toolchains are then setup in our custom tools.
pull/971/head
Fabio Alessandrelli 2022-12-20 15:22:29 +01:00
parent 104997e83e
commit 8d6982be3b
2 changed files with 8 additions and 1 deletions

View File

@ -28,7 +28,9 @@ elif ARGUMENTS.get("platform", ""):
else: else:
raise ValueError("Could not detect platform automatically, please specify with platform=<platform>") raise ValueError("Could not detect platform automatically, please specify with platform=<platform>")
env = Environment(tools=["default"]) # Default tools with no platform defaults to gnu toolchain.
# We apply platform specific toolchains via our custom tools.
env = Environment(tools=["default"], PLATFORM="")
# Default num_jobs to local cpu count if not user specified. # Default num_jobs to local cpu count if not user specified.
# SCons has a peculiarity where user-specified options won't be overridden # SCons has a peculiarity where user-specified options won't be overridden

View File

@ -23,7 +23,12 @@ def generate(env):
elif env["arch"] == "x86_32": elif env["arch"] == "x86_32":
env["TARGET_ARCH"] = "x86" env["TARGET_ARCH"] = "x86"
env["is_msvc"] = True env["is_msvc"] = True
# MSVC, linker, and archiver.
msvc.generate(env) msvc.generate(env)
env.Tool("mslib")
env.Tool("mslink")
env.Append(CPPDEFINES=["TYPED_METHOD_BIND", "NOMINMAX"]) env.Append(CPPDEFINES=["TYPED_METHOD_BIND", "NOMINMAX"])
env.Append(CCFLAGS=["/EHsc"]) env.Append(CCFLAGS=["/EHsc"])
env.Append(LINKFLAGS=["/WX"]) env.Append(LINKFLAGS=["/WX"])