1#
2#  Copyright 2015 Google, Inc.
3#
4#  Licensed under the Apache License, Version 2.0 (the "License");
5#  you may not use this file except in compliance with the License.
6#  You may obtain a copy of the License at:
7#
8#  http://www.apache.org/licenses/LICENSE-2.0
9#
10#  Unless required by applicable law or agreed to in writing, software
11#  distributed under the License is distributed on an "AS IS" BASIS,
12#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13#  See the License for the specific language governing permissions and
14#  limitations under the License.
15#
16
17static_library("crypto_toolbox") {
18  sources = [
19    "crypto_toolbox/aes.cc",
20    "crypto_toolbox/aes_cmac.cc",
21    "crypto_toolbox/crypto_toolbox.cc",
22  ]
23
24  include_dirs = [ "//bt/" ]
25
26  configs += [ "//bt:target_defaults" ]
27}
28
29source_set("nonstandard_codecs") {
30  if (defined(use.bt_nonstandard_codecs) && use.bt_nonstandard_codecs) {
31    sources = [
32      "a2dp/a2dp_aac.cc",
33      "a2dp/a2dp_aac_decoder.cc",
34      "a2dp/a2dp_aac_encoder.cc",
35      "a2dp/a2dp_vendor.cc",
36      "a2dp/a2dp_vendor_aptx.cc",
37      "a2dp/a2dp_vendor_aptx_encoder.cc",
38      "a2dp/a2dp_vendor_aptx_hd.cc",
39      "a2dp/a2dp_vendor_aptx_hd_encoder.cc",
40      "a2dp/a2dp_vendor_ldac.cc",
41      "a2dp/a2dp_vendor_ldac_abr.cc",
42      "a2dp/a2dp_vendor_ldac_decoder.cc",
43      "a2dp/a2dp_vendor_ldac_encoder.cc",
44    ]
45
46    include_dirs = [
47      "//bt",
48      "//bt/bta/include",
49      "//bt/btif/include",
50      "//bt/internal_include",
51      "//bt/stack/include",
52      "//bt/utils/include",
53    ]
54
55    deps = [ "//bt/gd/rust/shim:init_flags_bridge_header" ]
56
57    configs += [
58      "//bt:target_defaults",
59      "//bt:external_libldac",
60      "//bt:external_aac",
61    ]
62  }
63}
64
65source_set("stack") {
66  sources = [
67    "a2dp/a2dp_api.cc",
68    "a2dp/a2dp_codec_config.cc",
69    "a2dp/a2dp_sbc.cc",
70    "a2dp/a2dp_sbc_decoder.cc",
71    "a2dp/a2dp_sbc_encoder.cc",
72    "a2dp/a2dp_sbc_up_sample.cc",
73    "acl/acl.cc",
74    "acl/ble_acl.cc",
75    "acl/btm_acl.cc",
76    "acl/btm_ble_connection_establishment.cc",
77    "acl/btm_pm.cc",
78    "avct/avct_api.cc",
79    "avct/avct_bcb_act.cc",
80    "avct/avct_ccb.cc",
81    "avct/avct_l2c.cc",
82    "avct/avct_l2c_br.cc",
83    "avct/avct_lcb.cc",
84    "avct/avct_lcb_act.cc",
85    "avdt/avdt_ad.cc",
86    "avdt/avdt_api.cc",
87    "avdt/avdt_ccb.cc",
88    "avdt/avdt_ccb_act.cc",
89    "avdt/avdt_l2c.cc",
90    "avdt/avdt_msg.cc",
91    "avdt/avdt_scb.cc",
92    "avdt/avdt_scb_act.cc",
93    "avrc/avrc_api.cc",
94    "avrc/avrc_bld_ct.cc",
95    "avrc/avrc_bld_tg.cc",
96    "avrc/avrc_opt.cc",
97    "avrc/avrc_pars_ct.cc",
98    "avrc/avrc_pars_tg.cc",
99    "avrc/avrc_sdp.cc",
100    "avrc/avrc_utils.cc",
101    "bnep/bnep_api.cc",
102    "bnep/bnep_main.cc",
103    "bnep/bnep_utils.cc",
104    "btm/ble_advertiser_hci_interface.cc",
105    "btm/ble_scanner_hci_interface.cc",
106    "btm/btm_ble.cc",
107    "btm/btm_ble_addr.cc",
108    "btm/btm_ble_adv_filter.cc",
109    "btm/btm_ble_batchscan.cc",
110    "btm/btm_ble_bgconn.cc",
111    "btm/btm_ble_cont_energy.cc",
112    "btm/btm_ble_gap.cc",
113    "btm/btm_ble_multi_adv.cc",
114    "btm/btm_ble_privacy.cc",
115    "btm/btm_client_interface.cc",
116    "btm/btm_dev.cc",
117    "btm/btm_devctl.cc",
118    "btm/btm_inq.cc",
119    "btm/btm_iso.cc",
120    "btm/btm_main.cc",
121    "btm/btm_scn.cc",
122    "btm/btm_sco.cc",
123    "btm/btm_sec.cc",
124    "btu/btu_hcif.cc",
125    "btu/btu_task.cc",
126    "eatt/eatt.cc",
127    "gap/gap_ble.cc",
128    "gap/gap_conn.cc",
129    "gatt/att_protocol.cc",
130    "gatt/connection_manager.cc",
131    "gatt/gatt_api.cc",
132    "gatt/gatt_attr.cc",
133    "gatt/gatt_auth.cc",
134    "gatt/gatt_cl.cc",
135    "gatt/gatt_db.cc",
136    "gatt/gatt_main.cc",
137    "gatt/gatt_sr.cc",
138    "gatt/gatt_sr_hash.cc",
139    "gatt/gatt_utils.cc",
140    "hcic/hciblecmds.cc",
141    "hcic/hcicmds.cc",
142    "hid/hidd_api.cc",
143    "hid/hidd_conn.cc",
144    "hid/hidh_api.cc",
145    "hid/hidh_conn.cc",
146    "l2cap/l2c_api.cc",
147    "l2cap/l2c_ble.cc",
148    "l2cap/l2c_csm.cc",
149    "l2cap/l2c_fcr.cc",
150    "l2cap/l2c_link.cc",
151    "l2cap/l2c_main.cc",
152    "l2cap/l2c_utils.cc",
153    "metrics/stack_metrics_logging.cc",
154    "pan/pan_api.cc",
155    "pan/pan_main.cc",
156    "pan/pan_utils.cc",
157    "rfcomm/port_api.cc",
158    "rfcomm/port_rfc.cc",
159    "rfcomm/port_utils.cc",
160    "rfcomm/rfc_l2cap_if.cc",
161    "rfcomm/rfc_mx_fsm.cc",
162    "rfcomm/rfc_port_fsm.cc",
163    "rfcomm/rfc_port_if.cc",
164    "rfcomm/rfc_ts_frames.cc",
165    "rfcomm/rfc_utils.cc",
166    "sdp/sdp_api.cc",
167    "sdp/sdp_db.cc",
168    "sdp/sdp_discovery.cc",
169    "sdp/sdp_main.cc",
170    "sdp/sdp_server.cc",
171    "sdp/sdp_utils.cc",
172    "smp/p_256_curvepara.cc",
173    "smp/p_256_ecc_pp.cc",
174    "smp/p_256_multprecision.cc",
175    "smp/smp_act.cc",
176    "smp/smp_api.cc",
177    "smp/smp_br_main.cc",
178    "smp/smp_keys.cc",
179    "smp/smp_l2c.cc",
180    "smp/smp_main.cc",
181    "smp/smp_utils.cc",
182    "srvc/srvc_dis.cc",
183    "srvc/srvc_eng.cc",
184  ]
185
186  include_dirs = [
187    ".",
188    "include",
189    "avct",
190    "btm",
191    "avrc",
192    "l2cap",
193    "avdt",
194    "gatt",
195    "gap",
196    "pan",
197    "bnep",
198    "eatt",
199    "hid",
200    "metrics",
201    "sdp",
202    "smp",
203    "srvc",
204    "//bt/types",
205    "//bt/linux_include",
206    "//bt/internal_include",
207    "//bt/btcore/include",
208    "//bt/vnd/include",
209    "//bt/vnd/ble",
210    "//bt/btif/include",
211    "//bt/hci/include",
212    "//bt/udrv/include",
213    "//bt/rpc/include",
214    "//bt/hcis",
215    "//bt/ctrlr/include",
216    "//bt/bta/include",
217    "//bt/bta/sys",
218    "//bt/utils/include",
219    "//bt/",
220  ]
221
222  deps = [
223    ":crypto_toolbox",
224    ":nonstandard_codecs",
225    "//bt:libbt-platform-protos-lite",
226    "//bt/gd/rust/shim:init_flags_bridge_header",
227    "//bt/types",
228    "//bt/types",
229  ]
230
231  configs += [ "//bt:target_defaults" ]
232}
233
234if (use.test) {
235  executable("net_test_btm_iso") {
236    sources = [
237      "btm/btm_iso.cc",
238      "test/btm_iso_test.cc",
239      "test/common/mock_controller.cc",
240      "test/common/mock_gatt_layer.cc",
241      "test/common/mock_hcic_layer.cc",
242    ]
243
244    include_dirs = [
245      "btm",
246      "include",
247      "test/common",
248      "//bt/internal_include",
249      "//bt/packet/tests",
250    ]
251
252    deps = [
253      "//bt/common",
254      "//bt/osi",
255    ]
256
257    configs += [
258      "//bt:external_gmock_main",
259      "//bt:target_defaults",
260    ]
261  }
262}
263
264if (defined(use.android) && use.android) {
265  executable("stack_unittests") {
266    sources = [
267      "test/stack_a2dp_test.cc",
268      "test/stack_avrcp_test.cc",
269    ]
270
271    include_dirs = [
272      "include",
273      "//bt/",
274      "//bt/bta/eatt",
275      "//bt/bta/include",
276      "//bt/bta/sys",
277      "//bt/btcore/include",
278      "//bt/embdrv/sbc/encoder/include",
279      "//bt/hci/include",
280      "//bt/internal_include",
281      "//bt/stack/a2dp",
282      "//bt/stack/btm",
283      "//bt/stack/include",
284      "//bt/udrv/include",
285      "//bt/utils/include",
286      "//bt/vnd/include",
287    ]
288
289    libs = [
290      "dl",
291      "pthread",
292      "resolv",
293      "rt",
294      "z",
295    ]
296
297    deps = [
298      ":stack",
299      "//bt/btcore",
300      "//bt/device",
301      "//bt/embdrv/g722",
302      "//bt/embdrv/sbc",
303      "//bt/hci",
304      "//bt/main:bluetooth",
305      "//bt/osi",
306      "//bt/types",
307    ]
308
309    configs += [
310      "//bt:external_tinyxml2",
311      "//bt:external_gmock_main",
312      "//bt:target_defaults",
313    ]
314  }
315
316  executable("net_test_stack_crypto_toolbox") {
317    sources = [ "test/crypto_toolbox_test.cc" ]
318
319    include_dirs = [ "//bt/" ]
320
321    deps = [ ":crypto_toolbox" ]
322
323    configs += [
324      "//bt:external_gmock_main",
325      "//bt:target_defaults",
326    ]
327  }
328
329  executable("net_test_stack_smp") {
330    sources = [
331      "smp/p_256_curvepara.cc",
332      "smp/p_256_ecc_pp.cc",
333      "smp/p_256_multprecision.cc",
334      "smp/smp_api.cc",
335      "smp/smp_keys.cc",
336      "smp/smp_main.cc",
337      "smp/smp_utils.cc",
338      "test/stack_smp_test.cc",
339    ]
340
341    include_dirs = [
342      "//bt/",
343      "//bt/linux_include",
344      "//bt/internal_include",
345      "//bt/btcore/include",
346      "//bt/hci/include",
347      "//bt/utils/include",
348      "//bt/bta/include",
349      "//bt/bta/sys",
350      "//bt/btcore/include",
351      "//bt/embdrv/sbc/encoder/include",
352      "//bt/hci/include",
353      "//bt/internal_include",
354      "//bt/stack/a2dp",
355      "//bt/stack/l2cap",
356      "//bt/stack/btm",
357      "//bt/stack/include",
358      "//bt/udrv/include",
359      "//bt/utils/include",
360      "//bt/vnd/include",
361    ]
362
363    libs = [
364      "dl",
365      "pthread",
366      "resolv",
367      "rt",
368      "z",
369    ]
370
371    deps = [
372      ":crypto_toolbox",
373      "//bt/osi",
374      "//bt/types",
375    ]
376
377    configs += [
378      "//bt:external_tinyxml2",
379      "//bt:external_gmock_main",
380      "//bt:target_defaults",
381    ]
382  }
383
384  executable("net_test_stack_multi_adv") {
385    sources = [
386      "btm/btm_ble_multi_adv.cc",
387      "test/ble_advertiser_test.cc",
388    ]
389
390    include_dirs = [
391      "include",
392      "//bt/",
393      "//bt/btcore/include",
394      "//bt/hci/include",
395      "//bt/internal_include",
396      "//bt/stack/btm",
397    ]
398
399    libs = [
400      "dl",
401      "pthread",
402      "resolv",
403      "rt",
404      "z",
405    ]
406
407    deps = [ "//bt/types" ]
408
409    configs += [
410      "//bt:external_gmock_main",
411      "//bt:target_defaults",
412    ]
413  }
414}
415