xref: /aosp_15_r20/external/pigweed/pw_sensor/CMakeLists.txt (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
15include($ENV{PW_ROOT}/pw_build/pigweed.cmake)
16include($ENV{PW_ROOT}/pw_sensor/sensor.cmake)
17
18pw_add_library(pw_sensor.types INTERFACE
19  HEADERS
20    public/pw_sensor/types.h
21  PUBLIC_INCLUDES
22    public
23  PUBLIC_DEPS
24    pw_tokenizer
25)
26
27pw_sensor_library(pw_sensor.test_constants
28  OUT_HEADER
29    pw_sensor/generated/sensor_constants.h
30  INPUTS
31    $ENV{PW_ROOT}/pw_sensor/attributes.yaml
32    $ENV{PW_ROOT}/pw_sensor/channels.yaml
33    $ENV{PW_ROOT}/pw_sensor/triggers.yaml
34    $ENV{PW_ROOT}/pw_sensor/units.yaml
35  GENERATOR_INCLUDES
36    $ENV{PW_ROOT}
37  SOURCES
38    ${CMAKE_CURRENT_LIST_DIR}/sensor.yaml
39  PUBLIC_DEPS
40    pw_sensor.types
41    pw_containers
42    pw_tokenizer
43)
44
45pw_add_library(pw_sensor INTERFACE
46  HEADERS
47    public/pw_sensor/types.h
48  PUBLIC_INCLUDES
49    public
50  PUBLIC_DEPS
51    pw_tokenizer
52)
53
54# This test does not run on CMake due to missing pw_sensor_library function.
55pw_add_test(pw_sensor.constants_test
56  SOURCES
57    attributes_test.cc
58    channels_test.cc
59    triggers_test.cc
60    units_test.cc
61  PRIVATE_DEPS
62    pw_sensor
63    pw_sensor.test_constants
64  GROUPS
65    modules
66    pw_sensor
67)
68