aboutsummaryrefslogtreecommitdiff
path: root/pw_sync/BUILD.gn
blob: 673f80b12aa0af5cfaa93a9c753d9e39caf4a1c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# Copyright 2020 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

import("//build_overrides/pigweed.gni")

import("$dir_pw_build/facade.gni")
import("$dir_pw_build/target_types.gni")
import("$dir_pw_docgen/docs.gni")
import("$dir_pw_unit_test/test.gni")
import("backend.gni")

config("public_include_path") {
  include_dirs = [ "public" ]
  visibility = [ ":*" ]
}

pw_facade("binary_semaphore") {
  backend = pw_sync_BINARY_SEMAPHORE_BACKEND
  public_configs = [ ":public_include_path" ]
  public = [ "public/pw_sync/binary_semaphore.h" ]
  public_deps = [
    "$dir_pw_chrono:system_clock",
    "$dir_pw_preprocessor",
  ]
  sources = [ "binary_semaphore.cc" ]
}

pw_facade("counting_semaphore") {
  backend = pw_sync_COUNTING_SEMAPHORE_BACKEND
  public_configs = [ ":public_include_path" ]
  public = [ "public/pw_sync/counting_semaphore.h" ]
  public_deps = [
    "$dir_pw_chrono:system_clock",
    "$dir_pw_preprocessor",
  ]
  sources = [ "counting_semaphore.cc" ]
}

pw_facade("mutex") {
  backend = pw_sync_MUTEX_BACKEND
  public_configs = [ ":public_include_path" ]
  public = [ "public/pw_sync/mutex.h" ]
  public_deps = [ "$dir_pw_preprocessor" ]
  sources = [ "mutex.cc" ]
}

pw_facade("timed_mutex") {
  backend = pw_sync_TIMED_MUTEX_BACKEND
  public_configs = [ ":public_include_path" ]
  public = [ "public/pw_sync/timed_mutex.h" ]
  public_deps = [
    ":mutex",
    "$dir_pw_chrono:system_clock",
    "$dir_pw_preprocessor",
  ]
  sources = [ "timed_mutex.cc" ]
}

pw_facade("interrupt_spin_lock") {
  backend = pw_sync_INTERRUPT_SPIN_LOCK_BACKEND
  public_configs = [ ":public_include_path" ]
  public = [ "public/pw_sync/interrupt_spin_lock.h" ]
  public_deps = [ "$dir_pw_preprocessor" ]
  sources = [ "interrupt_spin_lock.cc" ]
}

pw_source_set("yield_core") {
  public = [ "public/pw_sync/yield_core.h" ]
  public_configs = [ ":public_include_path" ]
}

pw_test_group("tests") {
  tests = [
    ":binary_semaphore_facade_test",
    ":counting_semaphore_facade_test",
    ":mutex_facade_test",
    ":timed_mutex_facade_test",
    ":interrupt_spin_lock_facade_test",
  ]
}

pw_test("binary_semaphore_facade_test") {
  enable_if = pw_sync_BINARY_SEMAPHORE_BACKEND != ""
  sources = [
    "binary_semaphore_facade_test.cc",
    "binary_semaphore_facade_test_c.c",
  ]
  deps = [
    ":binary_semaphore",
    "$dir_pw_preprocessor",
    pw_sync_BINARY_SEMAPHORE_BACKEND,
  ]
}

pw_test("counting_semaphore_facade_test") {
  enable_if = pw_sync_COUNTING_SEMAPHORE_BACKEND != ""
  sources = [
    "counting_semaphore_facade_test.cc",
    "counting_semaphore_facade_test_c.c",
  ]
  deps = [
    ":counting_semaphore",
    "$dir_pw_preprocessor",
    pw_sync_COUNTING_SEMAPHORE_BACKEND,
  ]
}

pw_test("mutex_facade_test") {
  enable_if = pw_sync_MUTEX_BACKEND != ""
  sources = [
    "mutex_facade_test.cc",
    "mutex_facade_test_c.c",
  ]
  deps = [
    ":mutex",
    "$dir_pw_preprocessor",
    pw_sync_MUTEX_BACKEND,
  ]
}

pw_test("timed_mutex_facade_test") {
  enable_if = pw_sync_TIMED_MUTEX_BACKEND != ""
  sources = [
    "timed_mutex_facade_test.cc",
    "timed_mutex_facade_test_c.c",
  ]
  deps = [
    ":timed_mutex",
    "$dir_pw_preprocessor",
    pw_sync_TIMED_MUTEX_BACKEND,
  ]
}

pw_test("interrupt_spin_lock_facade_test") {
  enable_if = pw_sync_INTERRUPT_SPIN_LOCK_BACKEND != ""
  sources = [
    "interrupt_spin_lock_facade_test.cc",
    "interrupt_spin_lock_facade_test_c.c",
  ]
  deps = [
    ":interrupt_spin_lock",
    "$dir_pw_preprocessor",
    pw_sync_INTERRUPT_SPIN_LOCK_BACKEND,
  ]
}

pw_doc_group("docs") {
  sources = [ "docs.rst" ]
}