• 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(
16    "//pw_build:pigweed.bzl",
17    "pw_cc_library",
18)
19load(
20    "//pw_build:selects.bzl",
21    "TARGET_COMPATIBLE_WITH_HOST_SELECT",
22)
23
24package(default_visibility = ["//visibility:public"])
25
26licenses(["notice"])
27
28pw_cc_library(
29    name = "binary_semaphore_headers",
30    hdrs = [
31        "public/pw_sync_stl/binary_semaphore_inline.h",
32        "public/pw_sync_stl/binary_semaphore_native.h",
33        "public_overrides/pw_sync_backend/binary_semaphore_inline.h",
34        "public_overrides/pw_sync_backend/binary_semaphore_native.h",
35    ],
36    includes = [
37        "public",
38        "public_overrides",
39    ],
40    target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
41    deps = [
42        "//pw_chrono:system_clock",
43    ],
44)
45
46pw_cc_library(
47    name = "binary_semaphore",
48    srcs = [
49        "binary_semaphore.cc",
50    ],
51    target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
52    deps = [
53        ":binary_semaphore_headers",
54        "//pw_assert",
55        "//pw_chrono:system_clock",
56        "//pw_sync:binary_semaphore_facade",
57    ],
58)
59
60pw_cc_library(
61    name = "counting_semaphore_headers",
62    hdrs = [
63        "public/pw_sync_stl/counting_semaphore_inline.h",
64        "public/pw_sync_stl/counting_semaphore_native.h",
65        "public_overrides/pw_sync_backend/counting_semaphore_inline.h",
66        "public_overrides/pw_sync_backend/counting_semaphore_native.h",
67    ],
68    includes = [
69        "public",
70        "public_overrides",
71    ],
72    target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
73    deps = [
74        "//pw_chrono:system_clock",
75    ],
76)
77
78pw_cc_library(
79    name = "counting_semaphore",
80    srcs = [
81        "counting_semaphore.cc",
82    ],
83    target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
84    deps = [
85        ":counting_semaphore_headers",
86        "//pw_assert",
87        "//pw_chrono:system_clock",
88        "//pw_sync:counting_semaphore_facade",
89    ],
90)
91
92pw_cc_library(
93    name = "mutex_headers",
94    hdrs = [
95        "public/pw_sync_stl/mutex_inline.h",
96        "public/pw_sync_stl/mutex_native.h",
97        "public_overrides/pw_sync_backend/mutex_inline.h",
98        "public_overrides/pw_sync_backend/mutex_native.h",
99    ],
100    includes = [
101        "public",
102        "public_overrides",
103    ],
104    target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
105    deps = ["//pw_sync:mutex_facade"],
106)
107
108pw_cc_library(
109    name = "mutex",
110    srcs = ["mutex.cc"],
111    target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
112    deps = [
113        ":mutex_headers",
114        "//pw_assert",
115        "//pw_sync:mutex_facade",
116    ],
117)
118
119pw_cc_library(
120    name = "timed_mutex_headers",
121    hdrs = [
122        "public/pw_sync_stl/timed_mutex_inline.h",
123        "public_overrides/pw_sync_backend/timed_mutex_inline.h",
124    ],
125    includes = [
126        "public",
127        "public_overrides",
128    ],
129    target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
130    deps = [
131        "//pw_chrono:system_clock",
132    ],
133)
134
135pw_cc_library(
136    name = "timed_mutex",
137    target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
138    deps = [
139        ":timed_mutex_headers",
140        "//pw_sync:timed_mutex_facade",
141    ],
142)
143
144pw_cc_library(
145    name = "recursive_mutex_headers",
146    hdrs = [
147        "public/pw_sync_stl/recursive_mutex_inline.h",
148        "public/pw_sync_stl/recursive_mutex_native.h",
149        "public_overrides/pw_sync_backend/recursive_mutex_inline.h",
150        "public_overrides/pw_sync_backend/recursive_mutex_native.h",
151    ],
152    includes = [
153        "public",
154        "public_overrides",
155    ],
156    target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
157    deps = ["//pw_assert"],
158)
159
160pw_cc_library(
161    name = "recursive_mutex",
162    target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
163    deps = [
164        ":recursive_mutex_headers",
165        "//pw_sync:recursive_mutex_facade",
166    ],
167)
168
169pw_cc_library(
170    name = "interrupt_spin_lock_headers",
171    hdrs = [
172        "public/pw_sync_stl/interrupt_spin_lock_inline.h",
173        "public/pw_sync_stl/interrupt_spin_lock_native.h",
174        "public_overrides/pw_sync_backend/interrupt_spin_lock_inline.h",
175        "public_overrides/pw_sync_backend/interrupt_spin_lock_native.h",
176    ],
177    includes = [
178        "public",
179        "public_overrides",
180    ],
181    target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
182    deps = [
183        "//pw_sync:yield_core",
184    ],
185)
186
187pw_cc_library(
188    name = "interrupt_spin_lock",
189    target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
190    deps = [
191        ":interrupt_spin_lock_headers",
192        "//pw_sync:interrupt_spin_lock_facade",
193        "//pw_sync:yield_core",
194    ],
195)
196
197pw_cc_library(
198    name = "condition_variable_headers",
199    hdrs = [
200        "public/pw_sync_stl/condition_variable_inline.h",
201        "public/pw_sync_stl/condition_variable_native.h",
202        "public_overrides/pw_sync_backend/condition_variable_inline.h",
203        "public_overrides/pw_sync_backend/condition_variable_native.h",
204    ],
205    includes = [
206        "public",
207        "public_overrides",
208    ],
209    target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
210)
211
212pw_cc_library(
213    name = "condition_variable",
214    target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
215    deps = [
216        ":condition_variable_headers",
217        "//pw_sync:condition_variable_facade",
218    ],
219)
220
221# TODO(b/228998350): Figure out how to conditionally enable this test like GN
222# pw_cc_test(
223#     name = "condition_variable_test",
224#     deps = [
225#         "//pw_sync:condition_variable_test",
226#         "//pw_thread_stl:test_threads",
227#     ]
228# )
229