• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
15import("//build_overrides/pigweed.gni")
16
17import("$dir_pigweed/third_party/emboss/build_defs.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  sources = [ "docs.rst" ]
31
32  report_deps = [
33    ":emboss_size_report",
34    ":emboss_size_report_diff",
35  ]
36}
37
38pw_source_set("pw_bluetooth") {
39  public_configs = [ ":public_include_path" ]
40  public = [
41    "public/pw_bluetooth/address.h",
42    "public/pw_bluetooth/assigned_uuids.h",
43    "public/pw_bluetooth/constants.h",
44    "public/pw_bluetooth/controller.h",
45    "public/pw_bluetooth/gatt/client.h",
46    "public/pw_bluetooth/gatt/constants.h",
47    "public/pw_bluetooth/gatt/error.h",
48    "public/pw_bluetooth/gatt/server.h",
49    "public/pw_bluetooth/gatt/types.h",
50    "public/pw_bluetooth/host.h",
51    "public/pw_bluetooth/internal/hex.h",
52    "public/pw_bluetooth/internal/raii_ptr.h",
53    "public/pw_bluetooth/low_energy/advertising_data.h",
54    "public/pw_bluetooth/low_energy/bond_data.h",
55    "public/pw_bluetooth/low_energy/central.h",
56    "public/pw_bluetooth/low_energy/connection.h",
57    "public/pw_bluetooth/low_energy/peripheral.h",
58    "public/pw_bluetooth/low_energy/security_mode.h",
59    "public/pw_bluetooth/pairing_delegate.h",
60    "public/pw_bluetooth/peer.h",
61    "public/pw_bluetooth/result.h",
62    "public/pw_bluetooth/types.h",
63    "public/pw_bluetooth/uuid.h",
64    "public/pw_bluetooth/vendor.h",
65  ]
66  public_deps = [
67    "$dir_pw_chrono:system_clock",
68    "$dir_pw_string:string",
69    dir_pw_containers,
70    dir_pw_function,
71    dir_pw_result,
72    dir_pw_span,
73    dir_pw_status,
74  ]
75}
76
77if (dir_pw_third_party_emboss != "") {
78  config("emboss_include_path") {
79    include_dirs = [ "${target_gen_dir}/public" ]
80    visibility = [ ":*" ]
81  }
82
83  emboss_cc_library("emboss_hci") {
84    public_configs = [ ":emboss_include_path" ]
85    source = "public/pw_bluetooth/hci.emb"
86  }
87
88  emboss_cc_library("emboss_vendor") {
89    public_configs = [ ":emboss_include_path" ]
90    source = "public/pw_bluetooth/vendor.emb"
91    imports = [ "public/pw_bluetooth/hci.emb" ]
92    deps = [ ":emboss_hci" ]
93  }
94} else {
95  group("emboss_hci") {
96  }
97  group("emboss_vendor") {
98  }
99}
100
101pw_test_group("tests") {
102  enable_if = pw_chrono_SYSTEM_CLOCK_BACKEND != ""
103  tests = [
104    ":address_test",
105    ":api_test",
106    ":result_test",
107    ":uuid_test",
108    ":emboss_test",
109  ]
110}
111
112pw_test("address_test") {
113  sources = [ "address_test.cc" ]
114  deps = [ ":pw_bluetooth" ]
115}
116
117pw_test("api_test") {
118  sources = [ "api_test.cc" ]
119  deps = [ ":pw_bluetooth" ]
120}
121
122pw_test("result_test") {
123  sources = [ "result_test.cc" ]
124  deps = [ ":pw_bluetooth" ]
125}
126
127pw_test("uuid_test") {
128  sources = [ "uuid_test.cc" ]
129  deps = [ ":pw_bluetooth" ]
130}
131
132pw_test("emboss_test") {
133  enable_if = dir_pw_third_party_emboss != ""
134  configs = [ "$dir_pigweed/third_party/emboss:flags" ]
135  sources = [ "emboss_test.cc" ]
136  deps = [
137    ":emboss_hci",
138    ":emboss_vendor",
139  ]
140}
141
142if (dir_pw_third_party_emboss != "") {
143  pw_size_diff("emboss_size_report") {
144    title = "pw_bluetooth Emboss Size Report"
145    base = "$dir_pw_bloat:bloat_base"
146    binaries = [
147      {
148        target = "size_report:make_view_and_write"
149        label = "Make view and write field"
150      },
151    ]
152  }
153
154  pw_size_diff("emboss_size_report_diff") {
155    title = "pw_bluetooth Emboss Size Report diff"
156    base = "size_report:make_view_and_write"
157    binaries = [
158      {
159        target = "size_report:make_2_views_and_write"
160        label = "Size difference when adding a second view"
161      },
162    ]
163  }
164} else {
165  pw_size_diff("emboss_size_report") {
166    title = "pw_bluetooth Emboss Size Report"
167    base = "$dir_pw_bloat:bloat_base"
168    binaries = [
169      {
170        target = "$dir_pw_bloat:bloat_base"
171        label = "Emboss not configured."
172      },
173    ]
174  }
175
176  pw_size_diff("emboss_size_report_diff") {
177    title = "pw_bluetooth Emboss Size Report diff"
178    base = "$dir_pw_bloat:bloat_base"
179    binaries = [
180      {
181        target = "$dir_pw_bloat:bloat_base"
182        label = "Emboss not configured."
183      },
184    ]
185  }
186}
187