1# Copyright 2023 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_bluetooth_sapphire/sapphire.gni") 17import("$dir_pw_build/module_config.gni") 18import("$dir_pw_build/target_types.gni") 19import("$dir_pw_docgen/docs.gni") 20import("$dir_pw_unit_test/test.gni") 21 22config("public_include_path") { 23 include_dirs = [ "public" ] 24} 25 26pw_source_set("config") { 27 public = [ "public/pw_bluetooth_sapphire/config.h" ] 28 public_configs = [ ":public_include_path" ] 29 public_deps = [ pw_bluetooth_sapphire_CONFIG ] 30} 31 32group("host") { 33 public_deps = [ "host" ] 34 public_configs = [ ":public_include_path" ] 35} 36 37pw_source_set("peripheral") { 38 public = [ "public/pw_bluetooth_sapphire/peripheral.h" ] 39 sources = [ "peripheral.cc" ] 40 public_deps = [ 41 "$dir_pw_bluetooth:pw_bluetooth2", 42 "$dir_pw_sync:mutex", 43 "host/gap", 44 ] 45 public_configs = [ ":public_include_path" ] 46} 47 48pw_source_set("central") { 49 public = [ "public/pw_bluetooth_sapphire/central.h" ] 50 sources = [ "central.cc" ] 51 public_deps = [ 52 ":connection", 53 ":uuid", 54 "$dir_pw_bluetooth:pw_bluetooth2", 55 "$dir_pw_multibuf:allocator", 56 "host/gap", 57 ] 58 public_configs = [ ":public_include_path" ] 59} 60 61pw_source_set("connection") { 62 visibility = [ ":*" ] 63 public = [ 64 "public/pw_bluetooth_sapphire/internal/connection.h", 65 "public/pw_bluetooth_sapphire/internal/connection_options.h", 66 ] 67 sources = [ 68 "connection.cc", 69 "connection_options.cc", 70 ] 71 public_deps = [ 72 ":uuid", 73 "$dir_pw_bluetooth:pw_bluetooth2", 74 "host/gap", 75 ] 76 public_configs = [ ":public_include_path" ] 77} 78 79pw_source_set("uuid") { 80 visibility = [ ":*" ] 81 public = [ "public/pw_bluetooth_sapphire/internal/uuid.h" ] 82 public_configs = [ ":public_include_path" ] 83 deps = [ 84 "//pw_bluetooth_sapphire/host/common", 85 "//pw_span", 86 ] 87} 88 89pw_source_set("lease") { 90 public_configs = [ ":public_include_path" ] 91 public = [ "public/pw_bluetooth_sapphire/lease.h" ] 92 public_deps = [ 93 ":config", 94 dir_pw_function, 95 dir_pw_result, 96 ] 97} 98 99pw_source_set("null_lease_provider") { 100 public_configs = [ ":public_include_path" ] 101 public = [ "public/pw_bluetooth_sapphire/null_lease_provider.h" ] 102 public_deps = [ ":lease" ] 103} 104 105pw_source_set("fake_lease_provider") { 106 public_configs = [ ":public_include_path" ] 107 public = [ "public/pw_bluetooth_sapphire/fake_lease_provider.h" ] 108 public_deps = [ ":lease" ] 109} 110 111pw_source_set("power_delegate") { 112 public_configs = [ ":public_include_path" ] 113 public = [ "public/pw_bluetooth_sapphire/power_delegate.h" ] 114 public_deps = [ ":lease" ] 115} 116 117pw_test("lease_test") { 118 sources = [ "lease_test.cc" ] 119 deps = [ ":lease" ] 120} 121 122pw_test("null_lease_provider_test") { 123 sources = [ "null_lease_provider_test.cc" ] 124 deps = [ ":null_lease_provider" ] 125} 126 127pw_test("fake_lease_provider_test") { 128 sources = [ "fake_lease_provider_test.cc" ] 129 deps = [ ":fake_lease_provider" ] 130} 131 132pw_test("central_test") { 133 enable_if = pw_bluetooth_sapphire_ENABLED 134 sources = [ "central_test.cc" ] 135 deps = [ 136 ":central", 137 "$dir_pw_async:fake_dispatcher", 138 "$dir_pw_async2:pend_func_task", 139 "$dir_pw_multibuf:testing", 140 "host/gap:testing", 141 ] 142 test_main = "$dir_pw_bluetooth_sapphire/host/testing:gtest_main" 143} 144 145pw_test("peripheral_test") { 146 enable_if = pw_bluetooth_sapphire_ENABLED 147 sources = [ "peripheral_test.cc" ] 148 deps = [ 149 ":peripheral", 150 "$dir_pw_async:fake_dispatcher", 151 "$dir_pw_async2:pend_func_task", 152 "host/gap:testing", 153 ] 154} 155 156pw_test_group("tests") { 157 tests = [ 158 ":peripheral_test", 159 ":central_test", 160 ":fake_lease_provider_test", 161 ":null_lease_provider_test", 162 ":lease_test", 163 ] 164 group_deps = [ 165 "host:tests", 166 "lib:tests", 167 ] 168} 169 170pw_test_group("fuzzers") { 171 group_deps = [ "host:fuzzers" ] 172} 173 174pw_doc_group("docs") { 175 sources = [ 176 "docs.rst", 177 "fuchsia.rst", 178 "host/att/docs.rst", 179 "host/gap/docs.rst", 180 "host/l2cap/docs.rst", 181 "reference.rst", 182 "size_report.rst", 183 ] 184 report_deps = [ "size_report:host_size_diff" ] 185} 186