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