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 features = ["-layering_check"], 23) 24 25licenses(["notice"]) 26 27cc_library( 28 name = "pw_multisink", 29 srcs = [ 30 "multisink.cc", 31 ], 32 hdrs = [ 33 "public/pw_multisink/config.h", 34 "public/pw_multisink/multisink.h", 35 ], 36 implementation_deps = ["//pw_assert:check"], 37 strip_include_prefix = "public", 38 deps = [ 39 ":config_override", 40 "//pw_assert:assert", 41 "//pw_bytes", 42 "//pw_function", 43 "//pw_log", 44 "//pw_result", 45 "//pw_ring_buffer", 46 "//pw_sync:interrupt_spin_lock", 47 "//pw_sync:lock_annotations", 48 "//pw_sync:mutex", 49 "//pw_varint", 50 ], 51) 52 53label_flag( 54 name = "config_override", 55 build_setting_default = "//pw_build:default_module_config", 56) 57 58cc_library( 59 name = "util", 60 srcs = ["util.cc"], 61 hdrs = ["public/pw_multisink/util.h"], 62 strip_include_prefix = "public", 63 deps = [ 64 ":pw_multisink", 65 "//pw_bytes", 66 "//pw_function", 67 "//pw_log", 68 "//pw_log:log_proto_pwpb", 69 "//pw_status", 70 ], 71) 72 73cc_library( 74 name = "test_thread", 75 hdrs = ["public/pw_multisink/test_thread.h"], 76 strip_include_prefix = "public", 77 deps = [ 78 "//pw_thread:thread", 79 ], 80) 81 82pw_cc_test( 83 name = "multisink_test", 84 srcs = [ 85 "multisink_test.cc", 86 ], 87 deps = [ 88 ":pw_multisink", 89 "//pw_function", 90 "//pw_preprocessor", 91 "//pw_status", 92 ], 93) 94 95cc_library( 96 name = "multisink_threaded_test", 97 testonly = True, 98 srcs = [ 99 "multisink_threaded_test.cc", 100 ], 101 implementation_deps = ["//pw_containers:vector"], 102 deps = [ 103 ":pw_multisink", 104 ":test_thread", 105 "//pw_string", 106 "//pw_thread:thread", 107 "//pw_thread:thread_core", 108 "//pw_thread:yield", 109 "//pw_unit_test", 110 ], 111) 112 113cc_library( 114 name = "stl_test_thread", 115 srcs = [ 116 "stl_test_thread.cc", 117 ], 118 target_compatible_with = incompatible_with_mcu(), 119 deps = [ 120 ":test_thread", 121 "//pw_thread:thread", 122 "//pw_thread_stl:thread", 123 ], 124) 125 126pw_cc_test( 127 name = "stl_multisink_threaded_test", 128 target_compatible_with = incompatible_with_mcu(), 129 deps = [ 130 ":multisink_threaded_test", 131 ":stl_test_thread", 132 ], 133) 134 135sphinx_docs_library( 136 name = "docs", 137 srcs = [ 138 "Kconfig", 139 "docs.rst", 140 ], 141 prefix = "pw_multisink/", 142 target_compatible_with = incompatible_with_mcu(), 143) 144