Skip to content

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

Description

@damonChenzf07

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 //...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions