blob: 540001fb0c0b4bfbd28ce14db4c351aeccd1910f [file] [log] [blame]
Zach Johnson3a770032019-03-27 19:15:38 -07001cc_defaults {
2 name: "gd_defaults",
3 target: {
4 android: {
5 test_config_template: "AndroidTestTemplate.xml",
6 cflags: [
7 "-DOS_ANDROID",
8 "-DOS_LINUX_GENERIC",
9 ],
10 shared_libs: [
Colin Cross62084352019-05-23 14:12:59 -070011 "liblog",
12 ],
Zach Johnson3a770032019-03-27 19:15:38 -070013 },
14 host: {
15 cflags: [
16 "-DOS_LINUX",
17 "-DOS_LINUX_GENERIC",
Colin Cross62084352019-05-23 14:12:59 -070018 ],
19 },
Colin Cross3b06fff2019-05-23 14:10:48 -070020 darwin: {
21 enabled: false,
22 },
Zach Johnson3a770032019-03-27 19:15:38 -070023 },
24 cpp_std: "c++17",
25 cflags: [
26 "-DEXPORT_SYMBOL=__attribute__((visibility(\"default\")))",
27 "-fvisibility=hidden",
28 "-DLOG_NDEBUG=1",
29 "-DGOOGLE_PROTOBUF_NO_RTTI",
Zach Johnsone0e158c2019-04-26 11:57:05 -070030 "-Wno-unused-parameter",
Zach Johnsone0e158c2019-04-26 11:57:05 -070031 "-Wno-unused-result",
Zach Johnson3a770032019-03-27 19:15:38 -070032 ],
33 conlyflags: [
34 "-std=c99",
35 ],
36 sanitize: {
37 misc_undefined: ["bounds"],
38 },
39}
40
41// Enables code coverage for a set of source files. Must be combined with
42// "clang_coverage_bin" in order to work. See //test/gen_coverage.py for more information
43// on generating code coverage.
44cc_defaults {
45 name: "gd_clang_file_coverage",
46 target: {
47 host: {
48 clang_cflags: [
49 "-fprofile-instr-generate",
50 "-fcoverage-mapping",
51 ],
52 },
53 },
54}
55
56// Enabled code coverage on a binary. These flags allow libraries that were
57// compiled with "clang_file_coverage" to be properly linked together in
58// order to create a binary that will create a profraw file when ran. Note
59// these flags themselves don't enable code coverage for the source files
60// compiled in the binary. See //test/gen_coverage.py for more information
61// on generating code coverage.
62cc_defaults {
63 name: "gd_clang_coverage_bin",
64 target: {
65 host: {
66 ldflags: [
67 "-fprofile-instr-generate",
68 "-fcoverage-mapping",
69 ],
70 },
71 },
72}
73
74cc_library {
75 name: "libbluetooth_gd",
Hansong Zhanga25f84d2019-03-19 16:17:42 -070076 defaults: [
Zach Johnson3a770032019-03-27 19:15:38 -070077 "gd_defaults",
78 "gd_clang_file_coverage",
Hansong Zhanga25f84d2019-03-19 16:17:42 -070079 ],
80 host_supported: true,
Zach Johnson3a770032019-03-27 19:15:38 -070081 target: {
82 linux: {
83 srcs: [
84 ":BluetoothOsSources_linux_generic",
Hansong Zhang751a2212019-03-29 14:27:05 -070085 ],
86 },
87 host: {
88 srcs: [
89 ":BluetoothHalSources_hci_rootcanal",
90 ],
91 },
Hansong Zhang904c0222019-04-08 14:26:53 -070092 android: {
93 srcs: [
94 ":BluetoothHalSources_hci_android_hidl",
95 ],
96 shared_libs: [
97 "android.hardware.bluetooth@1.0",
Hansong Zhang904c0222019-04-08 14:26:53 -070098 "libhidlbase",
Hansong Zhang904c0222019-04-08 14:26:53 -070099 "libutils",
100 ],
101 },
Zach Johnson3a770032019-03-27 19:15:38 -0700102 },
Myles Watson0ead5972019-04-01 13:21:25 -0700103 srcs: [
Hansong Zhang3fa05ab2019-04-09 08:55:27 -0700104 "stack_manager.cc",
Zach Johnson429c94b2019-04-25 22:24:54 -0700105 "module.cc",
Jakub Pawlowski3d6f4042020-01-28 16:53:20 +0100106 ":BluetoothAttSources",
Myles Watson0ead5972019-04-01 13:21:25 -0700107 ":BluetoothCommonSources",
Jakub Pawlowski5c703472019-05-22 17:36:24 +0200108 ":BluetoothCryptoToolboxSources",
Jack Hee0660822019-04-22 11:45:26 -0700109 ":BluetoothHalSources",
Myles Watsoncf0bb8c2019-02-22 16:08:06 -0800110 ":BluetoothHciSources",
Jack Hefcb2bbf2019-07-31 15:44:05 -0700111 ":BluetoothL2capSources",
Chris Mantonaf1058b2019-10-16 22:26:22 -0700112 ":BluetoothNeighborSources",
Myles Watson0ead5972019-04-01 13:21:25 -0700113 ":BluetoothPacketSources",
Chris Manton1bb0e512019-09-09 21:11:59 -0700114 ":BluetoothShimSources",
Martin Brabhama5be8682019-10-18 13:59:24 -0700115 ":BluetoothSecuritySources",
Chris Manton4cb66bf2020-01-10 21:17:47 -0800116 ":BluetoothStorageSources",
Hansong Zhang29f99002019-04-24 17:25:42 +0000117 ],
118 generated_headers: [
119 "BluetoothGeneratedPackets_h",
120 ],
Hansong Zhangaa0875c2019-06-06 21:44:55 -0700121 shared_libs: [
122 "libchrome",
123 ],
Hansong Zhang29f99002019-04-24 17:25:42 +0000124}
125
126cc_binary {
Hansong Zhang13ceb562019-09-25 12:12:59 -0700127 name: "bluetooth_stack_with_facade",
Hansong Zhang29f99002019-04-24 17:25:42 +0000128 defaults: [
129 "gd_defaults",
130 ],
131 host_supported: true,
132 srcs: [
Zach Johnson49995042019-05-02 19:56:10 -0700133 "facade/facade_main.cc",
Hansong Zhang30bf8692019-05-02 15:25:54 -0700134 "facade/grpc_root_server.cc",
Hansong Zhange0a997f2019-08-29 14:27:11 -0700135 "facade/read_only_property_server.cc",
Zach Johnsone0e158c2019-04-26 11:57:05 -0700136 "grpc/grpc_module.cc",
Zach Johnson34703602019-04-29 16:45:21 -0700137 ":BluetoothFacade_hci_hal",
Hansong Zhangc5ec8f92019-06-19 17:22:21 -0700138 ":BluetoothFacade_hci_layer",
Jack Hefcb2bbf2019-07-31 15:44:05 -0700139 ":BluetoothFacade_l2cap_layer",
Myles Watson9cc3ebe2020-01-03 15:20:33 -0800140 ":BluetoothFacade_neighbor",
Martin Brabham7fd25ca2019-12-03 20:13:05 -0800141 ":BluetoothFacade_security_layer",
Hansong Zhang29f99002019-04-24 17:25:42 +0000142 ],
143 generated_headers: [
144 "BluetoothGeneratedPackets_h",
Zach Johnson34703602019-04-29 16:45:21 -0700145 "BluetoothFacadeGeneratedStub_h",
Hansong Zhang29f99002019-04-24 17:25:42 +0000146 ],
147 generated_sources: [
Zach Johnson34703602019-04-29 16:45:21 -0700148 "BluetoothFacadeGeneratedStub_cc",
Hansong Zhang29f99002019-04-24 17:25:42 +0000149 ],
150 static_libs: [
151 "libbluetooth_gd",
152 ],
153 shared_libs: [
Hansong Zhangaa0875c2019-06-06 21:44:55 -0700154 "libchrome",
Hansong Zhang29f99002019-04-24 17:25:42 +0000155 "libgrpc++_unsecure",
156 "libprotobuf-cpp-full",
157 ],
158 target: {
159 android: {
160 shared_libs: [
161 "android.hardware.bluetooth@1.0",
Hansong Zhang29f99002019-04-24 17:25:42 +0000162 "libhidlbase",
Hansong Zhang29f99002019-04-24 17:25:42 +0000163 "libutils",
164 ],
165 },
Dan Willemsen3fc06a42020-02-05 14:19:17 -0800166 host: {
167 required: [
168 "root-canal",
169 ],
170 },
Hansong Zhang29f99002019-04-24 17:25:42 +0000171 },
Hansong Zhang29f99002019-04-24 17:25:42 +0000172 sanitize: {
173 address: true,
174 },
175}
176
177cc_test {
Zach Johnson3a770032019-03-27 19:15:38 -0700178 name: "bluetooth_test_gd",
Hansong Zhanga25f84d2019-03-19 16:17:42 -0700179 test_suites: ["device-tests"],
180 defaults: [
Zach Johnson3a770032019-03-27 19:15:38 -0700181 "gd_defaults",
182 "gd_clang_coverage_bin",
Hansong Zhanga25f84d2019-03-19 16:17:42 -0700183 ],
184 host_supported: true,
Zach Johnson3a770032019-03-27 19:15:38 -0700185 target: {
186 linux: {
187 srcs: [
188 ":BluetoothOsTestSources_linux_generic",
Hansong Zhang751a2212019-03-29 14:27:05 -0700189 ],
190 },
191 host: {
192 srcs: [
193 ":BluetoothHalTestSources_hci_rootcanal",
194 ],
195 },
Hansong Zhang904c0222019-04-08 14:26:53 -0700196 android: {
197 srcs: [
198 ":BluetoothHalTestSources_hci_android_hidl",
199 ],
200 shared_libs: [
201 "android.hardware.bluetooth@1.0",
Hansong Zhang904c0222019-04-08 14:26:53 -0700202 "libhidlbase",
Hansong Zhang904c0222019-04-08 14:26:53 -0700203 "libutils",
204 ],
205 },
Zach Johnson3a770032019-03-27 19:15:38 -0700206 },
Myles Watson0ead5972019-04-01 13:21:25 -0700207 srcs: [
Zach Johnson429c94b2019-04-25 22:24:54 -0700208 "module_unittest.cc",
Hansong Zhang0bce6f72019-06-13 18:31:40 -0700209 "stack_manager_unittest.cc",
Jakub Pawlowski3d6f4042020-01-28 16:53:20 +0100210 ":BluetoothAttTestSources",
Myles Watson0ead5972019-04-01 13:21:25 -0700211 ":BluetoothCommonTestSources",
Jakub Pawlowski5c703472019-05-22 17:36:24 +0200212 ":BluetoothCryptoToolboxTestSources",
Myles Watsoncc57c6b2019-03-25 15:24:43 -0700213 ":BluetoothHciTestSources",
Myles Watsona4cd53c2019-03-25 15:25:08 -0700214 ":BluetoothL2capTestSources",
Chris Mantonaf1058b2019-10-16 22:26:22 -0700215 ":BluetoothNeighborTestSources",
Myles Watson0ead5972019-04-01 13:21:25 -0700216 ":BluetoothPacketTestSources",
Martin Brabhama5be8682019-10-18 13:59:24 -0700217 ":BluetoothSecurityTestSources",
Chris Mantonee8c0a92019-10-17 10:56:37 -0700218 ":BluetoothShimTestSources",
Chris Manton4cb66bf2020-01-10 21:17:47 -0800219 ":BluetoothStorageTestSources",
Myles Watson0ead5972019-04-01 13:21:25 -0700220 ],
Colin Cross62084352019-05-23 14:12:59 -0700221 generated_headers: [
Hansong Zhang05c079b2019-04-04 13:24:43 -0700222 "BluetoothGeneratedPackets_h",
Myles Watsoncc57c6b2019-03-25 15:24:43 -0700223 ],
Colin Cross62084352019-05-23 14:12:59 -0700224 static_libs: [
Zach Johnson3a770032019-03-27 19:15:38 -0700225 "libbluetooth_gd",
Hansong Zhangcf49fa92019-05-06 17:54:51 -0700226 "libgmock",
Hansong Zhanga25f84d2019-03-19 16:17:42 -0700227 ],
Hansong Zhangaa0875c2019-06-06 21:44:55 -0700228 shared_libs: [
229 "libchrome",
230 ],
Hansong Zhanga25f84d2019-03-19 16:17:42 -0700231 sanitize: {
Chienyuan2d7f3b72019-03-29 17:33:41 -0700232 address: true,
Hansong Zhanga25f84d2019-03-19 16:17:42 -0700233 },
234}
Jack Hef4e24712019-04-01 16:20:14 -0700235
Ajay Panicker4d6b7602019-02-06 14:02:36 -0800236cc_test {
237 name: "bluetooth_packet_parser_test",
238 test_suites: ["device-tests"],
239 defaults: [
240 "gd_defaults",
241 "gd_clang_coverage_bin",
242 ],
243 host_supported: true,
244 srcs: [
245 ":BluetoothPacketSources",
246 ":BluetoothPacketParserTestPacketTestSources",
247 ],
Colin Cross62084352019-05-23 14:12:59 -0700248 generated_headers: [
Ajay Panicker4d6b7602019-02-06 14:02:36 -0800249 "BluetoothPacketParserTestPacketPdlGen_h",
250 ],
251 sanitize: {
252 address: true,
253 cfi: true,
254 },
255}
256
Zongheng Wang627ba812019-10-16 16:39:11 -0700257cc_fuzz {
258 name: "bluetooth_gd_fuzz_test",
259 defaults: ["gd_defaults"],
260 srcs: [
261 "fuzz_test.cc",
Jack Hee0cd4da2019-10-22 15:57:10 -0700262 ":BluetoothHciFuzzTestSources",
Zongheng Wang627ba812019-10-16 16:39:11 -0700263 ":BluetoothL2capFuzzTestSources",
264 ],
265 static_libs: [
266 "libbluetooth_gd",
267 "libchrome",
268 "libgmock",
269 "libgtest",
270 ],
271 host_supported: true,
272 generated_headers: [
273 "BluetoothGeneratedPackets_h",
274 ],
275 target: {
276 android: {
277 shared_libs: [
278 "android.hardware.bluetooth@1.0",
279 "libhidlbase",
280 "libutils",
281 ],
282 },
283 },
284}
285
Jack Hef4e24712019-04-01 16:20:14 -0700286cc_benchmark {
287 name: "bluetooth_benchmark_gd",
288 defaults: ["gd_defaults"],
289 host_supported: true,
290 srcs: [
291 "benchmark.cc",
292 ":BluetoothOsBenchmarkSources",
293 ],
Colin Cross62084352019-05-23 14:12:59 -0700294 static_libs: [
Hansong Zhang05c079b2019-04-04 13:24:43 -0700295 "libbluetooth_gd",
296 ],
Hansong Zhangaa0875c2019-06-06 21:44:55 -0700297 shared_libs: [
298 "libchrome",
299 ],
Hansong Zhang05c079b2019-04-04 13:24:43 -0700300}
301
Chienyuan3d8a8032019-11-01 18:04:07 +0800302filegroup {
303 name: "BluetoothHciClassSources",
304 srcs: [
305 "hci/address.cc",
306 "hci/class_of_device.cc",
307 ],
308}
309
Hansong Zhang05c079b2019-04-04 13:24:43 -0700310genrule {
311 name: "BluetoothGeneratedPackets_h",
312 tools: [
313 "bluetooth_packetgen",
314 ],
315 cmd: "$(location bluetooth_packetgen) --include=system/bt/gd --out=$(genDir) $(in)",
316 srcs: [
317 "hci/hci_packets.pdl",
318 "l2cap/l2cap_packets.pdl",
Jakub Pawlowskie79714e2019-10-14 14:49:55 +0200319 "security/smp_packets.pdl",
Hansong Zhang05c079b2019-04-04 13:24:43 -0700320 ],
321 out: [
322 "hci/hci_packets.h",
323 "l2cap/l2cap_packets.h",
Jakub Pawlowskie79714e2019-10-14 14:49:55 +0200324 "security/smp_packets.h",
Jack Hef4e24712019-04-01 16:20:14 -0700325 ],
326}
Hansong Zhang29f99002019-04-24 17:25:42 +0000327
Jack He9be1dcd2019-11-18 19:20:41 -0800328genrule {
329 name: "BluetoothGeneratedPackets_python3_cc",
330 tools: [
331 "bluetooth_packetgen",
332 ],
Jack Hef2d14602019-11-20 17:24:16 -0800333 cmd: "$(location bluetooth_packetgen) --include=system/bt/gd --out=$(genDir) --num_shards=5 $(in)",
Jack He9be1dcd2019-11-18 19:20:41 -0800334 srcs: [
335 "hci/hci_packets.pdl",
336 "l2cap/l2cap_packets.pdl",
337 "security/smp_packets.pdl",
338 ],
339 out: [
340 "hci/hci_packets_python3.cc",
Jack Hef2d14602019-11-20 17:24:16 -0800341 "hci/hci_packets_python3_shard_0.cc",
342 "hci/hci_packets_python3_shard_1.cc",
343 "hci/hci_packets_python3_shard_2.cc",
344 "hci/hci_packets_python3_shard_3.cc",
345 "hci/hci_packets_python3_shard_4.cc",
Jack He9be1dcd2019-11-18 19:20:41 -0800346 "l2cap/l2cap_packets_python3.cc",
Jack Hef2d14602019-11-20 17:24:16 -0800347 "l2cap/l2cap_packets_python3_shard_0.cc",
348 "l2cap/l2cap_packets_python3_shard_1.cc",
349 "l2cap/l2cap_packets_python3_shard_2.cc",
350 "l2cap/l2cap_packets_python3_shard_3.cc",
351 "l2cap/l2cap_packets_python3_shard_4.cc",
Jack He9be1dcd2019-11-18 19:20:41 -0800352 "security/smp_packets_python3.cc",
Jack Hef2d14602019-11-20 17:24:16 -0800353 "security/smp_packets_python3_shard_0.cc",
354 "security/smp_packets_python3_shard_1.cc",
355 "security/smp_packets_python3_shard_2.cc",
356 "security/smp_packets_python3_shard_3.cc",
357 "security/smp_packets_python3_shard_4.cc",
Jack He9be1dcd2019-11-18 19:20:41 -0800358 ],
359}
360
Hansong Zhang29f99002019-04-24 17:25:42 +0000361filegroup {
Zach Johnson34703602019-04-29 16:45:21 -0700362 name: "BluetoothFacadeProto",
Hansong Zhang29f99002019-04-24 17:25:42 +0000363 srcs: [
Chienyuan4adb0422019-04-25 15:11:54 -0700364 "facade/common.proto",
Hansong Zhang30bf8692019-05-02 15:25:54 -0700365 "facade/rootservice.proto",
Zach Johnson34703602019-04-29 16:45:21 -0700366 "hal/facade.proto",
Myles Watson03ad00e2019-12-18 15:47:38 -0800367 "hci/facade/facade.proto",
Myles Watsonf94a56f2020-01-08 11:19:00 -0800368 "hci/facade/acl_manager_facade.proto",
Myles Watsonf43020d2020-01-09 13:41:22 -0800369 "hci/facade/controller_facade.proto",
Myles Watson01695642020-01-14 14:33:09 -0800370 "hci/facade/le_acl_manager_facade.proto",
Jack Hecb6424b2019-11-27 11:29:59 -0800371 "hci/facade/le_advertising_manager_facade.proto",
Myles Watson6c3a8ec2020-01-06 14:44:11 -0800372 "hci/facade/le_scanning_manager_facade.proto",
Myles Watson9cc3ebe2020-01-03 15:20:33 -0800373 "neighbor/facade/facade.proto",
Jack Heff38d892019-10-03 17:11:07 -0700374 "l2cap/classic/facade.proto",
Martin Brabham7fd25ca2019-12-03 20:13:05 -0800375 "security/facade.proto",
Hansong Zhang29f99002019-04-24 17:25:42 +0000376 ],
377}
378
379genrule {
Zach Johnson34703602019-04-29 16:45:21 -0700380 name: "BluetoothFacadeGeneratedStub_h",
Hansong Zhang29f99002019-04-24 17:25:42 +0000381 tools: [
382 "aprotoc",
383 "protoc-gen-grpc-cpp-plugin",
384 ],
385 cmd: "$(location aprotoc) -Isystem/bt/gd -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)",
386 srcs: [
Zach Johnson34703602019-04-29 16:45:21 -0700387 ":BluetoothFacadeProto",
Hansong Zhang29f99002019-04-24 17:25:42 +0000388 ],
389 out: [
Chienyuan4adb0422019-04-25 15:11:54 -0700390 "facade/common.grpc.pb.h",
391 "facade/common.pb.h",
Hansong Zhang30bf8692019-05-02 15:25:54 -0700392 "facade/rootservice.grpc.pb.h",
393 "facade/rootservice.pb.h",
Zach Johnson34703602019-04-29 16:45:21 -0700394 "hal/facade.grpc.pb.h",
395 "hal/facade.pb.h",
Myles Watson03ad00e2019-12-18 15:47:38 -0800396 "hci/facade/facade.grpc.pb.h",
397 "hci/facade/facade.pb.h",
Myles Watsonf94a56f2020-01-08 11:19:00 -0800398 "hci/facade/acl_manager_facade.grpc.pb.h",
399 "hci/facade/acl_manager_facade.pb.h",
Myles Watsonf43020d2020-01-09 13:41:22 -0800400 "hci/facade/controller_facade.grpc.pb.h",
401 "hci/facade/controller_facade.pb.h",
Myles Watson01695642020-01-14 14:33:09 -0800402 "hci/facade/le_acl_manager_facade.grpc.pb.h",
403 "hci/facade/le_acl_manager_facade.pb.h",
Jack Hecb6424b2019-11-27 11:29:59 -0800404 "hci/facade/le_advertising_manager_facade.grpc.pb.h",
405 "hci/facade/le_advertising_manager_facade.pb.h",
Myles Watson6c3a8ec2020-01-06 14:44:11 -0800406 "hci/facade/le_scanning_manager_facade.grpc.pb.h",
407 "hci/facade/le_scanning_manager_facade.pb.h",
Jack Heff38d892019-10-03 17:11:07 -0700408 "l2cap/classic/facade.grpc.pb.h",
409 "l2cap/classic/facade.pb.h",
Myles Watson9cc3ebe2020-01-03 15:20:33 -0800410 "neighbor/facade/facade.grpc.pb.h",
411 "neighbor/facade/facade.pb.h",
Martin Brabham7fd25ca2019-12-03 20:13:05 -0800412 "security/facade.grpc.pb.h",
413 "security/facade.pb.h",
Hansong Zhang29f99002019-04-24 17:25:42 +0000414 ],
415}
416
417genrule {
Zach Johnson34703602019-04-29 16:45:21 -0700418 name: "BluetoothFacadeGeneratedStub_cc",
Hansong Zhang29f99002019-04-24 17:25:42 +0000419 tools: [
420 "aprotoc",
421 "protoc-gen-grpc-cpp-plugin",
422 ],
423 cmd: "$(location aprotoc) -Isystem/bt/gd -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)",
424 srcs: [
Zach Johnson34703602019-04-29 16:45:21 -0700425 ":BluetoothFacadeProto",
Hansong Zhang29f99002019-04-24 17:25:42 +0000426 ],
427 out: [
Chienyuan4adb0422019-04-25 15:11:54 -0700428 "facade/common.grpc.pb.cc",
429 "facade/common.pb.cc",
Hansong Zhang30bf8692019-05-02 15:25:54 -0700430 "facade/rootservice.grpc.pb.cc",
431 "facade/rootservice.pb.cc",
Zach Johnson34703602019-04-29 16:45:21 -0700432 "hal/facade.grpc.pb.cc",
433 "hal/facade.pb.cc",
Myles Watson03ad00e2019-12-18 15:47:38 -0800434 "hci/facade/facade.grpc.pb.cc",
435 "hci/facade/facade.pb.cc",
Myles Watsonf94a56f2020-01-08 11:19:00 -0800436 "hci/facade/acl_manager_facade.grpc.pb.cc",
437 "hci/facade/acl_manager_facade.pb.cc",
Myles Watsonf43020d2020-01-09 13:41:22 -0800438 "hci/facade/controller_facade.grpc.pb.cc",
439 "hci/facade/controller_facade.pb.cc",
Myles Watson01695642020-01-14 14:33:09 -0800440 "hci/facade/le_acl_manager_facade.grpc.pb.cc",
441 "hci/facade/le_acl_manager_facade.pb.cc",
Jack Hecb6424b2019-11-27 11:29:59 -0800442 "hci/facade/le_advertising_manager_facade.grpc.pb.cc",
443 "hci/facade/le_advertising_manager_facade.pb.cc",
Myles Watson6c3a8ec2020-01-06 14:44:11 -0800444 "hci/facade/le_scanning_manager_facade.grpc.pb.cc",
445 "hci/facade/le_scanning_manager_facade.pb.cc",
Jack Heff38d892019-10-03 17:11:07 -0700446 "l2cap/classic/facade.grpc.pb.cc",
447 "l2cap/classic/facade.pb.cc",
Myles Watson9cc3ebe2020-01-03 15:20:33 -0800448 "neighbor/facade/facade.grpc.pb.cc",
449 "neighbor/facade/facade.pb.cc",
Martin Brabham7fd25ca2019-12-03 20:13:05 -0800450 "security/facade.grpc.pb.cc",
451 "security/facade.pb.cc",
Hansong Zhang29f99002019-04-24 17:25:42 +0000452 ],
453}
Zach Johnsonfacafb02019-04-22 16:34:49 -0700454
455genrule {
Hansong Zhang90ec7402019-04-29 16:04:07 -0700456 name: "BluetoothFacadeAndCertGeneratedStub_py",
Zach Johnsonfacafb02019-04-22 16:34:49 -0700457 tools: [
458 "aprotoc",
459 "protoc-gen-grpc-python-plugin",
Hansong Zhangb67ff022020-01-27 16:49:29 -0800460 "soong_zip",
Zach Johnsonfacafb02019-04-22 16:34:49 -0700461 ],
462 cmd: "$(location aprotoc) -Isystem/bt/gd -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-python-plugin) $(in) --grpc_out=$(genDir) --python_out=$(genDir); " +
Chienyuan4adb0422019-04-25 15:11:54 -0700463 "touch $(genDir)/facade/__init__.py; " +
Hansong Zhang90ec7402019-04-29 16:04:07 -0700464 "touch $(genDir)/hal/__init__.py; " +
Hansong Zhangc5ec8f92019-06-19 17:22:21 -0700465 "touch $(genDir)/hci/__init__.py; " +
Jack Hecb6424b2019-11-27 11:29:59 -0800466 "touch $(genDir)/hci/facade/__init__.py; " +
Jack Heff38d892019-10-03 17:11:07 -0700467 "touch $(genDir)/l2cap/classic/__init__.py; " +
Myles Watson9cc3ebe2020-01-03 15:20:33 -0800468 "touch $(genDir)/neighbor/facade/__init__.py; " +
Hansong Zhangb67ff022020-01-27 16:49:29 -0800469 "touch $(genDir)/security/__init__.py; " +
470 "$(location soong_zip) -C $(genDir) -D $(genDir) -o $(out)",
Zach Johnsonfacafb02019-04-22 16:34:49 -0700471 srcs: [
Zach Johnson34703602019-04-29 16:45:21 -0700472 ":BluetoothFacadeProto",
Zach Johnsonfacafb02019-04-22 16:34:49 -0700473 ],
Hansong Zhangb67ff022020-01-27 16:49:29 -0800474 out: ["bluetooth_cert_generated_py.zip"],
475 dist: {
476 targets: ["bluetooth_stack_with_facade"],
477 },
478
Hansong Zhang90ec7402019-04-29 16:04:07 -0700479}
480
Jack He9be1dcd2019-11-18 19:20:41 -0800481cc_defaults {
482 name: "bluetooth_py3_native_extension_defaults",
483 include_dirs: [
484 "external/python/cpython3/Include",
485 ],
486 target: {
487 android: {
488 include_dirs: ["external/python/cpython3/android/bionic/pyconfig"],
489 },
490 android_arm: {
491 cflags: ["-DSOABI=\"cpython-38android-arm-android-bionic\""],
492 suffix: ".cpython-38android-arm-android-bionic",
493 },
494 android_arm64: {
495 cflags: ["-DSOABI=\"cpython-38android-arm64-android-bionic\""],
496 suffix: ".cpython-38android-arm64-android-bionic",
497 },
498 android_x86: {
499 cflags: ["-DSOABI=\"cpython-38android-x86-android-bionic\""],
500 suffix: ".cpython-38android-x86-android-bionic",
501 },
502 android_x86_64: {
503 cflags: ["-DSOABI=\"cpython-38android-x86_64-android-bionic\""],
504 suffix: ".cpython-38android-x86_64-android-bionic",
505 },
506 // Regenerate include dirs with android_regen.sh
507 darwin_x86_64: {
508 include_dirs: ["external/python/cpython3/android/darwin_x86_64/pyconfig"],
509 cflags: [
510 "-Wno-deprecated-declarations",
511 "-Wno-pointer-arith",
512 "-DSOABI=\"cpython-38android-x86_64-darwin\"",
513 ],
514 suffix: ".cpython-38android-x86_64-darwin",
515 },
516 linux_bionic: {
517 // NB linux_bionic is a 'host' architecture but it uses the bionic libc like 'android'
518 // targets so use the android pyconfig.
519 include_dirs: ["external/python/cpython3/android/bionic/pyconfig"],
520 cflags: ["-DSOABI=\"cpython-38android-x86_64-linux-bionic\""],
521 suffix: ".cpython-38android-x86_64-linux-bionic",
522 },
523 linux_glibc_x86: {
524 enabled: false,
525 },
526 linux_glibc_x86_64: {
527 include_dirs: ["external/python/cpython3/android/linux_x86_64/pyconfig"],
528 cflags: ["-DSOABI=\"cpython-38android-x86_64-linux-gnu\""],
Jack He8768f572019-11-20 21:44:55 -0800529 // Commenting out the Linux suffix so that cpython-38-x86_64-linux-gnu
530 // Python 3.8 can also import the untagged .so library per PEP 3149
531 // Keep this change until Android py3-cmd can run ACTS, gRPC and can
532 // Export Python native symbols such as PyType_Type
533 // suffix: ".cpython-38android-x86_64-linux-gnu",
Jack He9be1dcd2019-11-18 19:20:41 -0800534 },
535 windows: {
536 enabled: false,
537 },
538 },
539 allow_undefined_symbols: true,
540}
541
Hansong Zhang5298d9f2020-01-21 16:03:53 -0800542cc_library_host_shared {
Jack He9be1dcd2019-11-18 19:20:41 -0800543 name: "bluetooth_packets_python3",
544 defaults: [
545 "gd_defaults",
546 "bluetooth_py3_native_extension_defaults"
547 ],
Jack He9be1dcd2019-11-18 19:20:41 -0800548 srcs: [
549 "packet/python3_module.cc",
550 "l2cap/fcs.cc",
551 ":BluetoothPacketSources",
Myles Watson5cded3a2019-12-13 17:50:12 -0800552 "hci/address.cc",
553 "hci/class_of_device.cc",
Jack He9be1dcd2019-11-18 19:20:41 -0800554 ],
555 generated_headers: [
556 "BluetoothGeneratedPackets_h",
557 ],
558 generated_sources: [
559 "BluetoothGeneratedPackets_python3_cc",
560 ],
561 header_libs: [
562 "pybind11_headers",
563 ],
564 cflags: [
565 "-fexceptions",
566 ],
567 rtti: true,
568}