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 = [ "digital_io_test.cc" ] 70 deps = [ 71 ":mock_vfs", 72 ":pw_digital_io_linux", 73 "$dir_pw_assert", 74 "$dir_pw_log", 75 "$dir_pw_sync:mutex", 76 "$dir_pw_sync:timed_thread_notification", 77 "$dir_pw_thread:thread", 78 "$dir_pw_thread_stl:thread", 79 ] 80 ldflags = [ 81 "-Wl,--wrap=close", 82 "-Wl,--wrap=ioctl", 83 "-Wl,--wrap=read", 84 ] 85} 86 87pw_test("notifier_test") { 88 enable_if = current_os == "linux" 89 sources = [ 90 "log_errno.h", 91 "notifier_test.cc", 92 ] 93 deps = [ 94 ":pw_digital_io_linux", 95 "$dir_pw_assert", 96 "$dir_pw_log", 97 "$dir_pw_sync:counting_semaphore", 98 "$dir_pw_thread:thread", 99 "$dir_pw_thread_stl:thread", 100 ] 101} 102 103pw_test_group("tests") { 104 tests = [ 105 ":digital_io_test", 106 ":notifier_test", 107 ] 108 group_deps = [ "examples" ] 109} 110 111pw_doc_group("docs") { 112 inputs = [ 113 "examples/input.cc", 114 "examples/output.cc", 115 "examples/interrupt.cc", 116 ] 117 sources = [ "docs.rst" ] 118} 119