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:selects.bzl", 17 "TARGET_COMPATIBLE_WITH_HOST_SELECT", 18) 19 20package(default_visibility = ["//visibility:public"]) 21 22licenses(["notice"]) 23 24cc_library( 25 name = "binary_semaphore", 26 srcs = [ 27 "binary_semaphore.cc", 28 ], 29 hdrs = [ 30 "public/pw_sync_stl/binary_semaphore_inline.h", 31 "public/pw_sync_stl/binary_semaphore_native.h", 32 "public_overrides/pw_sync_backend/binary_semaphore_inline.h", 33 "public_overrides/pw_sync_backend/binary_semaphore_native.h", 34 ], 35 includes = [ 36 "public", 37 "public_overrides", 38 ], 39 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), 40 deps = [ 41 "//pw_assert", 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 includes = [ 59 "public", 60 "public_overrides", 61 ], 62 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), 63 deps = [ 64 "//pw_assert", 65 "//pw_chrono:system_clock", 66 "//pw_sync:counting_semaphore_facade", 67 ], 68) 69 70cc_library( 71 name = "mutex", 72 srcs = ["mutex.cc"], 73 hdrs = [ 74 "public/pw_sync_stl/mutex_inline.h", 75 "public/pw_sync_stl/mutex_native.h", 76 "public_overrides/pw_sync_backend/mutex_inline.h", 77 "public_overrides/pw_sync_backend/mutex_native.h", 78 ], 79 includes = [ 80 "public", 81 "public_overrides", 82 ], 83 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), 84 deps = [ 85 "//pw_assert", 86 "//pw_sync:mutex_facade", 87 ], 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 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), 101 deps = [ 102 "//pw_chrono:system_clock", 103 "//pw_sync:timed_mutex_facade", 104 ], 105) 106 107cc_library( 108 name = "recursive_mutex", 109 hdrs = [ 110 "public/pw_sync_stl/recursive_mutex_inline.h", 111 "public/pw_sync_stl/recursive_mutex_native.h", 112 "public_overrides/pw_sync_backend/recursive_mutex_inline.h", 113 "public_overrides/pw_sync_backend/recursive_mutex_native.h", 114 ], 115 includes = [ 116 "public", 117 "public_overrides", 118 ], 119 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), 120 deps = [ 121 "//pw_assert", 122 "//pw_sync:recursive_mutex_facade", 123 ], 124) 125 126cc_library( 127 name = "interrupt_spin_lock", 128 hdrs = [ 129 "public/pw_sync_stl/interrupt_spin_lock_inline.h", 130 "public/pw_sync_stl/interrupt_spin_lock_native.h", 131 "public_overrides/pw_sync_backend/interrupt_spin_lock_inline.h", 132 "public_overrides/pw_sync_backend/interrupt_spin_lock_native.h", 133 ], 134 includes = [ 135 "public", 136 "public_overrides", 137 ], 138 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), 139 deps = [ 140 "//pw_sync:interrupt_spin_lock_facade", 141 "//pw_sync:yield_core", 142 ], 143) 144 145cc_library( 146 name = "condition_variable", 147 hdrs = [ 148 "public/pw_sync_stl/condition_variable_inline.h", 149 "public/pw_sync_stl/condition_variable_native.h", 150 "public_overrides/pw_sync_backend/condition_variable_inline.h", 151 "public_overrides/pw_sync_backend/condition_variable_native.h", 152 ], 153 includes = [ 154 "public", 155 "public_overrides", 156 ], 157 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), 158 deps = [ 159 "//pw_sync:condition_variable_facade", 160 ], 161) 162 163# TODO: b/228998350 - Figure out how to conditionally enable this test like GN 164# pw_cc_test( 165# name = "condition_variable_test", 166# deps = [ 167# "//pw_sync:condition_variable_test", 168# "//pw_thread_stl:non_portable_test_thread_options", 169# ] 170# ) 171