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