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
17# Nonstandard codecs are associated with 3P libs and must be contained in MMC
18source_set("nonstandard_codecs") {
19  if (defined(use.bt_nonstandard_codecs) && use.bt_nonstandard_codecs) {
20    sources = [
21      "a2dp/a2dp_aac.cc",
22      "a2dp/a2dp_aac_decoder_linux.cc",
23      "a2dp/a2dp_aac_encoder_linux.cc",
24      "a2dp/a2dp_vendor.cc",
25      # Following are unimplemented
26      "a2dp/a2dp_vendor_aptx_linux.cc",
27      "a2dp/a2dp_vendor_aptx_hd_linux.cc",
28      "a2dp/a2dp_vendor_ldac_linux.cc",
29      "a2dp/a2dp_vendor_opus_linux.cc",
30    ]
31
32    include_dirs = [
33      "//bt/system",
34      "//bt/system/bta/include",
35      "//bt/system/btif/include",
36      "//bt/system/include",
37      "//bt/system/stack",
38      "//bt/system/stack/include",
39      "//bt/system/utils/include",
40    ]
41
42    deps = [
43      "//bt/system/stack/mmc",
44    ]
45
46    configs += [
47      "//bt/system:target_defaults",
48      "//bt/system/log:log_defaults",
49    ]
50  }
51}
52
53source_set("stack") {
54  sources = [
55    "ais/ais_ble.cc",
56    "a2dp/a2dp_api.cc",
57    "a2dp/a2dp_codec_config.cc",
58    "a2dp/a2dp_ext.cc",
59    "a2dp/a2dp_sbc.cc",
60    "a2dp/a2dp_sbc_decoder.cc",
61    "a2dp/a2dp_sbc_encoder.cc",
62    "a2dp/a2dp_sbc_up_sample.cc",
63    "acl/acl.cc",
64    "acl/ble_acl.cc",
65    "acl/btm_acl.cc",
66    "acl/btm_pm.cc",
67    "arbiter/acl_arbiter.cc",
68    "avct/avct_api.cc",
69    "avct/avct_bcb_act.cc",
70    "avct/avct_ccb.cc",
71    "avct/avct_l2c.cc",
72    "avct/avct_l2c_br.cc",
73    "avct/avct_lcb.cc",
74    "avct/avct_lcb_act.cc",
75    "avdt/avdt_ad.cc",
76    "avdt/avdt_api.cc",
77    "avdt/avdt_ccb.cc",
78    "avdt/avdt_ccb_act.cc",
79    "avdt/avdt_l2c.cc",
80    "avdt/avdt_msg.cc",
81    "avdt/avdt_scb.cc",
82    "avdt/avdt_scb_act.cc",
83    "avrc/avrc_api.cc",
84    "avrc/avrc_bld_ct.cc",
85    "avrc/avrc_bld_tg.cc",
86    "avrc/avrc_opt.cc",
87    "avrc/avrc_pars_ct.cc",
88    "avrc/avrc_pars_tg.cc",
89    "avrc/avrc_sdp.cc",
90    "avrc/avrc_utils.cc",
91    "bnep/bnep_api.cc",
92    "bnep/bnep_main.cc",
93    "bnep/bnep_utils.cc",
94    "btm/ble_scanner_hci_interface.cc",
95    "btm/btm_ble.cc",
96    "btm/btm_ble_addr.cc",
97    "btm/btm_ble_adv_filter.cc",
98    "btm/btm_ble_cont_energy.cc",
99    "btm/btm_ble_gap.cc",
100    "btm/btm_ble_privacy.cc",
101    "btm/btm_ble_scanner.cc",
102    "btm/btm_ble_sec.cc",
103    "btm/btm_client_interface.cc",
104    "btm/btm_dev.cc",
105    "btm/btm_devctl.cc",
106    "btm/btm_inq.cc",
107    "btm/btm_iot_config.cc",
108    "btm/btm_iso.cc",
109    "btm/btm_main.cc",
110    "btm/btm_sco.cc",
111    "btm/btm_sco_hci.cc",
112    "btm/btm_sco_hfp_hal_linux.cc",
113    "btm/btm_sec.cc",
114    "btm/btm_sec_cb.cc",
115    "btm/btm_security_client_interface.cc",
116    "btm/security_event_parser.cc",
117    "btm/hfp_lc3_encoder_linux.cc",
118    "btm/hfp_lc3_decoder_linux.cc",
119    "btm/hfp_msbc_encoder.cc",
120    "btm/hfp_msbc_decoder.cc",
121    "btu/btu_hcif.cc",
122    "btu/main_thread.cc",
123    "eatt/eatt.cc",
124    "gap/gap_ble.cc",
125    "gap/gap_conn.cc",
126    "gatt/att_protocol.cc",
127    "connection_manager/connection_manager.cc",
128    "gatt/gatt_api.cc",
129    "gatt/gatt_attr.cc",
130    "gatt/gatt_auth.cc",
131    "gatt/gatt_cl.cc",
132    "gatt/gatt_db.cc",
133    "gatt/gatt_main.cc",
134    "gatt/gatt_sr.cc",
135    "gatt/gatt_sr_hash.cc",
136    "gatt/gatt_utils.cc",
137    "hcic/hciblecmds.cc",
138    "hcic/hcicmds.cc",
139    "hid/hidd_api.cc",
140    "hid/hidd_conn.cc",
141    "hid/hidh_api.cc",
142    "hid/hidh_conn.cc",
143    "l2cap/l2c_api.cc",
144    "l2cap/l2c_ble.cc",
145    "l2cap/l2c_ble_conn_params.cc",
146    "l2cap/l2c_csm.cc",
147    "l2cap/l2c_fcr.cc",
148    "l2cap/l2c_link.cc",
149    "l2cap/l2c_main.cc",
150    "l2cap/l2c_utils.cc",
151    "l2cap/l2cap_api.cc",
152    "metrics/stack_metrics_logging.cc",
153    "pan/pan_api.cc",
154    "pan/pan_main.cc",
155    "pan/pan_utils.cc",
156    "rfcomm/port_api.cc",
157    "rfcomm/port_rfc.cc",
158    "rfcomm/port_utils.cc",
159    "rfcomm/rfc_l2cap_if.cc",
160    "rfcomm/rfc_mx_fsm.cc",
161    "rfcomm/rfc_port_fsm.cc",
162    "rfcomm/rfc_port_if.cc",
163    "rfcomm/rfc_ts_frames.cc",
164    "rfcomm/rfc_utils.cc",
165    "rnr/remote_name_request.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    "ais",
190    "avct",
191    "btm",
192    "avrc",
193    "l2cap",
194    "avdt",
195    "gatt",
196    "gap",
197    "pan",
198    "bnep",
199    "eatt",
200    "hid",
201    "metrics",
202    "sdp",
203    "smp",
204    "srvc",
205    "//bt/system/",
206    "//bt/system/bta/include",
207    "//bt/system/bta/sys",
208    "//bt/system/btif/include",
209    "//bt/system/ctrlr/include",
210    "//bt/system/gd",
211    "//bt/system/hcis",
212    "//bt/system/linux_include",
213    "//bt/system/rpc/include",
214    "//bt/system/udrv/include",
215    "//bt/system/vnd/ble",
216    "//bt/system/vnd/include",
217  ]
218
219  deps = [
220    "//bt/sysprop:libcom.android.sysprop.bluetooth",
221    "//bt/system/gd/crypto_toolbox:crypto_toolbox",
222    "//bt/system/gd/rust/topshim:cxxlibheader",
223    ":nonstandard_codecs",
224    "//bt/system:libbt-platform-protos-lite",
225    "//bt/system/stack/mmc",
226    "//bt/system/types",
227  ]
228  if (use.test) {
229    deps += [
230      ":sco_hci_linux_test",
231    ]
232  }
233
234  configs += [
235    "//bt/system:target_defaults",
236    "//bt/system/log:log_defaults",
237  ]
238}
239
240if (use.test) {
241  executable("sco_hci_linux_test") {
242    sources = [
243      "btm/btm_sco_hci.cc",
244      "test/btm/sco_hci_linux_test.cc",
245      "//bt/system/test/common/core_interface.cc",
246      "//bt/system/test/common/mock_functions.cc",
247      "//bt/system/test/fake/fake_osi.cc",
248      "//bt/system/test/mock/mock_bluetooth_interface.cc",
249      "//bt/system/test/mock/mock_btif_stack_manager.cc",
250      "//bt/system/test/mock/mock_osi_alarm.cc",
251      "//bt/system/test/mock/mock_osi_allocator.cc",
252      "//bt/system/test/mock/mock_osi_fixed_queue.cc",
253      "//bt/system/test/mock/mock_osi_list.cc",
254      "//bt/system/test/mock/mock_stack_rnr_interface.cc",
255      "//bt/system/test/mock/mock_udrv_ulinux_uipc.cc",
256    ]
257
258    include_dirs = [
259      "btm",
260      "include",
261      "test/common",
262    ]
263    libs = [
264      "fmt",
265    ]
266    deps = [
267      "//bt/system/log:libbluetooth_log",
268      "//bt/system/common",
269      "//bt/system/osi",
270      "//bt/system/types",
271    ]
272    configs += [
273      "//bt/system:external_gmock_main",
274      "//bt/system:target_defaults",
275      "//bt/system/log:log_defaults",
276    ]
277  }
278
279  executable("net_test_btm_iso") {
280    sources = [
281      "btm/btm_iso.cc",
282      "test/btm_iso_test.cc",
283      "test/common/mock_gatt_layer.cc",
284      "test/common/mock_hcic_layer.cc",
285    ]
286
287    include_dirs = [
288      "btm",
289      "include",
290      "test/common",
291      "//bt/system/packet/tests",
292    ]
293
294    deps = [
295      "//bt/system/common",
296      "//bt/system/osi",
297    ]
298
299    configs += [
300      "//bt/system:external_gmock_main",
301      "//bt/system:target_defaults",
302    ]
303  }
304}
305
306if (defined(use.android) && use.android) {
307  executable("stack_unittests") {
308    sources = [
309      "test/stack_a2dp_test.cc",
310      "test/stack_avrcp_test.cc",
311    ]
312
313    include_dirs = [
314      "include",
315      "//bt/system/",
316      "//bt/system/bta/eatt",
317      "//bt/system/bta/include",
318      "//bt/system/bta/sys",
319      "//bt/system/embdrv/sbc/encoder/include",
320      "//bt/system/stack/a2dp",
321      "//bt/system/stack/btm",
322      "//bt/system/stack/include",
323      "//bt/system/udrv/include",
324      "//bt/system/vnd/include",
325    ]
326
327    libs = [
328      "dl",
329      "fmt",
330      "pthread",
331      "resolv",
332      "rt",
333      "z",
334    ]
335
336    deps = [
337      ":stack",
338      "//bt/system/btcore",
339      "//bt/system/device",
340      "//bt/system/embdrv/g722",
341      "//bt/system/embdrv/sbc",
342      "//bt/system/hci",
343      "//bt/system/main:bluetooth",
344      "//bt/system/osi",
345      "//bt/system/types",
346    ]
347
348    configs += [
349      "//bt/system:external_tinyxml2",
350      "//bt/system:external_gmock_main",
351      "//bt/system:target_defaults",
352    ]
353  }
354
355  executable("net_test_stack_smp") {
356    sources = [
357      "smp/p_256_curvepara.cc",
358      "smp/p_256_ecc_pp.cc",
359      "smp/p_256_multprecision.cc",
360      "smp/smp_api.cc",
361      "smp/smp_keys.cc",
362      "smp/smp_main.cc",
363      "smp/smp_utils.cc",
364      "test/stack_smp_test.cc",
365    ]
366
367    include_dirs = [
368      "//bt/system/",
369      "//bt/system/linux_include",
370      "//bt/system/bta/include",
371      "//bt/system/bta/sys",
372      "//bt/system/embdrv/sbc/encoder/include",
373      "//bt/system/stack/a2dp",
374      "//bt/system/stack/l2cap",
375      "//bt/system/stack/btm",
376      "//bt/system/stack/include",
377      "//bt/system/udrv/include",
378      "//bt/system/vnd/include",
379    ]
380
381    libs = [
382      "dl",
383      "fmt",
384      "pthread",
385      "resolv",
386      "rt",
387      "z",
388    ]
389
390    deps = [
391      "//bt/system/gd:crypto_toolbox",
392      "//bt/system/osi",
393      "//bt/system/types",
394    ]
395
396    configs += [
397      "//bt/system:external_tinyxml2",
398      "//bt/system:external_gmock_main",
399      "//bt/system:target_defaults",
400    ]
401  }
402}
403