1 # Copyright 2020 The Pigweed Authors
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
7 # https://www.apache.org/licenses/LICENSE-2.0
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
15 import("//build_overrides/pigweed.gni")
17 import("$dir_pw_build/target_types.gni")
18 import("$dir_pw_chrono/backend.gni")
19 import("$dir_pw_docgen/docs.gni")
20 import("$dir_pw_sync/backend.gni")
22 config("public_include_path") {
23 include_dirs = [ "public" ]
27 config("backend_config") {
28 include_dirs = [ "public_overrides" ]
32 if (pw_chrono_SYSTEM_CLOCK_BACKEND != "") {
33 # This target provides the backend for pw::sync::BinarySemaphore.
34 pw_source_set("binary_semaphore") {
36 ":public_include_path",
40 "public/pw_sync_threadx/binary_semaphore_inline.h",
41 "public/pw_sync_threadx/binary_semaphore_native.h",
42 "public_overrides/pw_sync_backend/binary_semaphore_inline.h",
43 "public_overrides/pw_sync_backend/binary_semaphore_native.h",
47 "$dir_pw_chrono:system_clock",
48 "$dir_pw_interrupt:context",
49 "$dir_pw_third_party/threadx",
51 sources = [ "binary_semaphore.cc" ]
53 "$dir_pw_sync:binary_semaphore.facade",
54 pw_chrono_SYSTEM_CLOCK_BACKEND,
57 pw_sync_OVERRIDE_SYSTEM_CLOCK_BACKEND_CHECK ||
58 pw_chrono_SYSTEM_CLOCK_BACKEND ==
59 "$dir_pw_chrono_threadx:system_clock",
60 "The ThreadX pw::sync::BinarySemaphore backend only works with the " +
61 "ThreadX pw::chrono::SystemClock backend.")
64 # This target provides the backend for pw::sync::CountingSemaphore.
65 pw_source_set("counting_semaphore") {
67 ":public_include_path",
71 "public/pw_sync_threadx/counting_semaphore_inline.h",
72 "public/pw_sync_threadx/counting_semaphore_native.h",
73 "public_overrides/pw_sync_backend/counting_semaphore_inline.h",
74 "public_overrides/pw_sync_backend/counting_semaphore_native.h",
78 "$dir_pw_chrono:system_clock",
79 "$dir_pw_interrupt:context",
80 "$dir_pw_third_party/threadx",
82 sources = [ "counting_semaphore.cc" ]
84 "$dir_pw_sync:counting_semaphore.facade",
85 pw_chrono_SYSTEM_CLOCK_BACKEND,
87 assert(pw_sync_OVERRIDE_SYSTEM_CLOCK_BACKEND_CHECK ||
88 pw_chrono_SYSTEM_CLOCK_BACKEND ==
89 "$dir_pw_chrono_threadx:system_clock",
90 "The ThreadX pw::sync::CountingSemaphore backend only works with " +
91 "the ThreadX pw::chrono::SystemClock backend.")
94 # This target provides the backend for pw::sync::Mutex.
95 pw_source_set("mutex") {
97 ":public_include_path",
101 "public/pw_sync_threadx/mutex_inline.h",
102 "public/pw_sync_threadx/mutex_native.h",
103 "public_overrides/pw_sync_backend/mutex_inline.h",
104 "public_overrides/pw_sync_backend/mutex_native.h",
108 "$dir_pw_chrono:system_clock",
109 "$dir_pw_interrupt:context",
110 "$dir_pw_third_party/threadx",
112 sources = [ "mutex.cc" ]
114 "$dir_pw_sync:mutex.facade",
115 pw_chrono_SYSTEM_CLOCK_BACKEND,
117 assert(pw_sync_OVERRIDE_SYSTEM_CLOCK_BACKEND_CHECK ||
118 pw_chrono_SYSTEM_CLOCK_BACKEND ==
119 "$dir_pw_chrono_threadx:system_clock",
120 "The ThreadX pw::sync::Mutex backend only works with the ThreadX " +
121 "pw::chrono::SystemClock backend.")
125 # This target provides the backend for pw::sync::SpinLock, note that this
126 # implementation does NOT support ThreadX w/ SMP.
127 pw_source_set("spin_lock") {
129 ":public_include_path",
133 "public/pw_sync_threadx/spin_lock_inline.h",
134 "public/pw_sync_threadx/spin_lock_native.h",
135 "public_overrides/pw_sync_backend/spin_lock_inline.h",
136 "public_overrides/pw_sync_backend/spin_lock_native.h",
138 public_deps = [ "$dir_pw_third_party/threadx" ]
139 sources = [ "spin_lock.cc" ]
142 "$dir_pw_sync:spin_lock.facade",
146 pw_doc_group("docs") {
147 sources = [ "docs.rst" ]