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 "$dir_pw_thread:thread_core", 39 ] 40 deps = [ "$dir_pw_log" ] 41 sources = [ 42 "digital_io.cc", 43 "log_errno.h", 44 "notifier.cc", 45 ] 46} 47 48pw_executable("pw_digital_io_linux_cli") { 49 sources = [ "digital_io_cli.cc" ] 50 deps = [ 51 ":pw_digital_io_linux", 52 "$dir_pw_log", 53 ] 54} 55 56# TODO(b/328262654): Move this to a more appropriate module. 57pw_source_set("mock_vfs") { 58 public_configs = [ ":public_includes" ] 59 public = [ "mock_vfs.h" ] 60 public_deps = [ "$dir_pw_log" ] 61 sources = [ 62 "log_errno.h", 63 "mock_vfs.cc", 64 ] 65 deps = [ "$dir_pw_assert" ] 66} 67 68pw_test("digital_io_test") { 69 enable_if = current_os == "linux" 70 sources = [ "digital_io_test.cc" ] 71 deps = [ 72 ":mock_vfs", 73 ":pw_digital_io_linux", 74 "$dir_pw_assert", 75 "$dir_pw_log", 76 "$dir_pw_sync:mutex", 77 "$dir_pw_sync:timed_thread_notification", 78 "$dir_pw_thread:thread", 79 "$dir_pw_thread_stl:thread", 80 ] 81 ldflags = [ 82 "-Wl,--wrap=close", 83 "-Wl,--wrap=ioctl", 84 "-Wl,--wrap=read", 85 ] 86} 87 88pw_test("notifier_test") { 89 enable_if = current_os == "linux" 90 sources = [ 91 "log_errno.h", 92 "notifier_test.cc", 93 ] 94 deps = [ 95 ":pw_digital_io_linux", 96 "$dir_pw_assert", 97 "$dir_pw_log", 98 "$dir_pw_sync:counting_semaphore", 99 "$dir_pw_thread:thread", 100 "$dir_pw_thread_stl:thread", 101 ] 102} 103 104pw_test_group("tests") { 105 tests = [ 106 ":digital_io_test", 107 ":notifier_test", 108 ] 109 group_deps = [ "examples" ] 110} 111 112pw_doc_group("docs") { 113 inputs = [ 114 "examples/input.cc", 115 "examples/output.cc", 116 "examples/interrupt.cc", 117 ] 118 sources = [ "docs.rst" ] 119} 120