xref: /aosp_15_r20/external/pigweed/pw_sensor/BUILD.bazel (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1# Copyright 2024 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("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test")
16load(
17    "sensor.bzl",
18    "pw_sensor_library",
19)
20
21package(default_visibility = ["//visibility:public"])
22
23licenses(["notice"])
24
25cc_library(
26    name = "pw_sensor_types",
27    srcs = [],
28    hdrs = [
29        "public/pw_sensor/types.h",
30    ],
31    includes = ["public"],
32    deps = [
33        "//pw_tokenizer",
34    ],
35)
36
37pw_sensor_library(
38    name = "test_constants_lib",
39    srcs = [":sensor.yaml"],
40    generator_includes = ["../"],
41    inputs = [
42        ":attributes.yaml",
43        ":channels.yaml",
44        ":triggers.yaml",
45        ":units.yaml",
46    ],
47    out_header = "public/pw_sensor/generated/sensor_constants.h",
48    deps = [
49        ":pw_sensor_types",
50        "//pw_containers:flat_map",
51    ],
52)
53
54pw_cc_test(
55    name = "constants_test",
56    srcs = [
57        "attributes_test.cc",
58        "channels_test.cc",
59        "triggers_test.cc",
60        "units_test.cc",
61    ],
62    deps = [
63        ":pw_sensor_types",
64        ":test_constants_lib",
65    ],
66)
67
68# Bazel does not yet support building docs.
69filegroup(
70    name = "docs",
71    srcs = ["docs.rst"],
72)
73