xref: /aosp_15_r20/external/pigweed/pw_rust/examples/tokenized_logging/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", "rust_library")
16
17package(default_visibility = ["//visibility:public"])
18
19rust_binary(
20    name = "tokenized_logging",
21    srcs = ["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        "//pw_log/rust:pw_log",
36        "@rust_crates//:cortex-m",
37        "@rust_crates//:cortex-m-rt",
38        "@rust_crates//:cortex-m-semihosting",
39        "@rust_crates//:panic-halt",
40    ],
41)
42
43rust_library(
44    name = "pw_log_backend",
45    srcs = [
46        "pw_log_backend.rs",
47    ],
48    crate_name = "pw_log_backend",
49    visibility = ["//visibility:public"],
50    deps = [
51        "//pw_base64/rust:pw_base64",
52        "//pw_format/rust:pw_format_core",
53        "//pw_log/rust:pw_log_backend_api",
54        "//pw_status/rust:pw_status",
55        "//pw_stream/rust:pw_stream",
56        "//pw_tokenizer/rust:pw_tokenizer",
57        "@rust_crates//:cortex-m-semihosting",
58    ],
59)
60