xref: /aosp_15_r20/external/pigweed/pw_bytes/BUILD.bazel (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1# Copyright 2021 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 = "pw_bytes",
23    srcs = [
24        "byte_builder.cc",
25    ],
26    hdrs = [
27        "public/pw_bytes/array.h",
28        "public/pw_bytes/byte_builder.h",
29        "public/pw_bytes/endian.h",
30        "public/pw_bytes/span.h",
31        "public/pw_bytes/suffix.h",
32        "public/pw_bytes/units.h",
33    ],
34    strip_include_prefix = "public",
35    deps = [
36        ":bit",
37        "//pw_containers:iterator",
38        "//pw_polyfill",
39        "//pw_preprocessor",
40        "//pw_span",
41        "//pw_status",
42    ],
43)
44
45cc_library(
46    name = "alignment",
47    srcs = [
48        "alignment.cc",
49    ],
50    hdrs = ["public/pw_bytes/alignment.h"],
51    strip_include_prefix = "public",
52    deps = [
53        "//pw_assert",
54        "//pw_bytes",
55        "//pw_preprocessor",
56        "//third_party/fuchsia:stdcompat",
57    ],
58)
59
60cc_library(
61    name = "bit",
62    hdrs = ["public/pw_bytes/bit.h"],
63    strip_include_prefix = "public",
64    deps = ["//third_party/fuchsia:stdcompat"],
65)
66
67cc_library(
68    name = "packed_ptr",
69    hdrs = ["public/pw_bytes/packed_ptr.h"],
70    strip_include_prefix = "public",
71    deps = [
72        "//pw_assert",
73        "//third_party/fuchsia:stdcompat",
74    ],
75)
76
77pw_cc_test(
78    name = "alignment_test",
79    srcs = ["alignment_test.cc"],
80    deps = [
81        ":alignment",
82        "//pw_unit_test",
83    ],
84)
85
86pw_cc_test(
87    name = "array_test",
88    srcs = ["array_test.cc"],
89    deps = [
90        ":pw_bytes",
91        "//pw_unit_test",
92    ],
93)
94
95pw_cc_test(
96    name = "bit_test",
97    srcs = ["bit_test.cc"],
98    deps = [
99        ":bit",
100        "//pw_unit_test",
101    ],
102)
103
104pw_cc_test(
105    name = "byte_builder_test",
106    srcs = ["byte_builder_test.cc"],
107    deps = [
108        ":pw_bytes",
109        "//pw_unit_test",
110    ],
111)
112
113pw_cc_test(
114    name = "endian_test",
115    srcs = ["endian_test.cc"],
116    deps = [
117        ":pw_bytes",
118        "//pw_unit_test",
119    ],
120)
121
122pw_cc_test(
123    name = "packed_ptr_test",
124    srcs = ["packed_ptr_test.cc"],
125    deps = [
126        ":packed_ptr",
127        "//pw_compilation_testing:negative_compilation_testing",
128        "//pw_unit_test",
129    ],
130)
131
132pw_cc_test(
133    name = "suffix_test",
134    srcs = ["suffix_test.cc"],
135    deps = [
136        ":pw_bytes",
137        "//pw_compilation_testing:negative_compilation_testing",
138        "//pw_unit_test",
139    ],
140)
141
142pw_cc_test(
143    name = "units_test",
144    srcs = ["units_test.cc"],
145    deps = [
146        ":pw_bytes",
147        "//pw_unit_test",
148    ],
149)
150
151filegroup(
152    name = "doxygen",
153    srcs = [
154        "public/pw_bytes/alignment.h",
155        "public/pw_bytes/bit.h",
156        "public/pw_bytes/byte_builder.h",
157        "public/pw_bytes/packed_ptr.h",
158    ],
159)
160