xref: /aosp_15_r20/external/pigweed/pw_bluetooth_sapphire/host/gatt/BUILD.gn (revision 61c4878ac05f98d0ceed94b57d316916de578985)
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_build/target_types.gni")
17import("$dir_pw_unit_test/test.gni")
18
19dir_public_gatt = "../../public/pw_bluetooth_sapphire/internal/host/gatt"
20
21# Basic target with protocol definitions and no logic, suitable for test
22# emulation.
23pw_source_set("definitions") {
24  public = [ "$dir_public_gatt/gatt_defs.h" ]
25
26  sources = [ "gatt_defs.cc" ]
27
28  public_deps = [ "$dir_pw_bluetooth_sapphire/host/att:definitions" ]
29}
30
31pw_source_set("gatt") {
32  public = [
33    "$dir_public_gatt/client.h",
34    "$dir_public_gatt/connection.h",
35    "$dir_public_gatt/gatt.h",
36    "$dir_public_gatt/generic_attribute_service.h",
37    "$dir_public_gatt/local_service_manager.h",
38    "$dir_public_gatt/remote_characteristic.h",
39    "$dir_public_gatt/remote_service.h",
40    "$dir_public_gatt/remote_service_manager.h",
41    "$dir_public_gatt/server.h",
42    "$dir_public_gatt/types.h",
43  ]
44
45  sources = [
46    "client.cc",
47    "connection.cc",
48    "gatt.cc",
49    "generic_attribute_service.cc",
50    "local_service_manager.cc",
51    "remote_characteristic.cc",
52    "remote_service.cc",
53    "remote_service_manager.cc",
54    "server.cc",
55    "types.cc",
56  ]
57
58  public_deps = [
59    ":definitions",
60    "$dir_pw_bluetooth_sapphire:config",
61    "$dir_pw_bluetooth_sapphire/host/att",
62    "$dir_pw_third_party/fuchsia:fit",
63  ]
64}
65
66pw_source_set("testing") {
67  testonly = pw_unit_test_TESTONLY
68
69  public = [
70    "$dir_public_gatt/fake_client.h",
71    "$dir_public_gatt/fake_layer.h",
72    "$dir_public_gatt/mock_server.h",
73  ]
74
75  sources = [
76    "fake_client.cc",
77    "fake_layer.cc",
78    "mock_server.cc",
79  ]
80
81  public_deps = [
82    ":gatt",
83    "$dir_pw_async:heap_dispatcher",
84    "$dir_pw_bluetooth_sapphire/host/common",
85    "$dir_pw_bluetooth_sapphire/host/common:uuid_string_util",
86    "$dir_pw_unit_test",
87  ]
88}
89
90pw_test("tests") {
91  sources = [
92    "client_test.cc",
93    "gatt_test.cc",
94    "generic_attribute_service_test.cc",
95    "local_service_manager_test.cc",
96    "remote_service_manager_test.cc",
97    "server_test.cc",
98  ]
99
100  deps = [
101    ":gatt",
102    ":testing",
103    "$dir_pw_bluetooth_sapphire/host/att",
104    "$dir_pw_bluetooth_sapphire/host/l2cap:testing",
105    "$dir_pw_bluetooth_sapphire/host/testing",
106  ]
107
108  test_main = "$dir_pw_bluetooth_sapphire/host/testing:gtest_main"
109}
110