Zach Johnson | 3a77003 | 2019-03-27 19:15:38 -0700 | [diff] [blame] | 1 | cc_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 Cross | 6208435 | 2019-05-23 14:12:59 -0700 | [diff] [blame] | 11 | "liblog", |
| 12 | ], |
Zach Johnson | 3a77003 | 2019-03-27 19:15:38 -0700 | [diff] [blame] | 13 | }, |
| 14 | host: { |
| 15 | cflags: [ |
| 16 | "-DOS_LINUX", |
| 17 | "-DOS_LINUX_GENERIC", |
Colin Cross | 6208435 | 2019-05-23 14:12:59 -0700 | [diff] [blame] | 18 | ], |
| 19 | }, |
Colin Cross | 3b06fff | 2019-05-23 14:10:48 -0700 | [diff] [blame] | 20 | darwin: { |
| 21 | enabled: false, |
| 22 | }, |
Zach Johnson | 3a77003 | 2019-03-27 19:15:38 -0700 | [diff] [blame] | 23 | }, |
| 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 Johnson | e0e158c | 2019-04-26 11:57:05 -0700 | [diff] [blame] | 30 | "-Wno-unused-parameter", |
Zach Johnson | e0e158c | 2019-04-26 11:57:05 -0700 | [diff] [blame] | 31 | "-Wno-unused-result", |
Zach Johnson | 3a77003 | 2019-03-27 19:15:38 -0700 | [diff] [blame] | 32 | ], |
| 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. |
| 44 | cc_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. |
| 62 | cc_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 | |
| 74 | cc_library { |
| 75 | name: "libbluetooth_gd", |
Hansong Zhang | a25f84d | 2019-03-19 16:17:42 -0700 | [diff] [blame] | 76 | defaults: [ |
Zach Johnson | 3a77003 | 2019-03-27 19:15:38 -0700 | [diff] [blame] | 77 | "gd_defaults", |
| 78 | "gd_clang_file_coverage", |
Hansong Zhang | a25f84d | 2019-03-19 16:17:42 -0700 | [diff] [blame] | 79 | ], |
| 80 | host_supported: true, |
Zach Johnson | 3a77003 | 2019-03-27 19:15:38 -0700 | [diff] [blame] | 81 | target: { |
| 82 | linux: { |
| 83 | srcs: [ |
| 84 | ":BluetoothOsSources_linux_generic", |
Hansong Zhang | 751a221 | 2019-03-29 14:27:05 -0700 | [diff] [blame] | 85 | ], |
| 86 | }, |
| 87 | host: { |
| 88 | srcs: [ |
| 89 | ":BluetoothHalSources_hci_rootcanal", |
| 90 | ], |
| 91 | }, |
Hansong Zhang | 904c022 | 2019-04-08 14:26:53 -0700 | [diff] [blame] | 92 | android: { |
| 93 | srcs: [ |
| 94 | ":BluetoothHalSources_hci_android_hidl", |
| 95 | ], |
| 96 | shared_libs: [ |
| 97 | "android.hardware.bluetooth@1.0", |
Hansong Zhang | 904c022 | 2019-04-08 14:26:53 -0700 | [diff] [blame] | 98 | "libhidlbase", |
Hansong Zhang | 904c022 | 2019-04-08 14:26:53 -0700 | [diff] [blame] | 99 | "libutils", |
| 100 | ], |
| 101 | }, |
Zach Johnson | 3a77003 | 2019-03-27 19:15:38 -0700 | [diff] [blame] | 102 | }, |
Myles Watson | 0ead597 | 2019-04-01 13:21:25 -0700 | [diff] [blame] | 103 | srcs: [ |
Hansong Zhang | 3fa05ab | 2019-04-09 08:55:27 -0700 | [diff] [blame] | 104 | "stack_manager.cc", |
Zach Johnson | 429c94b | 2019-04-25 22:24:54 -0700 | [diff] [blame] | 105 | "module.cc", |
Jakub Pawlowski | 3d6f404 | 2020-01-28 16:53:20 +0100 | [diff] [blame] | 106 | ":BluetoothAttSources", |
Myles Watson | 0ead597 | 2019-04-01 13:21:25 -0700 | [diff] [blame] | 107 | ":BluetoothCommonSources", |
Jakub Pawlowski | 5c70347 | 2019-05-22 17:36:24 +0200 | [diff] [blame] | 108 | ":BluetoothCryptoToolboxSources", |
Jack He | e066082 | 2019-04-22 11:45:26 -0700 | [diff] [blame] | 109 | ":BluetoothHalSources", |
Myles Watson | cf0bb8c | 2019-02-22 16:08:06 -0800 | [diff] [blame] | 110 | ":BluetoothHciSources", |
Jack He | fcb2bbf | 2019-07-31 15:44:05 -0700 | [diff] [blame] | 111 | ":BluetoothL2capSources", |
Chris Manton | af1058b | 2019-10-16 22:26:22 -0700 | [diff] [blame] | 112 | ":BluetoothNeighborSources", |
Myles Watson | 0ead597 | 2019-04-01 13:21:25 -0700 | [diff] [blame] | 113 | ":BluetoothPacketSources", |
Chris Manton | 1bb0e51 | 2019-09-09 21:11:59 -0700 | [diff] [blame] | 114 | ":BluetoothShimSources", |
Martin Brabham | a5be868 | 2019-10-18 13:59:24 -0700 | [diff] [blame] | 115 | ":BluetoothSecuritySources", |
Chris Manton | 4cb66bf | 2020-01-10 21:17:47 -0800 | [diff] [blame] | 116 | ":BluetoothStorageSources", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 117 | ], |
| 118 | generated_headers: [ |
| 119 | "BluetoothGeneratedPackets_h", |
| 120 | ], |
Hansong Zhang | aa0875c | 2019-06-06 21:44:55 -0700 | [diff] [blame] | 121 | shared_libs: [ |
| 122 | "libchrome", |
| 123 | ], |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 124 | } |
| 125 | |
| 126 | cc_binary { |
Hansong Zhang | 13ceb56 | 2019-09-25 12:12:59 -0700 | [diff] [blame] | 127 | name: "bluetooth_stack_with_facade", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 128 | defaults: [ |
| 129 | "gd_defaults", |
| 130 | ], |
| 131 | host_supported: true, |
| 132 | srcs: [ |
Zach Johnson | 4999504 | 2019-05-02 19:56:10 -0700 | [diff] [blame] | 133 | "facade/facade_main.cc", |
Hansong Zhang | 30bf869 | 2019-05-02 15:25:54 -0700 | [diff] [blame] | 134 | "facade/grpc_root_server.cc", |
Hansong Zhang | e0a997f | 2019-08-29 14:27:11 -0700 | [diff] [blame] | 135 | "facade/read_only_property_server.cc", |
Zach Johnson | e0e158c | 2019-04-26 11:57:05 -0700 | [diff] [blame] | 136 | "grpc/grpc_module.cc", |
Zach Johnson | 3470360 | 2019-04-29 16:45:21 -0700 | [diff] [blame] | 137 | ":BluetoothFacade_hci_hal", |
Hansong Zhang | c5ec8f9 | 2019-06-19 17:22:21 -0700 | [diff] [blame] | 138 | ":BluetoothFacade_hci_layer", |
Jack He | fcb2bbf | 2019-07-31 15:44:05 -0700 | [diff] [blame] | 139 | ":BluetoothFacade_l2cap_layer", |
Myles Watson | 9cc3ebe | 2020-01-03 15:20:33 -0800 | [diff] [blame] | 140 | ":BluetoothFacade_neighbor", |
Martin Brabham | 7fd25ca | 2019-12-03 20:13:05 -0800 | [diff] [blame] | 141 | ":BluetoothFacade_security_layer", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 142 | ], |
| 143 | generated_headers: [ |
| 144 | "BluetoothGeneratedPackets_h", |
Zach Johnson | 3470360 | 2019-04-29 16:45:21 -0700 | [diff] [blame] | 145 | "BluetoothFacadeGeneratedStub_h", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 146 | ], |
| 147 | generated_sources: [ |
Zach Johnson | 3470360 | 2019-04-29 16:45:21 -0700 | [diff] [blame] | 148 | "BluetoothFacadeGeneratedStub_cc", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 149 | ], |
| 150 | static_libs: [ |
| 151 | "libbluetooth_gd", |
| 152 | ], |
| 153 | shared_libs: [ |
Hansong Zhang | aa0875c | 2019-06-06 21:44:55 -0700 | [diff] [blame] | 154 | "libchrome", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 155 | "libgrpc++_unsecure", |
| 156 | "libprotobuf-cpp-full", |
| 157 | ], |
| 158 | target: { |
| 159 | android: { |
| 160 | shared_libs: [ |
| 161 | "android.hardware.bluetooth@1.0", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 162 | "libhidlbase", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 163 | "libutils", |
| 164 | ], |
| 165 | }, |
Dan Willemsen | 3fc06a4 | 2020-02-05 14:19:17 -0800 | [diff] [blame] | 166 | host: { |
| 167 | required: [ |
| 168 | "root-canal", |
| 169 | ], |
| 170 | }, |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 171 | }, |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 172 | sanitize: { |
| 173 | address: true, |
| 174 | }, |
| 175 | } |
| 176 | |
| 177 | cc_test { |
Zach Johnson | 3a77003 | 2019-03-27 19:15:38 -0700 | [diff] [blame] | 178 | name: "bluetooth_test_gd", |
Hansong Zhang | a25f84d | 2019-03-19 16:17:42 -0700 | [diff] [blame] | 179 | test_suites: ["device-tests"], |
| 180 | defaults: [ |
Zach Johnson | 3a77003 | 2019-03-27 19:15:38 -0700 | [diff] [blame] | 181 | "gd_defaults", |
| 182 | "gd_clang_coverage_bin", |
Hansong Zhang | a25f84d | 2019-03-19 16:17:42 -0700 | [diff] [blame] | 183 | ], |
| 184 | host_supported: true, |
Zach Johnson | 3a77003 | 2019-03-27 19:15:38 -0700 | [diff] [blame] | 185 | target: { |
| 186 | linux: { |
| 187 | srcs: [ |
| 188 | ":BluetoothOsTestSources_linux_generic", |
Hansong Zhang | 751a221 | 2019-03-29 14:27:05 -0700 | [diff] [blame] | 189 | ], |
| 190 | }, |
| 191 | host: { |
| 192 | srcs: [ |
| 193 | ":BluetoothHalTestSources_hci_rootcanal", |
| 194 | ], |
| 195 | }, |
Hansong Zhang | 904c022 | 2019-04-08 14:26:53 -0700 | [diff] [blame] | 196 | android: { |
| 197 | srcs: [ |
| 198 | ":BluetoothHalTestSources_hci_android_hidl", |
| 199 | ], |
| 200 | shared_libs: [ |
| 201 | "android.hardware.bluetooth@1.0", |
Hansong Zhang | 904c022 | 2019-04-08 14:26:53 -0700 | [diff] [blame] | 202 | "libhidlbase", |
Hansong Zhang | 904c022 | 2019-04-08 14:26:53 -0700 | [diff] [blame] | 203 | "libutils", |
| 204 | ], |
| 205 | }, |
Zach Johnson | 3a77003 | 2019-03-27 19:15:38 -0700 | [diff] [blame] | 206 | }, |
Myles Watson | 0ead597 | 2019-04-01 13:21:25 -0700 | [diff] [blame] | 207 | srcs: [ |
Zach Johnson | 429c94b | 2019-04-25 22:24:54 -0700 | [diff] [blame] | 208 | "module_unittest.cc", |
Hansong Zhang | 0bce6f7 | 2019-06-13 18:31:40 -0700 | [diff] [blame] | 209 | "stack_manager_unittest.cc", |
Jakub Pawlowski | 3d6f404 | 2020-01-28 16:53:20 +0100 | [diff] [blame] | 210 | ":BluetoothAttTestSources", |
Myles Watson | 0ead597 | 2019-04-01 13:21:25 -0700 | [diff] [blame] | 211 | ":BluetoothCommonTestSources", |
Jakub Pawlowski | 5c70347 | 2019-05-22 17:36:24 +0200 | [diff] [blame] | 212 | ":BluetoothCryptoToolboxTestSources", |
Myles Watson | cc57c6b | 2019-03-25 15:24:43 -0700 | [diff] [blame] | 213 | ":BluetoothHciTestSources", |
Myles Watson | a4cd53c | 2019-03-25 15:25:08 -0700 | [diff] [blame] | 214 | ":BluetoothL2capTestSources", |
Chris Manton | af1058b | 2019-10-16 22:26:22 -0700 | [diff] [blame] | 215 | ":BluetoothNeighborTestSources", |
Myles Watson | 0ead597 | 2019-04-01 13:21:25 -0700 | [diff] [blame] | 216 | ":BluetoothPacketTestSources", |
Martin Brabham | a5be868 | 2019-10-18 13:59:24 -0700 | [diff] [blame] | 217 | ":BluetoothSecurityTestSources", |
Chris Manton | ee8c0a9 | 2019-10-17 10:56:37 -0700 | [diff] [blame] | 218 | ":BluetoothShimTestSources", |
Chris Manton | 4cb66bf | 2020-01-10 21:17:47 -0800 | [diff] [blame] | 219 | ":BluetoothStorageTestSources", |
Myles Watson | 0ead597 | 2019-04-01 13:21:25 -0700 | [diff] [blame] | 220 | ], |
Colin Cross | 6208435 | 2019-05-23 14:12:59 -0700 | [diff] [blame] | 221 | generated_headers: [ |
Hansong Zhang | 05c079b | 2019-04-04 13:24:43 -0700 | [diff] [blame] | 222 | "BluetoothGeneratedPackets_h", |
Myles Watson | cc57c6b | 2019-03-25 15:24:43 -0700 | [diff] [blame] | 223 | ], |
Colin Cross | 6208435 | 2019-05-23 14:12:59 -0700 | [diff] [blame] | 224 | static_libs: [ |
Zach Johnson | 3a77003 | 2019-03-27 19:15:38 -0700 | [diff] [blame] | 225 | "libbluetooth_gd", |
Hansong Zhang | cf49fa9 | 2019-05-06 17:54:51 -0700 | [diff] [blame] | 226 | "libgmock", |
Hansong Zhang | a25f84d | 2019-03-19 16:17:42 -0700 | [diff] [blame] | 227 | ], |
Hansong Zhang | aa0875c | 2019-06-06 21:44:55 -0700 | [diff] [blame] | 228 | shared_libs: [ |
| 229 | "libchrome", |
| 230 | ], |
Hansong Zhang | a25f84d | 2019-03-19 16:17:42 -0700 | [diff] [blame] | 231 | sanitize: { |
Chienyuan | 2d7f3b7 | 2019-03-29 17:33:41 -0700 | [diff] [blame] | 232 | address: true, |
Hansong Zhang | a25f84d | 2019-03-19 16:17:42 -0700 | [diff] [blame] | 233 | }, |
| 234 | } |
Jack He | f4e2471 | 2019-04-01 16:20:14 -0700 | [diff] [blame] | 235 | |
Ajay Panicker | 4d6b760 | 2019-02-06 14:02:36 -0800 | [diff] [blame] | 236 | cc_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 Cross | 6208435 | 2019-05-23 14:12:59 -0700 | [diff] [blame] | 248 | generated_headers: [ |
Ajay Panicker | 4d6b760 | 2019-02-06 14:02:36 -0800 | [diff] [blame] | 249 | "BluetoothPacketParserTestPacketPdlGen_h", |
| 250 | ], |
| 251 | sanitize: { |
| 252 | address: true, |
| 253 | cfi: true, |
| 254 | }, |
| 255 | } |
| 256 | |
Zongheng Wang | 627ba81 | 2019-10-16 16:39:11 -0700 | [diff] [blame] | 257 | cc_fuzz { |
| 258 | name: "bluetooth_gd_fuzz_test", |
| 259 | defaults: ["gd_defaults"], |
| 260 | srcs: [ |
| 261 | "fuzz_test.cc", |
Jack He | e0cd4da | 2019-10-22 15:57:10 -0700 | [diff] [blame] | 262 | ":BluetoothHciFuzzTestSources", |
Zongheng Wang | 627ba81 | 2019-10-16 16:39:11 -0700 | [diff] [blame] | 263 | ":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 He | f4e2471 | 2019-04-01 16:20:14 -0700 | [diff] [blame] | 286 | cc_benchmark { |
| 287 | name: "bluetooth_benchmark_gd", |
| 288 | defaults: ["gd_defaults"], |
| 289 | host_supported: true, |
| 290 | srcs: [ |
| 291 | "benchmark.cc", |
| 292 | ":BluetoothOsBenchmarkSources", |
| 293 | ], |
Colin Cross | 6208435 | 2019-05-23 14:12:59 -0700 | [diff] [blame] | 294 | static_libs: [ |
Hansong Zhang | 05c079b | 2019-04-04 13:24:43 -0700 | [diff] [blame] | 295 | "libbluetooth_gd", |
| 296 | ], |
Hansong Zhang | aa0875c | 2019-06-06 21:44:55 -0700 | [diff] [blame] | 297 | shared_libs: [ |
| 298 | "libchrome", |
| 299 | ], |
Hansong Zhang | 05c079b | 2019-04-04 13:24:43 -0700 | [diff] [blame] | 300 | } |
| 301 | |
Chienyuan | 3d8a803 | 2019-11-01 18:04:07 +0800 | [diff] [blame] | 302 | filegroup { |
| 303 | name: "BluetoothHciClassSources", |
| 304 | srcs: [ |
| 305 | "hci/address.cc", |
| 306 | "hci/class_of_device.cc", |
| 307 | ], |
| 308 | } |
| 309 | |
Hansong Zhang | 05c079b | 2019-04-04 13:24:43 -0700 | [diff] [blame] | 310 | genrule { |
| 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 Pawlowski | e79714e | 2019-10-14 14:49:55 +0200 | [diff] [blame] | 319 | "security/smp_packets.pdl", |
Hansong Zhang | 05c079b | 2019-04-04 13:24:43 -0700 | [diff] [blame] | 320 | ], |
| 321 | out: [ |
| 322 | "hci/hci_packets.h", |
| 323 | "l2cap/l2cap_packets.h", |
Jakub Pawlowski | e79714e | 2019-10-14 14:49:55 +0200 | [diff] [blame] | 324 | "security/smp_packets.h", |
Jack He | f4e2471 | 2019-04-01 16:20:14 -0700 | [diff] [blame] | 325 | ], |
| 326 | } |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 327 | |
Jack He | 9be1dcd | 2019-11-18 19:20:41 -0800 | [diff] [blame] | 328 | genrule { |
| 329 | name: "BluetoothGeneratedPackets_python3_cc", |
| 330 | tools: [ |
| 331 | "bluetooth_packetgen", |
| 332 | ], |
Jack He | f2d1460 | 2019-11-20 17:24:16 -0800 | [diff] [blame] | 333 | cmd: "$(location bluetooth_packetgen) --include=system/bt/gd --out=$(genDir) --num_shards=5 $(in)", |
Jack He | 9be1dcd | 2019-11-18 19:20:41 -0800 | [diff] [blame] | 334 | 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 He | f2d1460 | 2019-11-20 17:24:16 -0800 | [diff] [blame] | 341 | "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 He | 9be1dcd | 2019-11-18 19:20:41 -0800 | [diff] [blame] | 346 | "l2cap/l2cap_packets_python3.cc", |
Jack He | f2d1460 | 2019-11-20 17:24:16 -0800 | [diff] [blame] | 347 | "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 He | 9be1dcd | 2019-11-18 19:20:41 -0800 | [diff] [blame] | 352 | "security/smp_packets_python3.cc", |
Jack He | f2d1460 | 2019-11-20 17:24:16 -0800 | [diff] [blame] | 353 | "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 He | 9be1dcd | 2019-11-18 19:20:41 -0800 | [diff] [blame] | 358 | ], |
| 359 | } |
| 360 | |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 361 | filegroup { |
Zach Johnson | 3470360 | 2019-04-29 16:45:21 -0700 | [diff] [blame] | 362 | name: "BluetoothFacadeProto", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 363 | srcs: [ |
Chienyuan | 4adb042 | 2019-04-25 15:11:54 -0700 | [diff] [blame] | 364 | "facade/common.proto", |
Hansong Zhang | 30bf869 | 2019-05-02 15:25:54 -0700 | [diff] [blame] | 365 | "facade/rootservice.proto", |
Zach Johnson | 3470360 | 2019-04-29 16:45:21 -0700 | [diff] [blame] | 366 | "hal/facade.proto", |
Myles Watson | 03ad00e | 2019-12-18 15:47:38 -0800 | [diff] [blame] | 367 | "hci/facade/facade.proto", |
Myles Watson | f94a56f | 2020-01-08 11:19:00 -0800 | [diff] [blame] | 368 | "hci/facade/acl_manager_facade.proto", |
Myles Watson | f43020d | 2020-01-09 13:41:22 -0800 | [diff] [blame] | 369 | "hci/facade/controller_facade.proto", |
Myles Watson | 0169564 | 2020-01-14 14:33:09 -0800 | [diff] [blame] | 370 | "hci/facade/le_acl_manager_facade.proto", |
Jack He | cb6424b | 2019-11-27 11:29:59 -0800 | [diff] [blame] | 371 | "hci/facade/le_advertising_manager_facade.proto", |
Myles Watson | 6c3a8ec | 2020-01-06 14:44:11 -0800 | [diff] [blame] | 372 | "hci/facade/le_scanning_manager_facade.proto", |
Myles Watson | 9cc3ebe | 2020-01-03 15:20:33 -0800 | [diff] [blame] | 373 | "neighbor/facade/facade.proto", |
Jack He | ff38d89 | 2019-10-03 17:11:07 -0700 | [diff] [blame] | 374 | "l2cap/classic/facade.proto", |
Martin Brabham | 7fd25ca | 2019-12-03 20:13:05 -0800 | [diff] [blame] | 375 | "security/facade.proto", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 376 | ], |
| 377 | } |
| 378 | |
| 379 | genrule { |
Zach Johnson | 3470360 | 2019-04-29 16:45:21 -0700 | [diff] [blame] | 380 | name: "BluetoothFacadeGeneratedStub_h", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 381 | 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 Johnson | 3470360 | 2019-04-29 16:45:21 -0700 | [diff] [blame] | 387 | ":BluetoothFacadeProto", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 388 | ], |
| 389 | out: [ |
Chienyuan | 4adb042 | 2019-04-25 15:11:54 -0700 | [diff] [blame] | 390 | "facade/common.grpc.pb.h", |
| 391 | "facade/common.pb.h", |
Hansong Zhang | 30bf869 | 2019-05-02 15:25:54 -0700 | [diff] [blame] | 392 | "facade/rootservice.grpc.pb.h", |
| 393 | "facade/rootservice.pb.h", |
Zach Johnson | 3470360 | 2019-04-29 16:45:21 -0700 | [diff] [blame] | 394 | "hal/facade.grpc.pb.h", |
| 395 | "hal/facade.pb.h", |
Myles Watson | 03ad00e | 2019-12-18 15:47:38 -0800 | [diff] [blame] | 396 | "hci/facade/facade.grpc.pb.h", |
| 397 | "hci/facade/facade.pb.h", |
Myles Watson | f94a56f | 2020-01-08 11:19:00 -0800 | [diff] [blame] | 398 | "hci/facade/acl_manager_facade.grpc.pb.h", |
| 399 | "hci/facade/acl_manager_facade.pb.h", |
Myles Watson | f43020d | 2020-01-09 13:41:22 -0800 | [diff] [blame] | 400 | "hci/facade/controller_facade.grpc.pb.h", |
| 401 | "hci/facade/controller_facade.pb.h", |
Myles Watson | 0169564 | 2020-01-14 14:33:09 -0800 | [diff] [blame] | 402 | "hci/facade/le_acl_manager_facade.grpc.pb.h", |
| 403 | "hci/facade/le_acl_manager_facade.pb.h", |
Jack He | cb6424b | 2019-11-27 11:29:59 -0800 | [diff] [blame] | 404 | "hci/facade/le_advertising_manager_facade.grpc.pb.h", |
| 405 | "hci/facade/le_advertising_manager_facade.pb.h", |
Myles Watson | 6c3a8ec | 2020-01-06 14:44:11 -0800 | [diff] [blame] | 406 | "hci/facade/le_scanning_manager_facade.grpc.pb.h", |
| 407 | "hci/facade/le_scanning_manager_facade.pb.h", |
Jack He | ff38d89 | 2019-10-03 17:11:07 -0700 | [diff] [blame] | 408 | "l2cap/classic/facade.grpc.pb.h", |
| 409 | "l2cap/classic/facade.pb.h", |
Myles Watson | 9cc3ebe | 2020-01-03 15:20:33 -0800 | [diff] [blame] | 410 | "neighbor/facade/facade.grpc.pb.h", |
| 411 | "neighbor/facade/facade.pb.h", |
Martin Brabham | 7fd25ca | 2019-12-03 20:13:05 -0800 | [diff] [blame] | 412 | "security/facade.grpc.pb.h", |
| 413 | "security/facade.pb.h", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 414 | ], |
| 415 | } |
| 416 | |
| 417 | genrule { |
Zach Johnson | 3470360 | 2019-04-29 16:45:21 -0700 | [diff] [blame] | 418 | name: "BluetoothFacadeGeneratedStub_cc", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 419 | 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 Johnson | 3470360 | 2019-04-29 16:45:21 -0700 | [diff] [blame] | 425 | ":BluetoothFacadeProto", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 426 | ], |
| 427 | out: [ |
Chienyuan | 4adb042 | 2019-04-25 15:11:54 -0700 | [diff] [blame] | 428 | "facade/common.grpc.pb.cc", |
| 429 | "facade/common.pb.cc", |
Hansong Zhang | 30bf869 | 2019-05-02 15:25:54 -0700 | [diff] [blame] | 430 | "facade/rootservice.grpc.pb.cc", |
| 431 | "facade/rootservice.pb.cc", |
Zach Johnson | 3470360 | 2019-04-29 16:45:21 -0700 | [diff] [blame] | 432 | "hal/facade.grpc.pb.cc", |
| 433 | "hal/facade.pb.cc", |
Myles Watson | 03ad00e | 2019-12-18 15:47:38 -0800 | [diff] [blame] | 434 | "hci/facade/facade.grpc.pb.cc", |
| 435 | "hci/facade/facade.pb.cc", |
Myles Watson | f94a56f | 2020-01-08 11:19:00 -0800 | [diff] [blame] | 436 | "hci/facade/acl_manager_facade.grpc.pb.cc", |
| 437 | "hci/facade/acl_manager_facade.pb.cc", |
Myles Watson | f43020d | 2020-01-09 13:41:22 -0800 | [diff] [blame] | 438 | "hci/facade/controller_facade.grpc.pb.cc", |
| 439 | "hci/facade/controller_facade.pb.cc", |
Myles Watson | 0169564 | 2020-01-14 14:33:09 -0800 | [diff] [blame] | 440 | "hci/facade/le_acl_manager_facade.grpc.pb.cc", |
| 441 | "hci/facade/le_acl_manager_facade.pb.cc", |
Jack He | cb6424b | 2019-11-27 11:29:59 -0800 | [diff] [blame] | 442 | "hci/facade/le_advertising_manager_facade.grpc.pb.cc", |
| 443 | "hci/facade/le_advertising_manager_facade.pb.cc", |
Myles Watson | 6c3a8ec | 2020-01-06 14:44:11 -0800 | [diff] [blame] | 444 | "hci/facade/le_scanning_manager_facade.grpc.pb.cc", |
| 445 | "hci/facade/le_scanning_manager_facade.pb.cc", |
Jack He | ff38d89 | 2019-10-03 17:11:07 -0700 | [diff] [blame] | 446 | "l2cap/classic/facade.grpc.pb.cc", |
| 447 | "l2cap/classic/facade.pb.cc", |
Myles Watson | 9cc3ebe | 2020-01-03 15:20:33 -0800 | [diff] [blame] | 448 | "neighbor/facade/facade.grpc.pb.cc", |
| 449 | "neighbor/facade/facade.pb.cc", |
Martin Brabham | 7fd25ca | 2019-12-03 20:13:05 -0800 | [diff] [blame] | 450 | "security/facade.grpc.pb.cc", |
| 451 | "security/facade.pb.cc", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 452 | ], |
| 453 | } |
Zach Johnson | facafb0 | 2019-04-22 16:34:49 -0700 | [diff] [blame] | 454 | |
| 455 | genrule { |
Hansong Zhang | 90ec740 | 2019-04-29 16:04:07 -0700 | [diff] [blame] | 456 | name: "BluetoothFacadeAndCertGeneratedStub_py", |
Zach Johnson | facafb0 | 2019-04-22 16:34:49 -0700 | [diff] [blame] | 457 | tools: [ |
| 458 | "aprotoc", |
| 459 | "protoc-gen-grpc-python-plugin", |
Hansong Zhang | b67ff02 | 2020-01-27 16:49:29 -0800 | [diff] [blame] | 460 | "soong_zip", |
Zach Johnson | facafb0 | 2019-04-22 16:34:49 -0700 | [diff] [blame] | 461 | ], |
| 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); " + |
Chienyuan | 4adb042 | 2019-04-25 15:11:54 -0700 | [diff] [blame] | 463 | "touch $(genDir)/facade/__init__.py; " + |
Hansong Zhang | 90ec740 | 2019-04-29 16:04:07 -0700 | [diff] [blame] | 464 | "touch $(genDir)/hal/__init__.py; " + |
Hansong Zhang | c5ec8f9 | 2019-06-19 17:22:21 -0700 | [diff] [blame] | 465 | "touch $(genDir)/hci/__init__.py; " + |
Jack He | cb6424b | 2019-11-27 11:29:59 -0800 | [diff] [blame] | 466 | "touch $(genDir)/hci/facade/__init__.py; " + |
Jack He | ff38d89 | 2019-10-03 17:11:07 -0700 | [diff] [blame] | 467 | "touch $(genDir)/l2cap/classic/__init__.py; " + |
Myles Watson | 9cc3ebe | 2020-01-03 15:20:33 -0800 | [diff] [blame] | 468 | "touch $(genDir)/neighbor/facade/__init__.py; " + |
Hansong Zhang | b67ff02 | 2020-01-27 16:49:29 -0800 | [diff] [blame] | 469 | "touch $(genDir)/security/__init__.py; " + |
| 470 | "$(location soong_zip) -C $(genDir) -D $(genDir) -o $(out)", |
Zach Johnson | facafb0 | 2019-04-22 16:34:49 -0700 | [diff] [blame] | 471 | srcs: [ |
Zach Johnson | 3470360 | 2019-04-29 16:45:21 -0700 | [diff] [blame] | 472 | ":BluetoothFacadeProto", |
Zach Johnson | facafb0 | 2019-04-22 16:34:49 -0700 | [diff] [blame] | 473 | ], |
Hansong Zhang | b67ff02 | 2020-01-27 16:49:29 -0800 | [diff] [blame] | 474 | out: ["bluetooth_cert_generated_py.zip"], |
| 475 | dist: { |
| 476 | targets: ["bluetooth_stack_with_facade"], |
| 477 | }, |
| 478 | |
Hansong Zhang | 90ec740 | 2019-04-29 16:04:07 -0700 | [diff] [blame] | 479 | } |
| 480 | |
Jack He | 9be1dcd | 2019-11-18 19:20:41 -0800 | [diff] [blame] | 481 | cc_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 He | 8768f57 | 2019-11-20 21:44:55 -0800 | [diff] [blame] | 529 | // 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 He | 9be1dcd | 2019-11-18 19:20:41 -0800 | [diff] [blame] | 534 | }, |
| 535 | windows: { |
| 536 | enabled: false, |
| 537 | }, |
| 538 | }, |
| 539 | allow_undefined_symbols: true, |
| 540 | } |
| 541 | |
Hansong Zhang | 5298d9f | 2020-01-21 16:03:53 -0800 | [diff] [blame] | 542 | cc_library_host_shared { |
Jack He | 9be1dcd | 2019-11-18 19:20:41 -0800 | [diff] [blame] | 543 | name: "bluetooth_packets_python3", |
| 544 | defaults: [ |
| 545 | "gd_defaults", |
| 546 | "bluetooth_py3_native_extension_defaults" |
| 547 | ], |
Jack He | 9be1dcd | 2019-11-18 19:20:41 -0800 | [diff] [blame] | 548 | srcs: [ |
| 549 | "packet/python3_module.cc", |
| 550 | "l2cap/fcs.cc", |
| 551 | ":BluetoothPacketSources", |
Myles Watson | 5cded3a | 2019-12-13 17:50:12 -0800 | [diff] [blame] | 552 | "hci/address.cc", |
| 553 | "hci/class_of_device.cc", |
Jack He | 9be1dcd | 2019-11-18 19:20:41 -0800 | [diff] [blame] | 554 | ], |
| 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 | } |