Skip to content

Commit

Permalink
[SCons] Platform agnostic default toolchain (GNU).
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Faless committed Dec 20, 2022
1 parent 104997e commit 8d6982b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ elif ARGUMENTS.get("platform", ""):
else:
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.
# SCons has a peculiarity where user-specified options won't be overridden
Expand Down
5 changes: 5 additions & 0 deletions tools/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ def generate(env):
elif env["arch"] == "x86_32":
env["TARGET_ARCH"] = "x86"
env["is_msvc"] = True

# MSVC, linker, and archiver.
msvc.generate(env)
env.Tool("mslib")
env.Tool("mslink")

env.Append(CPPDEFINES=["TYPED_METHOD_BIND", "NOMINMAX"])
env.Append(CCFLAGS=["/EHsc"])
env.Append(LINKFLAGS=["/WX"])
Expand Down

1 comment on commit 8d6982b

@qdeanc
Copy link

@qdeanc qdeanc commented on 8d6982b Dec 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Crazy how it seems like such a simple fix, yet I would have been stuck trying to figure this out for God knows how long. Thank you so much!

Please sign in to comment.