• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2020 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(default_visibility = ["//visibility:public"])
21
22licenses(["notice"])
23
24cc_library(
25    name = "pw_span",
26    hdrs = [
27        "public/pw_span/internal/span_impl.h",
28        "public/pw_span/span.h",
29    ],
30    strip_include_prefix = "public",
31    deps = [
32        ":config",
33    ],
34)
35
36cc_library(
37    name = "cast",
38    hdrs = [
39        "public/pw_span/cast.h",
40    ],
41    strip_include_prefix = "public",
42    deps = [
43        ":config",
44        ":pw_span",
45        "//pw_bytes:alignment",
46    ],
47)
48
49cc_library(
50    name = "config",
51    hdrs = [
52        "public/pw_span/internal/config.h",
53    ],
54    strip_include_prefix = "public",
55    visibility = ["//visibility:private"],
56    deps = ["//pw_assert:assert"],
57)
58
59pw_cc_test(
60    name = "pw_span_test",
61    srcs = ["span_test.cc"],
62    deps = [
63        ":pw_span",
64        "//pw_polyfill",
65    ],
66)
67
68pw_cc_test(
69    name = "compatibility_test",
70    srcs = ["compatibility_test.cc"],
71    deps = [
72        ":pw_span",
73        "//pw_polyfill",
74    ],
75)
76
77pw_cc_test(
78    name = "cast_test",
79    srcs = ["cast_test.cc"],
80    deps = [
81        ":cast",
82        ":pw_span",
83        "//pw_bytes",
84    ],
85)
86
87filegroup(
88    name = "doxygen",
89    srcs = [
90        "public/pw_span/cast.h",
91        "public/pw_span/internal/config.h",
92    ],
93)
94
95sphinx_docs_library(
96    name = "docs",
97    srcs = [
98        "Kconfig",
99        "cast_test.cc",
100        "docs.rst",
101    ],
102    prefix = "pw_span/",
103    target_compatible_with = incompatible_with_mcu(),
104)
105