xref: /aosp_15_r20/external/pigweed/pw_rust/examples/embedded_hello/BUILD.bazel (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1# Copyright 2023 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15load("@rules_rust//rust:defs.bzl", "rust_binary")
16
17package(default_visibility = ["//visibility:public"])
18
19rust_binary(
20    name = "hello",
21    srcs = ["src/main.rs"],
22    edition = "2021",
23    linker_script = select({
24        "//pw_build/constraints/board:microbit": "//pw_rust/examples/linker_scripts:qemu-rust-nrf51822",
25        "//pw_build/constraints/chipset:lm3s6965evb": "//pw_rust/examples/linker_scripts:qemu-rust-lm3s6965",
26    }),
27    target_compatible_with = select({
28        "//pw_build/constraints/board:microbit": [],
29        "//pw_build/constraints/chipset:lm3s6965evb": [],
30        "@platforms//os:linux": ["@platforms//:incompatible"],
31        "@platforms//os:macos": ["@platforms//:incompatible"],
32        "//conditions:default": ["@platforms//:incompatible"],
33    }),
34    deps = [
35        "@rust_crates//:cortex-m",
36        "@rust_crates//:cortex-m-rt",
37        "@rust_crates//:cortex-m-semihosting",
38        "@rust_crates//:panic-halt",
39    ],
40)
41