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 15import("//build_overrides/pigweed.gni") 16 17import("$dir_pw_build/facade.gni") 18import("$dir_pw_build/target_types.gni") 19import("$dir_pw_docgen/docs.gni") 20import("$dir_pw_unit_test/test.gni") 21import("backend.gni") 22 23config("public_include_path") { 24 include_dirs = [ "public" ] 25 visibility = [ ":*" ] 26} 27 28pw_facade("binary_semaphore") { 29 backend = pw_sync_BINARY_SEMAPHORE_BACKEND 30 public_configs = [ ":public_include_path" ] 31 public = [ "public/pw_sync/binary_semaphore.h" ] 32 public_deps = [ 33 "$dir_pw_chrono:system_clock", 34 "$dir_pw_preprocessor", 35 ] 36 sources = [ "binary_semaphore.cc" ] 37} 38 39pw_facade("counting_semaphore") { 40 backend = pw_sync_COUNTING_SEMAPHORE_BACKEND 41 public_configs = [ ":public_include_path" ] 42 public = [ "public/pw_sync/counting_semaphore.h" ] 43 public_deps = [ 44 "$dir_pw_chrono:system_clock", 45 "$dir_pw_preprocessor", 46 ] 47 sources = [ "counting_semaphore.cc" ] 48} 49 50pw_source_set("lock_annotations") { 51 public_configs = [ ":public_include_path" ] 52 public = [ "public/pw_sync/lock_annotations.h" ] 53 public_deps = [ "$dir_pw_preprocessor" ] 54} 55 56pw_facade("mutex") { 57 backend = pw_sync_MUTEX_BACKEND 58 public_configs = [ ":public_include_path" ] 59 public = [ "public/pw_sync/mutex.h" ] 60 public_deps = [ 61 ":lock_annotations", 62 "$dir_pw_preprocessor", 63 ] 64 sources = [ "mutex.cc" ] 65} 66 67pw_facade("timed_mutex") { 68 backend = pw_sync_TIMED_MUTEX_BACKEND 69 public_configs = [ ":public_include_path" ] 70 public = [ "public/pw_sync/timed_mutex.h" ] 71 public_deps = [ 72 ":mutex", 73 "$dir_pw_chrono:system_clock", 74 "$dir_pw_preprocessor", 75 ] 76 sources = [ "timed_mutex.cc" ] 77} 78 79pw_facade("interrupt_spin_lock") { 80 backend = pw_sync_INTERRUPT_SPIN_LOCK_BACKEND 81 public_configs = [ ":public_include_path" ] 82 public = [ "public/pw_sync/interrupt_spin_lock.h" ] 83 public_deps = [ 84 ":lock_annotations", 85 "$dir_pw_preprocessor", 86 ] 87 sources = [ "interrupt_spin_lock.cc" ] 88} 89 90pw_source_set("yield_core") { 91 public = [ "public/pw_sync/yield_core.h" ] 92 public_configs = [ ":public_include_path" ] 93} 94 95pw_test_group("tests") { 96 tests = [ 97 ":binary_semaphore_facade_test", 98 ":counting_semaphore_facade_test", 99 ":mutex_facade_test", 100 ":timed_mutex_facade_test", 101 ":interrupt_spin_lock_facade_test", 102 ] 103} 104 105pw_test("binary_semaphore_facade_test") { 106 enable_if = pw_sync_BINARY_SEMAPHORE_BACKEND != "" 107 sources = [ 108 "binary_semaphore_facade_test.cc", 109 "binary_semaphore_facade_test_c.c", 110 ] 111 deps = [ 112 ":binary_semaphore", 113 "$dir_pw_preprocessor", 114 pw_sync_BINARY_SEMAPHORE_BACKEND, 115 ] 116} 117 118pw_test("counting_semaphore_facade_test") { 119 enable_if = pw_sync_COUNTING_SEMAPHORE_BACKEND != "" 120 sources = [ 121 "counting_semaphore_facade_test.cc", 122 "counting_semaphore_facade_test_c.c", 123 ] 124 deps = [ 125 ":counting_semaphore", 126 "$dir_pw_preprocessor", 127 pw_sync_COUNTING_SEMAPHORE_BACKEND, 128 ] 129} 130 131pw_test("mutex_facade_test") { 132 enable_if = pw_sync_MUTEX_BACKEND != "" 133 sources = [ 134 "mutex_facade_test.cc", 135 "mutex_facade_test_c.c", 136 ] 137 deps = [ 138 ":mutex", 139 "$dir_pw_preprocessor", 140 pw_sync_MUTEX_BACKEND, 141 ] 142} 143 144pw_test("timed_mutex_facade_test") { 145 enable_if = pw_sync_TIMED_MUTEX_BACKEND != "" 146 sources = [ 147 "timed_mutex_facade_test.cc", 148 "timed_mutex_facade_test_c.c", 149 ] 150 deps = [ 151 ":timed_mutex", 152 "$dir_pw_preprocessor", 153 pw_sync_TIMED_MUTEX_BACKEND, 154 ] 155} 156 157pw_test("interrupt_spin_lock_facade_test") { 158 enable_if = pw_sync_INTERRUPT_SPIN_LOCK_BACKEND != "" 159 sources = [ 160 "interrupt_spin_lock_facade_test.cc", 161 "interrupt_spin_lock_facade_test_c.c", 162 ] 163 deps = [ 164 ":interrupt_spin_lock", 165 "$dir_pw_preprocessor", 166 pw_sync_INTERRUPT_SPIN_LOCK_BACKEND, 167 ] 168} 169 170pw_doc_group("docs") { 171 sources = [ "docs.rst" ] 172} 173