• 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(
16    "//pw_build:pigweed.bzl",
17    "pw_cc_test",
18)
19load(
20    "//pw_build:selects.bzl",
21    "TARGET_COMPATIBLE_WITH_HOST_SELECT",
22)
23
24package(default_visibility = ["//visibility:public"])
25
26licenses(["notice"])
27
28cc_library(
29    name = "pw_multisink",
30    srcs = [
31        "multisink.cc",
32    ],
33    hdrs = [
34        "public/pw_multisink/config.h",
35        "public/pw_multisink/multisink.h",
36    ],
37    includes = ["public"],
38    deps = [
39        ":config_override",
40        "//pw_assert",
41        "//pw_bytes",
42        "//pw_containers",
43        "//pw_function",
44        "//pw_log",
45        "//pw_result",
46        "//pw_ring_buffer",
47        "//pw_sync:interrupt_spin_lock",
48        "//pw_sync:lock_annotations",
49        "//pw_sync:mutex",
50        "//pw_varint",
51    ],
52)
53
54label_flag(
55    name = "config_override",
56    build_setting_default = "//pw_build:default_module_config",
57)
58
59cc_library(
60    name = "util",
61    srcs = ["util.cc"],
62    hdrs = ["public/pw_multisink/util.h"],
63    includes = ["public"],
64    deps = [
65        ":pw_multisink",
66        "//pw_bytes",
67        "//pw_function",
68        "//pw_log",
69        "//pw_log:log_proto_cc.pwpb",
70        "//pw_status",
71    ],
72)
73
74cc_library(
75    name = "test_thread",
76    hdrs = ["public/pw_multisink/test_thread.h"],
77    includes = ["public"],
78    deps = [
79        "//pw_thread:thread",
80    ],
81)
82
83pw_cc_test(
84    name = "multisink_test",
85    srcs = [
86        "multisink_test.cc",
87    ],
88    deps = [
89        ":pw_multisink",
90        "//pw_function",
91        "//pw_preprocessor",
92        "//pw_status",
93        "//pw_unit_test",
94    ],
95)
96
97cc_library(
98    name = "multisink_threaded_test",
99    testonly = True,
100    srcs = [
101        "multisink_threaded_test.cc",
102    ],
103    deps = [
104        ":pw_multisink",
105        ":test_thread",
106        "//pw_string",
107        "//pw_thread:thread",
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 = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
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 = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
129    deps = [
130        ":multisink_threaded_test",
131        ":stl_test_thread",
132    ],
133)
134