1# Copyright 2022 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 15load("@com_google_emboss//:build_defs.bzl", "emboss_cc_library") 16load("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test") 17 18package(default_visibility = ["//visibility:public"]) 19 20licenses(["notice"]) 21 22label_flag( 23 name = "config", 24 build_setting_default = "//pw_build:default_module_config", 25) 26 27cc_library( 28 name = "pw_bluetooth", 29 hdrs = [ 30 "public/pw_bluetooth/address.h", 31 "public/pw_bluetooth/assigned_uuids.h", 32 "public/pw_bluetooth/config.h", 33 "public/pw_bluetooth/constants.h", 34 "public/pw_bluetooth/controller.h", 35 "public/pw_bluetooth/gatt/client.h", 36 "public/pw_bluetooth/gatt/constants.h", 37 "public/pw_bluetooth/gatt/error.h", 38 "public/pw_bluetooth/gatt/server.h", 39 "public/pw_bluetooth/gatt/types.h", 40 "public/pw_bluetooth/host.h", 41 "public/pw_bluetooth/internal/hex.h", 42 "public/pw_bluetooth/internal/raii_ptr.h", 43 "public/pw_bluetooth/low_energy/advertising_data.h", 44 "public/pw_bluetooth/low_energy/bond_data.h", 45 "public/pw_bluetooth/low_energy/central.h", 46 "public/pw_bluetooth/low_energy/connection.h", 47 "public/pw_bluetooth/low_energy/peripheral.h", 48 "public/pw_bluetooth/low_energy/security_mode.h", 49 "public/pw_bluetooth/pairing_delegate.h", 50 "public/pw_bluetooth/peer.h", 51 "public/pw_bluetooth/result.h", 52 "public/pw_bluetooth/types.h", 53 "public/pw_bluetooth/uuid.h", 54 "public/pw_bluetooth/vendor.h", 55 ], 56 includes = ["public"], 57 deps = [ 58 "//pw_chrono:system_clock", 59 "//pw_containers", 60 "//pw_function", 61 "//pw_multibuf", 62 "//pw_result", 63 "//pw_status", 64 "//pw_string:string", 65 ], 66) 67 68cc_library( 69 name = "pw_bluetooth2", 70 hdrs = [ 71 "public/pw_bluetooth/address.h", 72 "public/pw_bluetooth/assigned_uuids.h", 73 "public/pw_bluetooth/config.h", 74 "public/pw_bluetooth/constants.h", 75 "public/pw_bluetooth/controller2.h", 76 "public/pw_bluetooth/gatt/client2.h", 77 "public/pw_bluetooth/gatt/constants.h", 78 "public/pw_bluetooth/gatt/error.h", 79 "public/pw_bluetooth/gatt/server2.h", 80 "public/pw_bluetooth/gatt/types.h", 81 "public/pw_bluetooth/internal/hex.h", 82 "public/pw_bluetooth/internal/raii_ptr.h", 83 "public/pw_bluetooth/low_energy/advertising_data.h", 84 "public/pw_bluetooth/low_energy/bond_data2.h", 85 "public/pw_bluetooth/low_energy/central2.h", 86 "public/pw_bluetooth/low_energy/channel.h", 87 "public/pw_bluetooth/low_energy/connection2.h", 88 "public/pw_bluetooth/low_energy/peripheral2.h", 89 "public/pw_bluetooth/low_energy/phy.h", 90 "public/pw_bluetooth/low_energy/security_mode.h", 91 "public/pw_bluetooth/pairing_delegate2.h", 92 "public/pw_bluetooth/peer.h", 93 "public/pw_bluetooth/types.h", 94 "public/pw_bluetooth/uuid.h", 95 "public/pw_bluetooth/vendor.h", 96 ], 97 includes = ["public"], 98 deps = [ 99 ":config", 100 "//pw_async2:dispatcher", 101 "//pw_async2:once_sender", 102 "//pw_channel", 103 "//pw_chrono:system_clock", 104 "//pw_containers", 105 "//pw_function", 106 "//pw_multibuf", 107 "//pw_result", 108 "//pw_result:expected", 109 "//pw_span", 110 "//pw_status", 111 "//pw_string:string", 112 ], 113) 114 115cc_library( 116 name = "emboss_util", 117 hdrs = [ 118 "public/pw_bluetooth/emboss_util.h", 119 ], 120 includes = ["public"], 121 deps = [ 122 "//pw_result", 123 "//pw_span", 124 "//pw_status", 125 ], 126) 127 128pw_cc_test( 129 name = "address_test", 130 srcs = [ 131 "address_test.cc", 132 ], 133 deps = [ 134 ":pw_bluetooth", 135 ], 136) 137 138pw_cc_test( 139 name = "api_test", 140 srcs = [ 141 "api_test.cc", 142 ], 143 deps = [ 144 ":pw_bluetooth", 145 ], 146) 147 148pw_cc_test( 149 name = "api2_test", 150 srcs = [ 151 "api2_test.cc", 152 ], 153 deps = [ 154 ":pw_bluetooth2", 155 ], 156) 157 158pw_cc_test( 159 name = "result_test", 160 srcs = [ 161 "result_test.cc", 162 ], 163 deps = [ 164 ":pw_bluetooth", 165 ], 166) 167 168pw_cc_test( 169 name = "uuid_test", 170 srcs = [ 171 "uuid_test.cc", 172 ], 173 deps = [ 174 ":pw_bluetooth", 175 ], 176) 177 178emboss_cc_library( 179 name = "_emboss_avdtp", 180 srcs = ["public/pw_bluetooth/avdtp.emb"], 181 enable_enum_traits = False, 182 import_dirs = ["public"], 183 visibility = ["//visibility:private"], 184) 185 186emboss_cc_library( 187 name = "_emboss_att", 188 srcs = ["public/pw_bluetooth/att.emb"], 189 enable_enum_traits = False, 190 import_dirs = ["public"], 191 visibility = ["//visibility:private"], 192 deps = [ 193 ":_emboss_hci_data", 194 ":_emboss_l2cap_frames", 195 ], 196) 197 198cc_library( 199 name = "emboss_avdtp", 200 includes = ["public"], 201 deps = [":_emboss_avdtp"], 202) 203 204cc_library( 205 name = "emboss_att", 206 includes = ["public"], 207 deps = [":_emboss_att"], 208) 209 210emboss_cc_library( 211 name = "_emboss_hci_android", 212 srcs = ["public/pw_bluetooth/hci_android.emb"], 213 enable_enum_traits = False, 214 import_dirs = ["public"], 215 visibility = ["//visibility:private"], 216 deps = [":_emboss_hci_common"], 217) 218 219# emboss_cc_library doesn't support includes, so we need to wrap it. 220cc_library( 221 name = "emboss_hci_android", 222 includes = ["public"], 223 deps = [":_emboss_hci_android"], 224) 225 226emboss_cc_library( 227 name = "_emboss_hci_common", 228 srcs = ["public/pw_bluetooth/hci_common.emb"], 229 enable_enum_traits = False, 230 visibility = ["//visibility:private"], 231) 232 233cc_library( 234 name = "emboss_hci_common", 235 includes = ["public"], 236 deps = [":_emboss_hci_common"], 237) 238 239emboss_cc_library( 240 name = "_emboss_hci_commands", 241 srcs = ["public/pw_bluetooth/hci_commands.emb"], 242 enable_enum_traits = False, 243 import_dirs = ["public"], 244 visibility = ["//visibility:private"], 245 deps = [":_emboss_hci_common"], 246) 247 248cc_library( 249 name = "emboss_hci_commands", 250 includes = ["public"], 251 deps = [":_emboss_hci_commands"], 252) 253 254emboss_cc_library( 255 name = "_emboss_hci_data", 256 srcs = ["public/pw_bluetooth/hci_data.emb"], 257 enable_enum_traits = False, 258 visibility = ["//visibility:private"], 259 deps = [":_emboss_hci_common"], 260) 261 262cc_library( 263 name = "emboss_hci_data", 264 includes = ["public"], 265 deps = [":_emboss_hci_data"], 266) 267 268emboss_cc_library( 269 name = "_emboss_hci_events", 270 srcs = ["public/pw_bluetooth/hci_events.emb"], 271 enable_enum_traits = False, 272 import_dirs = ["public"], 273 visibility = ["//visibility:private"], 274 deps = [":_emboss_hci_common"], 275) 276 277cc_library( 278 name = "emboss_hci_events", 279 includes = ["public"], 280 deps = [":_emboss_hci_events"], 281) 282 283emboss_cc_library( 284 name = "_emboss_hci_h4", 285 srcs = ["public/pw_bluetooth/hci_h4.emb"], 286 enable_enum_traits = False, 287 import_dirs = ["public"], 288 visibility = ["//visibility:private"], 289) 290 291cc_library( 292 name = "emboss_hci_h4", 293 includes = ["public"], 294 deps = [":_emboss_hci_h4"], 295) 296 297emboss_cc_library( 298 name = "_emboss_hci_test", 299 srcs = ["public/pw_bluetooth/hci_test.emb"], 300 enable_enum_traits = False, 301 import_dirs = ["public"], 302 visibility = ["//visibility:private"], 303 deps = [":_emboss_hci_common"], 304) 305 306cc_library( 307 name = "emboss_hci_test", 308 includes = ["public"], 309 deps = [":_emboss_hci_test"], 310) 311 312emboss_cc_library( 313 name = "_emboss_l2cap_frames", 314 srcs = ["public/pw_bluetooth/l2cap_frames.emb"], 315 enable_enum_traits = False, 316 visibility = ["//visibility:private"], 317) 318 319cc_library( 320 name = "emboss_l2cap_frames", 321 includes = ["public"], 322 deps = [":_emboss_l2cap_frames"], 323) 324 325emboss_cc_library( 326 name = "_emboss_rfcomm_frames", 327 srcs = ["public/pw_bluetooth/rfcomm_frames.emb"], 328 enable_enum_traits = False, 329 visibility = ["//visibility:private"], 330) 331 332cc_library( 333 name = "emboss_rfcomm_frames", 334 includes = ["public"], 335 deps = [":_emboss_rfcomm_frames"], 336) 337 338cc_library( 339 name = "emboss_hci", 340 deps = [ 341 ":emboss_hci_android", 342 ":emboss_hci_commands", 343 ":emboss_hci_common", 344 ":emboss_hci_data", 345 ":emboss_hci_events", 346 ":emboss_hci_h4", 347 ], 348) 349 350pw_cc_test( 351 name = "emboss_test", 352 srcs = ["emboss_test.cc"], 353 deps = [ 354 # All emboss targets are listed (even if they don't have explicit tests) 355 # to ensure they are compiled. 356 ":emboss_att", 357 ":emboss_hci", 358 ":emboss_hci_test", 359 ":emboss_l2cap_frames", 360 ":emboss_rfcomm_frames", 361 "//third_party/fuchsia:stdcompat", 362 ], 363) 364 365pw_cc_test( 366 name = "emboss_util_test", 367 srcs = [ 368 "emboss_util_test.cc", 369 ], 370 deps = [ 371 ":emboss_hci_test", 372 ":emboss_util", 373 ], 374) 375 376# Bazel support for Emboss has not been fully configured yet, but we need to 377# satisfy presubmit. 378filegroup( 379 name = "emboss_files", 380 srcs = [ 381 "size_report/make_2_views_and_write.cc", 382 "size_report/make_view_and_write.cc", 383 ], 384) 385 386filegroup( 387 name = "doxygen", 388 srcs = [ 389 "public/pw_bluetooth/controller2.h", 390 "public/pw_bluetooth/gatt/client2.h", 391 "public/pw_bluetooth/gatt/server2.h", 392 "public/pw_bluetooth/low_energy/central2.h", 393 "public/pw_bluetooth/low_energy/channel.h", 394 "public/pw_bluetooth/low_energy/connection2.h", 395 "public/pw_bluetooth/low_energy/peripheral2.h", 396 ], 397) 398