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