blob: 615c3db802ee37ad160a653392bb38bcfe4973ed [file] [log] [blame]
Ewout van Bekkum58901932020-11-09 12:46:52 -08001# 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/facade.gni")
18import("$dir_pw_build/target_types.gni")
19import("$dir_pw_docgen/docs.gni")
20import("$dir_pw_unit_test/test.gni")
Wyatt Heplerae93f422020-12-14 11:46:19 -080021import("backend.gni")
Ewout van Bekkum58901932020-11-09 12:46:52 -080022
23config("public_include_path") {
24 include_dirs = [ "public" ]
25 visibility = [ ":*" ]
26}
27
Ewout van Bekkum9618d8a2020-11-09 12:46:52 -080028pw_facade("binary_semaphore") {
29 backend = pw_sync_BINARY_SEMAPHORE_BACKEND
30 public_configs = [ ":public_include_path" ]
31 public = [ "public/pw_sync/binary_semaphore.h" ]
32 public_deps = [
33 "$dir_pw_chrono:system_clock",
34 "$dir_pw_preprocessor",
35 ]
36 sources = [ "binary_semaphore.cc" ]
37}
38
39pw_facade("counting_semaphore") {
40 backend = pw_sync_COUNTING_SEMAPHORE_BACKEND
41 public_configs = [ ":public_include_path" ]
42 public = [ "public/pw_sync/counting_semaphore.h" ]
43 public_deps = [
44 "$dir_pw_chrono:system_clock",
45 "$dir_pw_preprocessor",
46 ]
47 sources = [ "counting_semaphore.cc" ]
48}
49
50pw_facade("mutex") {
51 backend = pw_sync_MUTEX_BACKEND
52 public_configs = [ ":public_include_path" ]
53 public = [ "public/pw_sync/mutex.h" ]
54 public_deps = [
55 "$dir_pw_chrono:system_clock",
56 "$dir_pw_preprocessor",
57 ]
58 sources = [ "mutex.cc" ]
59}
60
Ewout van Bekkum58901932020-11-09 12:46:52 -080061pw_facade("spin_lock") {
62 backend = pw_sync_SPIN_LOCK_BACKEND
63 public_configs = [ ":public_include_path" ]
64 public = [ "public/pw_sync/spin_lock.h" ]
65 public_deps = [ "$dir_pw_preprocessor" ]
66 sources = [ "spin_lock.cc" ]
67}
68
Ewout van Bekkum58901932020-11-09 12:46:52 -080069pw_source_set("yield_core") {
70 public = [ "public/pw_sync/yield_core.h" ]
71 public_configs = [ ":public_include_path" ]
72}
73
Ewout van Bekkum9618d8a2020-11-09 12:46:52 -080074pw_test_group("tests") {
75 tests = [
76 ":binary_semaphore_facade_test",
77 ":counting_semaphore_facade_test",
78 ":mutex_facade_test",
79 ":spin_lock_facade_test",
80 ]
81}
82
83pw_test("binary_semaphore_facade_test") {
84 enable_if = pw_sync_BINARY_SEMAPHORE_BACKEND != ""
85 sources = [
86 "binary_semaphore_facade_test.cc",
87 "binary_semaphore_facade_test_c.c",
88 ]
89 deps = [
90 ":binary_semaphore",
91 "$dir_pw_preprocessor",
92 pw_sync_BINARY_SEMAPHORE_BACKEND,
93 ]
94}
95
96pw_test("counting_semaphore_facade_test") {
97 enable_if = pw_sync_COUNTING_SEMAPHORE_BACKEND != ""
98 sources = [
99 "counting_semaphore_facade_test.cc",
100 "counting_semaphore_facade_test_c.c",
101 ]
102 deps = [
103 ":counting_semaphore",
104 "$dir_pw_preprocessor",
105 pw_sync_COUNTING_SEMAPHORE_BACKEND,
106 ]
107}
108
109pw_test("mutex_facade_test") {
110 enable_if = pw_sync_MUTEX_BACKEND != ""
111 sources = [
112 "mutex_facade_test.cc",
113 "mutex_facade_test_c.c",
114 ]
115 deps = [
116 ":mutex",
117 "$dir_pw_preprocessor",
118 pw_sync_MUTEX_BACKEND,
119 ]
120}
121
Ewout van Bekkum58901932020-11-09 12:46:52 -0800122pw_test("spin_lock_facade_test") {
123 enable_if = pw_sync_SPIN_LOCK_BACKEND != ""
124 sources = [
125 "spin_lock_facade_test.cc",
126 "spin_lock_facade_test_c.c",
127 ]
128 deps = [
129 ":spin_lock",
130 "$dir_pw_preprocessor",
131 pw_sync_SPIN_LOCK_BACKEND,
132 ]
133}
134
135pw_doc_group("docs") {
136 sources = [ "docs.rst" ]
137}