• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2024 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")
16import("$dir_pw_build/target_types.gni")
17import("$dir_pw_docgen/docs.gni")
18import("$dir_pw_unit_test/test.gni")
19
20config("public_includes") {
21  include_dirs = [ "public" ]
22}
23
24pw_source_set("pw_digital_io_linux") {
25  public_configs = [ ":public_includes" ]
26  public = [
27    "public/pw_digital_io_linux/digital_io.h",
28    "public/pw_digital_io_linux/internal/owned_fd.h",
29    "public/pw_digital_io_linux/notifier.h",
30  ]
31  public_deps = [
32    "$dir_pw_digital_io",
33    "$dir_pw_result",
34    "$dir_pw_status",
35    "$dir_pw_sync:lock_annotations",
36    "$dir_pw_sync:mutex",
37    "$dir_pw_thread:thread",
38  ]
39  deps = [ "$dir_pw_log" ]
40  sources = [
41    "digital_io.cc",
42    "log_errno.h",
43    "notifier.cc",
44  ]
45}
46
47pw_executable("pw_digital_io_linux_cli") {
48  sources = [ "digital_io_cli.cc" ]
49  deps = [
50    ":pw_digital_io_linux",
51    "$dir_pw_log",
52  ]
53}
54
55# TODO(b/328262654): Move this to a more appropriate module.
56pw_source_set("mock_vfs") {
57  public_configs = [ ":public_includes" ]
58  public = [ "mock_vfs.h" ]
59  public_deps = [ "$dir_pw_log" ]
60  sources = [
61    "log_errno.h",
62    "mock_vfs.cc",
63  ]
64  deps = [ "$dir_pw_assert" ]
65}
66
67pw_test("digital_io_test") {
68  enable_if = current_os == "linux"
69  sources = [
70    "digital_io_test.cc",
71    "test_utils.h",
72  ]
73  deps = [
74    ":mock_vfs",
75    ":pw_digital_io_linux",
76    "$dir_pw_assert",
77    "$dir_pw_log",
78    "$dir_pw_sync:mutex",
79    "$dir_pw_sync:timed_thread_notification",
80    "$dir_pw_thread:thread",
81    "$dir_pw_thread_stl:thread",
82  ]
83  ldflags = [
84    "-Wl,--wrap=close",
85    "-Wl,--wrap=ioctl",
86    "-Wl,--wrap=read",
87  ]
88}
89
90pw_test("notifier_test") {
91  enable_if = current_os == "linux"
92  sources = [
93    "log_errno.h",
94    "notifier_test.cc",
95    "test_utils.h",
96  ]
97  deps = [
98    ":pw_digital_io_linux",
99    "$dir_pw_assert",
100    "$dir_pw_log",
101    "$dir_pw_sync:counting_semaphore",
102    "$dir_pw_thread:thread",
103    "$dir_pw_thread_stl:thread",
104  ]
105}
106
107pw_test_group("tests") {
108  tests = [
109    ":digital_io_test",
110    ":notifier_test",
111  ]
112  group_deps = [ "examples" ]
113}
114
115pw_doc_group("docs") {
116  inputs = [
117    "examples/input.cc",
118    "examples/output.cc",
119    "examples/interrupt.cc",
120  ]
121  sources = [ "docs.rst" ]
122}
123