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") 16 17import("$dir_pigweed/third_party/emboss/emboss.gni") 18import("$dir_pw_bloat/bloat.gni") 19import("$dir_pw_build/target_types.gni") 20import("$dir_pw_chrono/backend.gni") 21import("$dir_pw_docgen/docs.gni") 22import("$dir_pw_unit_test/test.gni") 23 24config("public_include_path") { 25 include_dirs = [ "public" ] 26 visibility = [ ":*" ] 27} 28 29pw_doc_group("docs") { 30 # Also, sources with doxygen comment blocks must be added to //docs/BUILD.gn 31 inputs = [ "proxy_host_test.cc" ] 32 sources = [ "docs.rst" ] 33 report_deps = [ ":use_passthrough_proxy_size_report" ] 34} 35 36pw_test_group("tests") { 37 tests = [ 38 ":pw_bluetooth_proxy_test", 39 ":emboss_util_test", 40 ] 41} 42 43pw_source_set("pw_bluetooth_proxy") { 44 public_configs = [ ":public_include_path" ] 45 public = [ 46 "public/pw_bluetooth_proxy/acl_data_channel.h", 47 "public/pw_bluetooth_proxy/common.h", 48 "public/pw_bluetooth_proxy/proxy_host.h", 49 ] 50 public_deps = [ 51 "//pw_bluetooth:emboss_hci_common", 52 "//pw_bluetooth:emboss_hci_events", 53 "//pw_bluetooth:emboss_hci_h4", 54 dir_pw_function, 55 dir_pw_log, 56 dir_pw_span, 57 dir_pw_status, 58 ] 59 deps = [ dir_pw_log ] 60 sources = [ 61 "acl_data_channel.cc", 62 "emboss_util.h", 63 "proxy_host.cc", 64 ] 65} 66 67pw_test("emboss_util_test") { 68 enable_if = 69 dir_pw_third_party_emboss != "" && pw_chrono_SYSTEM_CLOCK_BACKEND != "" 70 sources = [ 71 "emboss_util.h", 72 "emboss_util_test.cc", 73 ] 74 include_dirs = [ "." ] 75 deps = [ 76 ":pw_bluetooth_proxy", 77 "//pw_bluetooth:emboss_hci_test", 78 "//pw_span", 79 ] 80} 81 82pw_test("pw_bluetooth_proxy_test") { 83 enable_if = 84 dir_pw_third_party_emboss != "" && pw_chrono_SYSTEM_CLOCK_BACKEND != "" 85 sources = [ 86 "emboss_util.h", 87 "proxy_host_test.cc", 88 ] 89 include_dirs = [ "." ] 90 deps = [ 91 ":pw_bluetooth_proxy", 92 "$dir_pw_third_party/fuchsia:stdcompat", 93 "//pw_bluetooth:emboss_hci_commands", 94 "//pw_bluetooth:emboss_hci_common", 95 "//pw_bluetooth:emboss_hci_events", 96 "//pw_bluetooth:emboss_hci_h4", 97 ] 98} 99 100# We depend on emboss, so we can only compute size when emboss is in the build. 101if (dir_pw_third_party_emboss != "") { 102 pw_size_diff("use_passthrough_proxy_size_report") { 103 title = "pw_bluetooth_proxy Passthrough Size Report" 104 base = "$dir_pw_bloat:bloat_base" 105 binaries = [ 106 { 107 target = "size_report:use_passthrough_proxy" 108 label = "Create and use proxy as a simple passthrough" 109 }, 110 ] 111 } 112} else { 113 pw_size_diff("use_passthrough_proxy_size_report") { 114 title = "pw_bluetooth_proxy Passthrough Size Report" 115 base = "$dir_pw_bloat:bloat_base" 116 binaries = [ 117 { 118 target = "$dir_pw_bloat:bloat_base" 119 label = "Emboss not configured." 120 }, 121 ] 122 } 123} 124