xref: /aosp_15_r20/external/pigweed/pw_sensor/BUILD.gn (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
15import("//build_overrides/pigweed.gni")
16
17import("$dir_pw_docgen/docs.gni")
18import("$dir_pw_sensor/sensor.gni")
19import("$dir_pw_unit_test/test.gni")
20
21config("default_config") {
22  include_dirs = [ "public" ]
23}
24
25pw_source_set("pw_sensor_types") {
26  public = [ "public/pw_sensor/types.h" ]
27  public_configs = [ ":default_config" ]
28}
29
30pw_sensor_library("test_constants_lib") {
31  out_header = "pw_sensor/generated/sensor_constants.h"
32  sources = [ "sensor.yaml" ]
33  inputs = [
34    "attributes.yaml",
35    "channels.yaml",
36    "triggers.yaml",
37    "units.yaml",
38  ]
39  generator_includes = [ getenv("PW_ROOT") ]
40  public_deps = [
41    ":pw_sensor_types",
42    "$dir_pw_containers:flat_map",
43    "$dir_pw_tokenizer:pw_tokenizer",
44  ]
45}
46
47pw_test("constants_test") {
48  deps = [ ":test_constants_lib" ]
49  sources = [
50    "attributes_test.cc",
51    "channels_test.cc",
52    "triggers_test.cc",
53    "units_test.cc",
54  ]
55}
56
57pw_test_group("tests") {
58  tests = [ ":constants_test" ]
59}
60
61pw_doc_group("docs") {
62  sources = [ "docs.rst" ]
63  group_deps = [ "py:docs" ]
64}
65