cc_library(
name = "C",
)
cc_library(
name = "B",
deps = [":C"],
)
cc_library(
name = "A",
defines = ["CPU_FREQ=8MHz"],
deps = [":B"],
)
I'd love a way to have both B and C be recompiled with the compiler option -DCPU_FREQ=8MHz. AFAICT there isn't a way of doing this short of creating a new target and having "C" depend on it, which isn't practical when dealing with external dependencies defined in WORKSPACE.
I'm trying this madness because I'm looking to solve two issues:
1) Embedded systems - even if they're the same chip - might need different compile-time defines. For example, you might have two cc_binary targets:
cc_binary(name="Foo", defines=["FEATURE_X"], deps = [":A"])
cc_binary(name="Bar", defines=["FEATURE_Y", "FEATURE_Z"], deps = [":A"])
The libraries A/B/C might have different code paths depending on which features are enabled, and should be compiled once for Foo and once for Bar. You can work around this by creating two parallel dependency cc_library chains "A_feature_x"->"B_feature_x"->"C_feature_x" and "A_feature_y_z"->"B_feature_y_z"->"C_feature_y_z", but that's kinda kludgy and not possible when working with external repos.
2) Unfortunately a lot of embedded SDKs have flat include paths. It would be super helpful to be able to tell these external libraries "Hey look at these headers first" or at least "Prepend this include directory to includes" from the target that depends on them.
--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/1340d3c7-0ab6-40aa-82a8-f180161adb34%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.