You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently working on an SDK which uses Bazel. The SDK exposes itself as a Bazel package to downstream users, and as part of that, provides its own toolchain. This toolchain was up until recently just using the system C++ compiler (with all the associated badness that entails), and I'm currently on a quest to make it use hermetic_cc_toolchain. However, the old toolchain was passing a bunch of compile flags in its cc_toolchain_configure, and I couldn't find any alternative in hermetic_cc_toolchain that would allow me to encapsulate them in the same way. Currently hermetic_cc_toolchain will have a bunch of pre-determined flags that work for itself (and some special-casing for Go, apparently), but it doesn't allow extending that with custom flags.
My current workaround is adding --copt flags in .bazelrc, but asking every downstream user to maintain this file manually and handle updating it is cumbersome.
Solution
It would be great if I could do this:
load("@hermetic_cc_toolchain//toolchain:defs.bzl", zig_toolchains="toolchains")
zig_toolchains(
copts= [
"-Wall",
"-Wextra",
# yadda yadda yadda
],
)
This would pass the flags down to every generated toolchain repository through declare_cc_toolchains. Then I would be able to put this in a macro and just tell downstream to call it (via WORKSPACE or module extensions). Maybe in the future it would be worthwhile to be able to specify target-specific flags as well, but this would still solve the majority of the problem for me.
The text was updated successfully, but these errors were encountered:
Problem Definition
I am currently working on an SDK which uses Bazel. The SDK exposes itself as a Bazel package to downstream users, and as part of that, provides its own toolchain. This toolchain was up until recently just using the system C++ compiler (with all the associated badness that entails), and I'm currently on a quest to make it use
hermetic_cc_toolchain
. However, the old toolchain was passing a bunch of compile flags in itscc_toolchain_configure
, and I couldn't find any alternative inhermetic_cc_toolchain
that would allow me to encapsulate them in the same way. Currentlyhermetic_cc_toolchain
will have a bunch of pre-determined flags that work for itself (and some special-casing for Go, apparently), but it doesn't allow extending that with custom flags.My current workaround is adding
--copt
flags in.bazelrc
, but asking every downstream user to maintain this file manually and handle updating it is cumbersome.Solution
It would be great if I could do this:
This would pass the flags down to every generated toolchain repository through
declare_cc_toolchains
. Then I would be able to put this in a macro and just tell downstream to call it (viaWORKSPACE
or module extensions). Maybe in the future it would be worthwhile to be able to specify target-specific flags as well, but this would still solve the majority of the problem for me.The text was updated successfully, but these errors were encountered: