blob: 8135a93b3dd327a1a37f68a34bb001e51f20b899 [file]
# Copyright 2023 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@sphinxdocs//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library")
load("//pw_build:compatibility.bzl", "incompatible_with_mcu")
load("//pw_build:pw_facade.bzl", "pw_facade")
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
# LINT.IfChange
pw_facade(
name = "pw_multibuf",
hdrs = [
"public/pw_multibuf/allocator.h",
"public/pw_multibuf/chunk.h",
"public/pw_multibuf/from_span.h",
"public/pw_multibuf/header_chunk_region_tracker.h",
"public/pw_multibuf/multibuf.h",
"public/pw_multibuf/observer.h",
"public/pw_multibuf/simple_allocator.h",
"public/pw_multibuf/single_chunk_region_tracker.h",
],
backend = ":backend",
strip_include_prefix = "public",
deps = [":config"],
)
# allocator_async is kept as a separate facade to keep its dep on pw_thread via
# pw_async2 from propagating to incompatible target platforms, e.g. fuchsia,
# stm32xx, etc.
pw_facade(
name = "allocator_async",
hdrs = ["public/pw_multibuf/allocator_async.h"],
backend = ":allocator_async_backend",
strip_include_prefix = "public",
deps = [
":allocator",
":config",
],
)
# LINT.ThenChange(BUILD.gn, CMakeLists.txt)
label_flag(
name = "backend",
build_setting_default = "//pw_multibuf/v1",
)
label_flag(
name = "allocator_async_backend",
build_setting_default = "//pw_multibuf/v1:allocator_async_backend",
)
### Module configuration
label_flag(
name = "config_override",
build_setting_default = "//pw_build:default_module_config",
)
# LINT.IfChange
cc_library(
name = "config",
hdrs = ["public/pw_multibuf/config.h"],
strip_include_prefix = "public",
visibility = ["//pw_multibuf:__subpackages__"],
deps = [":config_override"],
)
# LINT.ThenChange(BUILD.gn, CMakeLists.txt)
### V1 Libraries
alias(
name = "allocator",
actual = ":pw_multibuf",
)
alias(
name = "chunk",
actual = ":pw_multibuf",
)
alias(
name = "from_span",
actual = ":pw_multibuf",
)
alias(
name = "header_chunk_region_tracker",
actual = ":pw_multibuf",
)
alias(
name = "simple_allocator",
actual = ":pw_multibuf",
)
alias(
name = "single_chunk_region_tracker",
actual = ":pw_multibuf",
)
# LINT.IfChange
cc_library(
name = "testing",
testonly = True,
hdrs = ["public/pw_multibuf/simple_allocator_for_test.h"],
strip_include_prefix = "public",
deps = [
":config",
":simple_allocator",
"//pw_allocator:synchronized_allocator",
"//pw_allocator:testing",
"//pw_assert:assert",
"//pw_sync:mutex",
],
)
cc_library(
name = "chunk_testing",
testonly = True,
hdrs = ["private/pw_multibuf_private/chunk_test_base.h"],
strip_include_prefix = "private",
visibility = ["//pw_multibuf:__subpackages__"],
deps = ["//pw_unit_test"],
)
cc_library(
name = "test_utils",
testonly = True,
hdrs = ["private/pw_multibuf_private/test_utils.h"],
strip_include_prefix = "private",
visibility = ["//pw_multibuf:__subpackages__"],
)
# LINT.ThenChange(BUILD.gn, CMakeLists.txt)
## Docs
filegroup(
name = "doxygen",
srcs = [
"public/pw_multibuf/config.h",
"//pw_multibuf/v1:doxygen",
"//pw_multibuf/v1_adapter:doxygen",
"//pw_multibuf/v2:doxygen",
],
)
sphinx_docs_library(
name = "docs",
srcs = [
"code_size.rst",
"concepts.rst",
"design.rst",
"docs.rst",
"guide.rst",
"//pw_multibuf/examples:docs",
"//pw_multibuf/size_report:multibuf_size_report",
],
prefix = "pw_multibuf/",
target_compatible_with = incompatible_with_mcu(),
)