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