xref: /aosp_15_r20/external/pigweed/pw_sync_stl/BUILD.bazel (revision 61c4878ac05f98d0ceed94b57d316916de578985)
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("//pw_build:compatibility.bzl", "incompatible_with_mcu")
16
17package(default_visibility = ["//visibility:public"])
18
19licenses(["notice"])
20
21cc_library(
22    name = "binary_semaphore",
23    srcs = [
24        "binary_semaphore.cc",
25    ],
26    hdrs = [
27        "public/pw_sync_stl/binary_semaphore_inline.h",
28        "public/pw_sync_stl/binary_semaphore_native.h",
29        "public_overrides/pw_sync_backend/binary_semaphore_inline.h",
30        "public_overrides/pw_sync_backend/binary_semaphore_native.h",
31    ],
32    includes = [
33        "public",
34        "public_overrides",
35    ],
36    target_compatible_with = incompatible_with_mcu(),
37    deps = [
38        "//pw_assert",
39        "//pw_chrono:system_clock",
40        "//pw_sync:binary_semaphore.facade",
41    ],
42)
43
44cc_library(
45    name = "counting_semaphore",
46    srcs = [
47        "counting_semaphore.cc",
48    ],
49    hdrs = [
50        "public/pw_sync_stl/counting_semaphore_inline.h",
51        "public/pw_sync_stl/counting_semaphore_native.h",
52        "public_overrides/pw_sync_backend/counting_semaphore_inline.h",
53        "public_overrides/pw_sync_backend/counting_semaphore_native.h",
54    ],
55    includes = [
56        "public",
57        "public_overrides",
58    ],
59    target_compatible_with = incompatible_with_mcu(),
60    deps = [
61        "//pw_assert",
62        "//pw_chrono:system_clock",
63        "//pw_sync:counting_semaphore.facade",
64    ],
65)
66
67cc_library(
68    name = "mutex",
69    srcs = ["mutex.cc"],
70    hdrs = [
71        "public/pw_sync_stl/mutex_inline.h",
72        "public/pw_sync_stl/mutex_native.h",
73        "public_overrides/pw_sync_backend/mutex_inline.h",
74        "public_overrides/pw_sync_backend/mutex_native.h",
75    ],
76    includes = [
77        "public",
78        "public_overrides",
79    ],
80    target_compatible_with = incompatible_with_mcu(),
81    deps = [
82        "//pw_assert",
83        "//pw_sync:mutex.facade",
84    ],
85)
86
87cc_library(
88    name = "timed_mutex",
89    hdrs = [
90        "public/pw_sync_stl/timed_mutex_inline.h",
91        "public_overrides/pw_sync_backend/timed_mutex_inline.h",
92    ],
93    includes = [
94        "public",
95        "public_overrides",
96    ],
97    target_compatible_with = incompatible_with_mcu(),
98    deps = [
99        "//pw_chrono:system_clock",
100        "//pw_sync:timed_mutex.facade",
101    ],
102)
103
104cc_library(
105    name = "recursive_mutex",
106    hdrs = [
107        "public/pw_sync_stl/recursive_mutex_inline.h",
108        "public/pw_sync_stl/recursive_mutex_native.h",
109        "public_overrides/pw_sync_backend/recursive_mutex_inline.h",
110        "public_overrides/pw_sync_backend/recursive_mutex_native.h",
111    ],
112    includes = [
113        "public",
114        "public_overrides",
115    ],
116    target_compatible_with = incompatible_with_mcu(),
117    deps = [
118        "//pw_assert",
119        "//pw_sync:recursive_mutex.facade",
120    ],
121)
122
123cc_library(
124    name = "interrupt_spin_lock",
125    hdrs = [
126        "public/pw_sync_stl/interrupt_spin_lock_inline.h",
127        "public/pw_sync_stl/interrupt_spin_lock_native.h",
128        "public_overrides/pw_sync_backend/interrupt_spin_lock_inline.h",
129        "public_overrides/pw_sync_backend/interrupt_spin_lock_native.h",
130    ],
131    includes = [
132        "public",
133        "public_overrides",
134    ],
135    target_compatible_with = incompatible_with_mcu(),
136    deps = [
137        "//pw_sync:interrupt_spin_lock.facade",
138        "//pw_sync:yield_core",
139    ],
140)
141
142cc_library(
143    name = "condition_variable",
144    hdrs = [
145        "public/pw_sync_stl/condition_variable_inline.h",
146        "public/pw_sync_stl/condition_variable_native.h",
147        "public_overrides/pw_sync_backend/condition_variable_inline.h",
148        "public_overrides/pw_sync_backend/condition_variable_native.h",
149    ],
150    includes = [
151        "public",
152        "public_overrides",
153    ],
154    target_compatible_with = incompatible_with_mcu(),
155    deps = [
156        "//pw_sync:condition_variable_facade",
157    ],
158)
159
160# TODO: b/228998350 - Figure out how to conditionally enable this test like GN
161# pw_cc_test(
162#     name = "condition_variable_test",
163#     deps = [
164#         "//pw_sync:condition_variable_test",
165#         "//pw_thread_stl:non_portable_test_thread_options",
166#     ]
167# )
168