Skip to content

Conversation

@AustinSchuh
Copy link
Contributor

@AustinSchuh AustinSchuh commented Jul 5, 2025

This brings the same functionality that exists in Linux to Windows. When cross compiling with transitions, --copts and friends apply to both the host OS, and the target of cross compilation. This necessitates moving all flags to the toolchain. There is no way to do this today for the windows toolchains without writing a toolchain from scratch, which isn't ideal for a couple of small flag changes.

While we are here, make /D_WIN32_WINNT=0x0601 configurable too in the same way.

This brings the same functionality that exists in Linux to Windows.
When cross compiling with transitions, --copts and friends apply to
both the host OS, and the target of cross compilation.  This
necessitates moving all flags to the toolchain.  There is no way to do
this today for the windows toolchains without writing a toolchain from
scratch, which isn't ideal for a couple of small flag changes.

While we are here, make `/D_WIN32_WINNT=0x0601` configurable too in the
same way, with `BAZEL_WIN32_WINNT`.
@AustinSchuh AustinSchuh force-pushed the configurable_windows_toolchain branch from 3a24287 to 3b661c0 Compare July 5, 2025 23:13
@pzembrod pzembrod requested a review from fmeum July 22, 2025 09:38
"tool_bin_path": attr.string(default = "not_found"),
"tool_paths": attr.string_dict(),
"toolchain_identifier": attr.string(),
"win32_winnt_flag": attr.string(default = "/D_WIN32_WINNT=0x0601"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we drop this so that the default isn't maintained in two places?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Happy to, done. Took a bit more code since foo(win32_winnt_flag=None) or foo(win32_winnt_flag="") is different than foo().

Looking through the logic some more, user defined options should
probably come after the default ones.
@AustinSchuh AustinSchuh requested a review from fmeum July 23, 2025 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants