xref: /aosp_15_r20/external/pigweed/pw_sync_freertos/CMakeLists.txt (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1# Copyright 2022 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
15include($ENV{PW_ROOT}/pw_build/pigweed.cmake)
16
17pw_add_module_config(pw_sync_freertos_CONFIG)
18
19pw_add_library(pw_sync_freertos.config INTERFACE
20  HEADERS
21    public/pw_sync_freertos/config.h
22  PUBLIC_INCLUDES
23    public
24  PUBLIC_DEPS
25    pw_third_party.freertos
26    ${pw_sync_freertos_CONFIG}
27)
28
29# TODO(ewout): Add system_clock backend compatibility check like in GN.
30
31# This target provides the backend for pw::sync::BinarySemaphore.
32pw_add_library(pw_sync_freertos.binary_semaphore STATIC
33  HEADERS
34    public/pw_sync_freertos/binary_semaphore_inline.h
35    public/pw_sync_freertos/binary_semaphore_native.h
36    public_overrides/pw_sync_backend/binary_semaphore_inline.h
37    public_overrides/pw_sync_backend/binary_semaphore_native.h
38  PUBLIC_INCLUDES
39    public
40    public_overrides
41  PUBLIC_DEPS
42    pw_assert
43    pw_chrono.system_clock
44    pw_chrono_freertos.system_clock
45    pw_interrupt.context
46    pw_sync.binary_semaphore.facade
47    pw_third_party.freertos
48  SOURCES
49    binary_semaphore.cc
50)
51
52# This target provides the backend for pw::sync::CountingSemaphore.
53pw_add_library(pw_sync_freertos.counting_semaphore STATIC
54  HEADERS
55    public/pw_sync_freertos/counting_semaphore_inline.h
56    public/pw_sync_freertos/counting_semaphore_native.h
57    public_overrides/pw_sync_backend/counting_semaphore_inline.h
58    public_overrides/pw_sync_backend/counting_semaphore_native.h
59  PUBLIC_INCLUDES
60    public
61    public_overrides
62  PUBLIC_DEPS
63    pw_assert
64    pw_chrono.system_clock
65    pw_chrono_freertos.system_clock
66    pw_interrupt.context
67    pw_sync.counting_semaphore.facade
68    pw_third_party.freertos
69  SOURCES
70    counting_semaphore.cc
71)
72
73# This target provides the backend for pw::sync::Mutex.
74pw_add_library(pw_sync_freertos.mutex INTERFACE
75  HEADERS
76    public/pw_sync_freertos/mutex_inline.h
77    public/pw_sync_freertos/mutex_native.h
78    public_overrides/pw_sync_backend/mutex_inline.h
79    public_overrides/pw_sync_backend/mutex_native.h
80  PUBLIC_INCLUDES
81    public
82    public_overrides
83  PUBLIC_DEPS
84    pw_assert
85    pw_interrupt.context
86    pw_sync.mutex.facade
87    pw_third_party.freertos
88)
89
90# This target provides the backend for pw::sync::TimedMutex.
91pw_add_library(pw_sync_freertos.timed_mutex STATIC
92  HEADERS
93    public/pw_sync_freertos/timed_mutex_inline.h
94    public_overrides/pw_sync_backend/timed_mutex_inline.h
95  PUBLIC_INCLUDES
96    public
97    public_overrides
98  PUBLIC_DEPS
99    pw_chrono.system_clock
100    pw_sync.timed_mutex.facade
101  SOURCES
102    timed_mutex.cc
103  PRIVATE_DEPS
104    pw_assert
105    pw_chrono_freertos.system_clock
106    pw_interrupt.context
107    pw_third_party.freertos
108)
109
110# This target provides the backend for pw::sync::ThreadNotification.
111pw_add_library(pw_sync_freertos.thread_notification STATIC
112  HEADERS
113    public/pw_sync_freertos/thread_notification_inline.h
114    public/pw_sync_freertos/thread_notification_native.h
115    public_overrides/thread_notification/pw_sync_backend/thread_notification_inline.h
116    public_overrides/thread_notification/pw_sync_backend/thread_notification_native.h
117  PUBLIC_INCLUDES
118    public
119    public_overrides/thread_notification
120  PUBLIC_DEPS
121    pw_assert
122    pw_interrupt.context
123    pw_polyfill
124    pw_sync.interrupt_spin_lock
125    pw_sync.lock_annotations
126    pw_sync.thread_notification.facade
127    pw_third_party.freertos
128  SOURCES
129    thread_notification.cc
130  PRIVATE_DEPS
131    pw_sync_freertos.config
132)
133
134# This target provides the backend for pw::sync::TimedThreadNotification.
135pw_add_library(pw_sync_freertos.timed_thread_notification STATIC
136  HEADERS
137    public/pw_sync_freertos/timed_thread_notification_inline.h
138    public_overrides/timed_thread_notification/pw_sync_backend/timed_thread_notification_inline.h
139  PUBLIC_INCLUDES
140    public
141    public_overrides/timed_thread_notification
142  PUBLIC_DEPS
143    pw_chrono.system_clock
144    pw_sync.interrupt_spin_lock
145    pw_sync.timed_thread_notification.facade
146  SOURCES
147    timed_thread_notification.cc
148  PRIVATE_DEPS
149    pw_sync_freertos.config
150    pw_assert
151    pw_chrono_freertos.system_clock
152    pw_interrupt.context
153    pw_third_party.freertos
154)
155
156# This target provides the backend for pw::sync::InterruptSpinLock.
157pw_add_library(pw_sync_freertos.interrupt_spin_lock STATIC
158  HEADERS
159    public/pw_sync_freertos/interrupt_spin_lock_inline.h
160    public/pw_sync_freertos/interrupt_spin_lock_native.h
161    public_overrides/pw_sync_backend/interrupt_spin_lock_inline.h
162    public_overrides/pw_sync_backend/interrupt_spin_lock_native.h
163  PUBLIC_INCLUDES
164    public
165    public_overrides
166  PUBLIC_DEPS
167    pw_sync.interrupt_spin_lock.facade
168    pw_third_party.freertos
169  SOURCES
170    interrupt_spin_lock.cc
171  PRIVATE_DEPS
172    pw_assert
173    pw_interrupt.context
174)
175