bazelbuild / platforms

Constraint values for specifying platforms and toolchains
Apache License 2.0
106 stars 70 forks source link

[question] bazel platforms for c/c++ how to distinguish the toolchain while they are same cpu and os #88

Open damonChenzf07 opened 3 months ago

damonChenzf07 commented 3 months ago

HI ALL: I have encountered a problem: our c/c++ project need to cross compile to different arm boards, and they are all aarch64 & linxu, but with three different toolchains. The platforms has only os and cpu two options to decide a toolchain。Arm I right? So how do I add another option to approach this ? Such as board_type? platform( name = "platfomr_board_A", constraint_values = [ "@platforms//os:linux", "@platforms//cpu:aarch64", ":board_type_A", ], )

platform( name = "platfomr_board_B", constraint_values = [ "@platforms//os:linux", "@platforms//cpu:aarch64", ":board_type_B", ], )

platform( name = "platfomr_board_C", constraint_values = [ "@platforms//os:linux", "@platforms//cpu:aarch64", ":board_type_C", ], )

and the run in the cmd line: bazel build --platfomrs=//:platfomr_board_B //...