1# Copyright 2021 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/error.gni") 18import("$dir_pw_build/target_types.gni") 19import("$dir_pw_chrono/backend.gni") 20import("$dir_pw_docgen/docs.gni") 21import("$dir_pw_unit_test/test.gni") 22 23config("public_include_path") { 24 include_dirs = [ "public" ] 25 visibility = [ ":*" ] 26} 27 28config("backend_config") { 29 include_dirs = [ "public_overrides" ] 30 visibility = [ ":*" ] 31} 32 33pw_build_assert("check_system_clock_backend") { 34 condition = 35 pw_chrono_SYSTEM_CLOCK_BACKEND == "" || 36 pw_chrono_SYSTEM_CLOCK_BACKEND == "$dir_pw_chrono_embos:system_clock" 37 message = "The embOS pw_sync backends only work with the " + 38 "embOS pw::chrono::SystemClock backend." 39 visibility = [ ":*" ] 40} 41 42# This target provides the backend for pw::sync::BinarySemaphore. 43pw_source_set("binary_semaphore") { 44 public_configs = [ 45 ":public_include_path", 46 ":backend_config", 47 ] 48 public = [ 49 "public/pw_sync_embos/binary_semaphore_inline.h", 50 "public/pw_sync_embos/binary_semaphore_native.h", 51 "public_overrides/pw_sync_backend/binary_semaphore_inline.h", 52 "public_overrides/pw_sync_backend/binary_semaphore_native.h", 53 ] 54 public_deps = [ 55 "$dir_pw_assert", 56 "$dir_pw_chrono:system_clock", 57 "$dir_pw_chrono_embos:system_clock", 58 "$dir_pw_interrupt:context", 59 "$dir_pw_third_party/embos", 60 ] 61 sources = [ "binary_semaphore.cc" ] 62 deps = [ 63 ":check_system_clock_backend", 64 "$dir_pw_sync:binary_semaphore.facade", 65 ] 66} 67 68# This target provides the backend for pw::sync::CountingSemaphore. 69pw_source_set("counting_semaphore") { 70 public_configs = [ 71 ":public_include_path", 72 ":backend_config", 73 ] 74 public = [ 75 "public/pw_sync_embos/counting_semaphore_inline.h", 76 "public/pw_sync_embos/counting_semaphore_native.h", 77 "public_overrides/pw_sync_backend/counting_semaphore_inline.h", 78 "public_overrides/pw_sync_backend/counting_semaphore_native.h", 79 ] 80 public_deps = [ 81 "$dir_pw_assert", 82 "$dir_pw_chrono:system_clock", 83 "$dir_pw_chrono_embos:system_clock", 84 "$dir_pw_interrupt:context", 85 "$dir_pw_third_party/embos", 86 ] 87 sources = [ "counting_semaphore.cc" ] 88 deps = [ 89 ":check_system_clock_backend", 90 "$dir_pw_sync:counting_semaphore.facade", 91 ] 92} 93 94# This target provides the backend for pw::sync::Mutex. 95pw_source_set("mutex") { 96 public_configs = [ 97 ":public_include_path", 98 ":backend_config", 99 ] 100 public = [ 101 "public/pw_sync_embos/mutex_inline.h", 102 "public/pw_sync_embos/mutex_native.h", 103 "public_overrides/pw_sync_backend/mutex_inline.h", 104 "public_overrides/pw_sync_backend/mutex_native.h", 105 ] 106 public_deps = [ 107 "$dir_pw_assert", 108 "$dir_pw_interrupt:context", 109 "$dir_pw_sync:mutex.facade", 110 "$dir_pw_third_party/embos", 111 ] 112} 113 114# This target provides the backend for pw::sync::TimedMutex. 115pw_source_set("timed_mutex") { 116 public_configs = [ 117 ":public_include_path", 118 ":backend_config", 119 ] 120 public = [ 121 "public/pw_sync_embos/timed_mutex_inline.h", 122 "public_overrides/pw_sync_backend/timed_mutex_inline.h", 123 ] 124 public_deps = [ 125 "$dir_pw_chrono:system_clock", 126 "$dir_pw_sync:timed_mutex.facade", 127 ] 128 sources = [ "timed_mutex.cc" ] 129 deps = [ 130 ":check_system_clock_backend", 131 "$dir_pw_assert", 132 "$dir_pw_chrono_embos:system_clock", 133 "$dir_pw_interrupt:context", 134 "$dir_pw_third_party/embos", 135 ] 136} 137 138# This target provides the backend for pw::sync::InterruptSpinLock. 139pw_source_set("interrupt_spin_lock") { 140 public_configs = [ 141 ":public_include_path", 142 ":backend_config", 143 ] 144 public = [ 145 "public/pw_sync_embos/interrupt_spin_lock_inline.h", 146 "public/pw_sync_embos/interrupt_spin_lock_native.h", 147 "public_overrides/pw_sync_backend/interrupt_spin_lock_inline.h", 148 "public_overrides/pw_sync_backend/interrupt_spin_lock_native.h", 149 ] 150 public_deps = [ "$dir_pw_third_party/embos" ] 151 sources = [ "interrupt_spin_lock.cc" ] 152 deps = [ 153 "$dir_pw_assert", 154 "$dir_pw_sync:interrupt_spin_lock.facade", 155 "$dir_pw_third_party/embos", 156 ] 157} 158 159pw_doc_group("docs") { 160 sources = [ "docs.rst" ] 161} 162 163pw_test_group("tests") { 164} 165