xref: /aosp_15_r20/external/pigweed/pw_uart/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("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test")
16
17package(default_visibility = ["//visibility:public"])
18
19licenses(["notice"])
20
21cc_library(
22    name = "uart_base",
23    hdrs = [
24        "public/pw_uart/uart_base.h",
25    ],
26    strip_include_prefix = "public",
27    deps = [
28        "//pw_status",
29    ],
30)
31
32cc_library(
33    name = "uart",
34    hdrs = [
35        "public/pw_uart/uart.h",
36    ],
37    strip_include_prefix = "public",
38    deps = [
39        ":uart_base",
40        "//pw_assert",
41        "//pw_bytes",
42        "//pw_chrono:system_clock",
43        "//pw_span",
44        "//pw_status",
45    ],
46)
47
48cc_library(
49    name = "uart_non_blocking",
50    hdrs = [
51        "public/pw_uart/uart_non_blocking.h",
52    ],
53    strip_include_prefix = "public",
54    deps = [
55        ":uart_base",
56        "//pw_assert",
57        "//pw_bytes",
58        "//pw_function",
59        "//pw_span",
60        "//pw_status",
61    ],
62)
63
64cc_library(
65    name = "blocking_adapter",
66    srcs = [
67        "blocking_adapter.cc",
68    ],
69    hdrs = [
70        "public/pw_uart/blocking_adapter.h",
71    ],
72    strip_include_prefix = "public",
73    deps = [
74        ":uart",
75        ":uart_non_blocking",
76        "//pw_assert",
77        "//pw_log",
78        "//pw_status",
79        "//pw_sync:timed_thread_notification",
80    ],
81)
82
83cc_library(
84    name = "stream",
85    hdrs = [
86        "public/pw_uart/stream.h",
87    ],
88    strip_include_prefix = "public",
89    deps = [
90        ":uart",
91        "//pw_stream",
92    ],
93)
94
95pw_cc_test(
96    name = "uart_test",
97    srcs = [
98        "uart_test.cc",
99    ],
100    deps = [
101        ":uart",
102        "//pw_unit_test",
103    ],
104)
105
106pw_cc_test(
107    name = "uart_non_blocking_test",
108    srcs = [
109        "uart_non_blocking_test.cc",
110    ],
111    deps = [
112        ":uart_non_blocking",
113        "//pw_unit_test",
114    ],
115)
116
117pw_cc_test(
118    name = "blocking_adapter_test",
119    srcs = [
120        "blocking_adapter_test.cc",
121    ],
122    deps = [
123        ":blocking_adapter",
124        "//pw_assert",
125        "//pw_bytes",
126        "//pw_log",
127        "//pw_sync:lock_annotations",
128        "//pw_sync:mutex",
129        "//pw_sync:timed_thread_notification",
130        "//pw_thread:test_thread_context",
131        "//pw_thread:thread",
132        "//pw_unit_test",
133        "//pw_work_queue",
134    ],
135)
136
137pw_cc_test(
138    name = "stream_test",
139    srcs = [
140        "stream_test.cc",
141    ],
142    deps = [
143        ":stream",
144    ],
145)
146
147# Bazel does not yet support building docs.
148filegroup(
149    name = "docs",
150    srcs = ["docs.rst"],
151)
152
153filegroup(
154    name = "doxygen",
155    srcs = [
156        "public/pw_uart/blocking_adapter.h",
157        "public/pw_uart/stream.h",
158        "public/pw_uart/uart.h",
159        "public/pw_uart/uart_base.h",
160        "public/pw_uart/uart_non_blocking.h",
161    ],
162)
163