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)
19
20package(default_visibility = ["//visibility:public"])
21
22licenses(["notice"])  # Apache License 2.0
23
24pw_cc_library(
25    name = "binary_semaphore_headers",
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    deps = [
37        "//pw_chrono:system_clock",
38    ],
39)
40
41pw_cc_library(
42    name = "binary_semaphore",
43    srcs = [
44        "binary_semaphore.cc",
45    ],
46    deps = [
47        ":binary_semaphore_headers",
48        "//pw_chrono:system_clock",
49        "//pw_sync:binary_semaphore_facade",
50    ],
51)
52
53pw_cc_library(
54    name = "counting_semaphore_headers",
55    hdrs = [
56        "public/pw_sync_stl/counting_semaphore_inline.h",
57        "public/pw_sync_stl/counting_semaphore_native.h",
58        "public_overrides/pw_sync_backend/counting_semaphore_inline.h",
59        "public_overrides/pw_sync_backend/counting_semaphore_native.h",
60    ],
61    includes = [
62        "public",
63        "public_overrides",
64    ],
65    deps = [
66        "//pw_chrono:system_clock",
67    ],
68)
69
70pw_cc_library(
71    name = "counting_semaphore",
72    srcs = [
73        "counting_semaphore.cc",
74    ],
75    deps = [
76        ":counting_semaphore_headers",
77        "//pw_chrono:system_clock",
78        "//pw_sync:counting_semaphore_facade",
79    ],
80)
81
82pw_cc_library(
83    name = "mutex_headers",
84    hdrs = [
85        "public/pw_sync_stl/mutex_inline.h",
86        "public/pw_sync_stl/mutex_native.h",
87        "public_overrides/pw_sync_backend/mutex_inline.h",
88        "public_overrides/pw_sync_backend/mutex_native.h",
89    ],
90    includes = [
91        "public",
92        "public_overrides",
93    ],
94    deps = [
95        "//pw_sync:mutex_facade",
96    ],
97)
98
99pw_cc_library(
100    name = "mutex",
101    deps = [
102        ":mutex_headers",
103        "//pw_sync:mutex_facade",
104    ],
105)
106
107pw_cc_library(
108    name = "timed_mutex_headers",
109    hdrs = [
110        "public/pw_sync_stl/timed_mutex_inline.h",
111        "public_overrides/pw_sync_backend/timed_mutex_inline.h",
112    ],
113    includes = [
114        "public",
115        "public_overrides",
116    ],
117    deps = [
118        "//pw_chrono:system_clock",
119        "//pw_sync:timed_mutex_facade",
120    ],
121)
122
123pw_cc_library(
124    name = "timed_mutex",
125    deps = [
126        ":timed_mutex_headers",
127        "//pw_sync:timed_mutex_facade",
128    ],
129)
130
131pw_cc_library(
132    name = "interrupt_spin_lock_headers",
133    hdrs = [
134        "public/pw_sync_stl/interrupt_spin_lock_inline.h",
135        "public/pw_sync_stl/interrupt_spin_lock_native.h",
136        "public_overrides/pw_sync_backend/interrupt_spin_lock_inline.h",
137        "public_overrides/pw_sync_backend/interrupt_spin_lock_native.h",
138    ],
139    includes = [
140        "public",
141        "public_overrides",
142    ],
143)
144
145pw_cc_library(
146    name = "interrupt_spin_lock",
147    deps = [
148        ":interrupt_spin_lock_headers",
149        "//pw_sync:interrupt_spin_lock_facade",
150        "//pw_sync:yield_core",
151    ],
152)
153