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", |
Myles Watson | 0ead597 | 2019-04-01 13:21:25 -0700 | [diff] [blame] | 106 | ":BluetoothCommonSources", |
Jakub Pawlowski | 5c70347 | 2019-05-22 17:36:24 +0200 | [diff] [blame] | 107 | ":BluetoothCryptoToolboxSources", |
Jack He | e066082 | 2019-04-22 11:45:26 -0700 | [diff] [blame] | 108 | ":BluetoothHalSources", |
Myles Watson | cf0bb8c | 2019-02-22 16:08:06 -0800 | [diff] [blame] | 109 | ":BluetoothHciSources", |
Jack He | fcb2bbf | 2019-07-31 15:44:05 -0700 | [diff] [blame] | 110 | ":BluetoothL2capSources", |
Chris Manton | af1058b | 2019-10-16 22:26:22 -0700 | [diff] [blame] | 111 | ":BluetoothNeighborSources", |
Myles Watson | 0ead597 | 2019-04-01 13:21:25 -0700 | [diff] [blame] | 112 | ":BluetoothPacketSources", |
Chris Manton | 1bb0e51 | 2019-09-09 21:11:59 -0700 | [diff] [blame] | 113 | ":BluetoothShimSources", |
Martin Brabham | a5be868 | 2019-10-18 13:59:24 -0700 | [diff] [blame] | 114 | ":BluetoothSecuritySources", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 115 | ], |
| 116 | generated_headers: [ |
| 117 | "BluetoothGeneratedPackets_h", |
| 118 | ], |
Hansong Zhang | aa0875c | 2019-06-06 21:44:55 -0700 | [diff] [blame] | 119 | shared_libs: [ |
| 120 | "libchrome", |
| 121 | ], |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 122 | } |
| 123 | |
| 124 | cc_binary { |
Hansong Zhang | 13ceb56 | 2019-09-25 12:12:59 -0700 | [diff] [blame] | 125 | name: "bluetooth_stack_with_facade", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 126 | defaults: [ |
| 127 | "gd_defaults", |
| 128 | ], |
| 129 | host_supported: true, |
| 130 | srcs: [ |
Zach Johnson | 4999504 | 2019-05-02 19:56:10 -0700 | [diff] [blame] | 131 | "facade/facade_main.cc", |
Hansong Zhang | 30bf869 | 2019-05-02 15:25:54 -0700 | [diff] [blame] | 132 | "facade/grpc_root_server.cc", |
Hansong Zhang | e0a997f | 2019-08-29 14:27:11 -0700 | [diff] [blame] | 133 | "facade/read_only_property_server.cc", |
Zach Johnson | e0e158c | 2019-04-26 11:57:05 -0700 | [diff] [blame] | 134 | "grpc/grpc_module.cc", |
Zach Johnson | 3470360 | 2019-04-29 16:45:21 -0700 | [diff] [blame] | 135 | ":BluetoothFacade_hci_hal", |
Hansong Zhang | c5ec8f9 | 2019-06-19 17:22:21 -0700 | [diff] [blame] | 136 | ":BluetoothFacade_hci_layer", |
Jack He | fcb2bbf | 2019-07-31 15:44:05 -0700 | [diff] [blame] | 137 | ":BluetoothFacade_l2cap_layer", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 138 | ], |
| 139 | generated_headers: [ |
| 140 | "BluetoothGeneratedPackets_h", |
Zach Johnson | 3470360 | 2019-04-29 16:45:21 -0700 | [diff] [blame] | 141 | "BluetoothFacadeGeneratedStub_h", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 142 | ], |
| 143 | generated_sources: [ |
Zach Johnson | 3470360 | 2019-04-29 16:45:21 -0700 | [diff] [blame] | 144 | "BluetoothFacadeGeneratedStub_cc", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 145 | ], |
| 146 | static_libs: [ |
| 147 | "libbluetooth_gd", |
| 148 | ], |
| 149 | shared_libs: [ |
Hansong Zhang | aa0875c | 2019-06-06 21:44:55 -0700 | [diff] [blame] | 150 | "libchrome", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 151 | "libgrpc++_unsecure", |
| 152 | "libprotobuf-cpp-full", |
| 153 | ], |
| 154 | target: { |
| 155 | android: { |
| 156 | shared_libs: [ |
| 157 | "android.hardware.bluetooth@1.0", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 158 | "libhidlbase", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 159 | "libutils", |
| 160 | ], |
| 161 | }, |
| 162 | }, |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 163 | sanitize: { |
| 164 | address: true, |
| 165 | }, |
| 166 | } |
| 167 | |
Hansong Zhang | 90ec740 | 2019-04-29 16:04:07 -0700 | [diff] [blame] | 168 | cc_binary { |
| 169 | name: "bluetooth_cert_stack", |
| 170 | defaults: [ |
| 171 | "gd_defaults", |
| 172 | ], |
| 173 | host_supported: true, |
| 174 | srcs: [ |
Zach Johnson | 4999504 | 2019-05-02 19:56:10 -0700 | [diff] [blame] | 175 | "cert/cert_main.cc", |
Hansong Zhang | 30bf869 | 2019-05-02 15:25:54 -0700 | [diff] [blame] | 176 | "cert/grpc_root_server.cc", |
Hansong Zhang | e0a997f | 2019-08-29 14:27:11 -0700 | [diff] [blame] | 177 | "cert/read_only_property_server.cc", |
Hansong Zhang | 90ec740 | 2019-04-29 16:04:07 -0700 | [diff] [blame] | 178 | "grpc/grpc_module.cc", |
| 179 | ":BluetoothCertSource_hci_hal", |
Hansong Zhang | c5ec8f9 | 2019-06-19 17:22:21 -0700 | [diff] [blame] | 180 | ":BluetoothCertSource_hci_layer", |
Jack He | fcb2bbf | 2019-07-31 15:44:05 -0700 | [diff] [blame] | 181 | ":BluetoothCertSource_l2cap_layer", |
Hansong Zhang | 90ec740 | 2019-04-29 16:04:07 -0700 | [diff] [blame] | 182 | ], |
| 183 | generated_headers: [ |
| 184 | "BluetoothGeneratedPackets_h", |
| 185 | "BluetoothCertStackGeneratedStub_h", |
| 186 | ], |
| 187 | generated_sources: [ |
| 188 | "BluetoothCertStackGeneratedStub_cc", |
| 189 | ], |
| 190 | static_libs: [ |
| 191 | "libbluetooth_gd", |
| 192 | ], |
| 193 | shared_libs: [ |
Hansong Zhang | aa0875c | 2019-06-06 21:44:55 -0700 | [diff] [blame] | 194 | "libchrome", |
Hansong Zhang | 90ec740 | 2019-04-29 16:04:07 -0700 | [diff] [blame] | 195 | "libgrpc++_unsecure", |
| 196 | "libprotobuf-cpp-full", |
| 197 | ], |
| 198 | target: { |
| 199 | android: { |
| 200 | shared_libs: [ |
| 201 | "android.hardware.bluetooth@1.0", |
Hansong Zhang | 90ec740 | 2019-04-29 16:04:07 -0700 | [diff] [blame] | 202 | "libhidlbase", |
Hansong Zhang | 90ec740 | 2019-04-29 16:04:07 -0700 | [diff] [blame] | 203 | "libutils", |
| 204 | ], |
| 205 | }, |
| 206 | }, |
| 207 | sanitize: { |
| 208 | address: true, |
| 209 | }, |
| 210 | } |
| 211 | |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 212 | cc_test { |
Zach Johnson | 3a77003 | 2019-03-27 19:15:38 -0700 | [diff] [blame] | 213 | name: "bluetooth_test_gd", |
Hansong Zhang | a25f84d | 2019-03-19 16:17:42 -0700 | [diff] [blame] | 214 | test_suites: ["device-tests"], |
| 215 | defaults: [ |
Zach Johnson | 3a77003 | 2019-03-27 19:15:38 -0700 | [diff] [blame] | 216 | "gd_defaults", |
| 217 | "gd_clang_coverage_bin", |
Hansong Zhang | a25f84d | 2019-03-19 16:17:42 -0700 | [diff] [blame] | 218 | ], |
| 219 | host_supported: true, |
Zach Johnson | 3a77003 | 2019-03-27 19:15:38 -0700 | [diff] [blame] | 220 | target: { |
| 221 | linux: { |
| 222 | srcs: [ |
| 223 | ":BluetoothOsTestSources_linux_generic", |
Hansong Zhang | 751a221 | 2019-03-29 14:27:05 -0700 | [diff] [blame] | 224 | ], |
| 225 | }, |
| 226 | host: { |
| 227 | srcs: [ |
| 228 | ":BluetoothHalTestSources_hci_rootcanal", |
| 229 | ], |
| 230 | }, |
Hansong Zhang | 904c022 | 2019-04-08 14:26:53 -0700 | [diff] [blame] | 231 | android: { |
| 232 | srcs: [ |
| 233 | ":BluetoothHalTestSources_hci_android_hidl", |
| 234 | ], |
| 235 | shared_libs: [ |
| 236 | "android.hardware.bluetooth@1.0", |
Hansong Zhang | 904c022 | 2019-04-08 14:26:53 -0700 | [diff] [blame] | 237 | "libhidlbase", |
Hansong Zhang | 904c022 | 2019-04-08 14:26:53 -0700 | [diff] [blame] | 238 | "libutils", |
| 239 | ], |
| 240 | }, |
Zach Johnson | 3a77003 | 2019-03-27 19:15:38 -0700 | [diff] [blame] | 241 | }, |
Myles Watson | 0ead597 | 2019-04-01 13:21:25 -0700 | [diff] [blame] | 242 | srcs: [ |
Zach Johnson | 429c94b | 2019-04-25 22:24:54 -0700 | [diff] [blame] | 243 | "module_unittest.cc", |
Hansong Zhang | 0bce6f7 | 2019-06-13 18:31:40 -0700 | [diff] [blame] | 244 | "stack_manager_unittest.cc", |
Myles Watson | 0ead597 | 2019-04-01 13:21:25 -0700 | [diff] [blame] | 245 | ":BluetoothCommonTestSources", |
Jakub Pawlowski | 5c70347 | 2019-05-22 17:36:24 +0200 | [diff] [blame] | 246 | ":BluetoothCryptoToolboxTestSources", |
Myles Watson | cc57c6b | 2019-03-25 15:24:43 -0700 | [diff] [blame] | 247 | ":BluetoothHciTestSources", |
Myles Watson | a4cd53c | 2019-03-25 15:25:08 -0700 | [diff] [blame] | 248 | ":BluetoothL2capTestSources", |
Chris Manton | af1058b | 2019-10-16 22:26:22 -0700 | [diff] [blame] | 249 | ":BluetoothNeighborTestSources", |
Myles Watson | 0ead597 | 2019-04-01 13:21:25 -0700 | [diff] [blame] | 250 | ":BluetoothPacketTestSources", |
Martin Brabham | a5be868 | 2019-10-18 13:59:24 -0700 | [diff] [blame] | 251 | ":BluetoothSecurityTestSources", |
Chris Manton | ee8c0a9 | 2019-10-17 10:56:37 -0700 | [diff] [blame] | 252 | ":BluetoothShimTestSources", |
Myles Watson | 0ead597 | 2019-04-01 13:21:25 -0700 | [diff] [blame] | 253 | ], |
Colin Cross | 6208435 | 2019-05-23 14:12:59 -0700 | [diff] [blame] | 254 | generated_headers: [ |
Hansong Zhang | 05c079b | 2019-04-04 13:24:43 -0700 | [diff] [blame] | 255 | "BluetoothGeneratedPackets_h", |
Myles Watson | cc57c6b | 2019-03-25 15:24:43 -0700 | [diff] [blame] | 256 | ], |
Colin Cross | 6208435 | 2019-05-23 14:12:59 -0700 | [diff] [blame] | 257 | static_libs: [ |
Zach Johnson | 3a77003 | 2019-03-27 19:15:38 -0700 | [diff] [blame] | 258 | "libbluetooth_gd", |
Hansong Zhang | cf49fa9 | 2019-05-06 17:54:51 -0700 | [diff] [blame] | 259 | "libgmock", |
Hansong Zhang | a25f84d | 2019-03-19 16:17:42 -0700 | [diff] [blame] | 260 | ], |
Hansong Zhang | aa0875c | 2019-06-06 21:44:55 -0700 | [diff] [blame] | 261 | shared_libs: [ |
| 262 | "libchrome", |
| 263 | ], |
Hansong Zhang | a25f84d | 2019-03-19 16:17:42 -0700 | [diff] [blame] | 264 | sanitize: { |
Chienyuan | 2d7f3b7 | 2019-03-29 17:33:41 -0700 | [diff] [blame] | 265 | address: true, |
Hansong Zhang | a25f84d | 2019-03-19 16:17:42 -0700 | [diff] [blame] | 266 | }, |
| 267 | } |
Jack He | f4e2471 | 2019-04-01 16:20:14 -0700 | [diff] [blame] | 268 | |
Ajay Panicker | 4d6b760 | 2019-02-06 14:02:36 -0800 | [diff] [blame] | 269 | cc_test { |
| 270 | name: "bluetooth_packet_parser_test", |
| 271 | test_suites: ["device-tests"], |
| 272 | defaults: [ |
| 273 | "gd_defaults", |
| 274 | "gd_clang_coverage_bin", |
| 275 | ], |
| 276 | host_supported: true, |
| 277 | srcs: [ |
| 278 | ":BluetoothPacketSources", |
| 279 | ":BluetoothPacketParserTestPacketTestSources", |
| 280 | ], |
Colin Cross | 6208435 | 2019-05-23 14:12:59 -0700 | [diff] [blame] | 281 | generated_headers: [ |
Ajay Panicker | 4d6b760 | 2019-02-06 14:02:36 -0800 | [diff] [blame] | 282 | "BluetoothPacketParserTestPacketPdlGen_h", |
| 283 | ], |
| 284 | sanitize: { |
| 285 | address: true, |
| 286 | cfi: true, |
| 287 | }, |
| 288 | } |
| 289 | |
Zongheng Wang | 627ba81 | 2019-10-16 16:39:11 -0700 | [diff] [blame] | 290 | cc_fuzz { |
| 291 | name: "bluetooth_gd_fuzz_test", |
| 292 | defaults: ["gd_defaults"], |
| 293 | srcs: [ |
| 294 | "fuzz_test.cc", |
Jack He | e0cd4da | 2019-10-22 15:57:10 -0700 | [diff] [blame] | 295 | ":BluetoothHciFuzzTestSources", |
Zongheng Wang | 627ba81 | 2019-10-16 16:39:11 -0700 | [diff] [blame] | 296 | ":BluetoothL2capFuzzTestSources", |
| 297 | ], |
| 298 | static_libs: [ |
| 299 | "libbluetooth_gd", |
| 300 | "libchrome", |
| 301 | "libgmock", |
| 302 | "libgtest", |
| 303 | ], |
| 304 | host_supported: true, |
| 305 | generated_headers: [ |
| 306 | "BluetoothGeneratedPackets_h", |
| 307 | ], |
| 308 | target: { |
| 309 | android: { |
| 310 | shared_libs: [ |
| 311 | "android.hardware.bluetooth@1.0", |
| 312 | "libhidlbase", |
| 313 | "libutils", |
| 314 | ], |
| 315 | }, |
| 316 | }, |
| 317 | } |
| 318 | |
Jack He | f4e2471 | 2019-04-01 16:20:14 -0700 | [diff] [blame] | 319 | cc_benchmark { |
| 320 | name: "bluetooth_benchmark_gd", |
| 321 | defaults: ["gd_defaults"], |
| 322 | host_supported: true, |
| 323 | srcs: [ |
| 324 | "benchmark.cc", |
| 325 | ":BluetoothOsBenchmarkSources", |
| 326 | ], |
Colin Cross | 6208435 | 2019-05-23 14:12:59 -0700 | [diff] [blame] | 327 | static_libs: [ |
Hansong Zhang | 05c079b | 2019-04-04 13:24:43 -0700 | [diff] [blame] | 328 | "libbluetooth_gd", |
| 329 | ], |
Hansong Zhang | aa0875c | 2019-06-06 21:44:55 -0700 | [diff] [blame] | 330 | shared_libs: [ |
| 331 | "libchrome", |
| 332 | ], |
Hansong Zhang | 05c079b | 2019-04-04 13:24:43 -0700 | [diff] [blame] | 333 | } |
| 334 | |
Chienyuan | 3d8a803 | 2019-11-01 18:04:07 +0800 | [diff] [blame] | 335 | filegroup { |
| 336 | name: "BluetoothHciClassSources", |
| 337 | srcs: [ |
| 338 | "hci/address.cc", |
| 339 | "hci/class_of_device.cc", |
| 340 | ], |
| 341 | } |
| 342 | |
Hansong Zhang | 05c079b | 2019-04-04 13:24:43 -0700 | [diff] [blame] | 343 | genrule { |
| 344 | name: "BluetoothGeneratedPackets_h", |
| 345 | tools: [ |
| 346 | "bluetooth_packetgen", |
| 347 | ], |
| 348 | cmd: "$(location bluetooth_packetgen) --include=system/bt/gd --out=$(genDir) $(in)", |
| 349 | srcs: [ |
| 350 | "hci/hci_packets.pdl", |
| 351 | "l2cap/l2cap_packets.pdl", |
Jakub Pawlowski | e79714e | 2019-10-14 14:49:55 +0200 | [diff] [blame] | 352 | "security/smp_packets.pdl", |
Hansong Zhang | 05c079b | 2019-04-04 13:24:43 -0700 | [diff] [blame] | 353 | ], |
| 354 | out: [ |
| 355 | "hci/hci_packets.h", |
| 356 | "l2cap/l2cap_packets.h", |
Jakub Pawlowski | e79714e | 2019-10-14 14:49:55 +0200 | [diff] [blame] | 357 | "security/smp_packets.h", |
Jack He | f4e2471 | 2019-04-01 16:20:14 -0700 | [diff] [blame] | 358 | ], |
| 359 | } |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 360 | |
Jack He | 9be1dcd | 2019-11-18 19:20:41 -0800 | [diff] [blame] | 361 | genrule { |
| 362 | name: "BluetoothGeneratedPackets_python3_cc", |
| 363 | tools: [ |
| 364 | "bluetooth_packetgen", |
| 365 | ], |
Jack He | f2d1460 | 2019-11-20 17:24:16 -0800 | [diff] [blame] | 366 | 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] | 367 | srcs: [ |
| 368 | "hci/hci_packets.pdl", |
| 369 | "l2cap/l2cap_packets.pdl", |
| 370 | "security/smp_packets.pdl", |
| 371 | ], |
| 372 | out: [ |
| 373 | "hci/hci_packets_python3.cc", |
Jack He | f2d1460 | 2019-11-20 17:24:16 -0800 | [diff] [blame] | 374 | "hci/hci_packets_python3_shard_0.cc", |
| 375 | "hci/hci_packets_python3_shard_1.cc", |
| 376 | "hci/hci_packets_python3_shard_2.cc", |
| 377 | "hci/hci_packets_python3_shard_3.cc", |
| 378 | "hci/hci_packets_python3_shard_4.cc", |
Jack He | 9be1dcd | 2019-11-18 19:20:41 -0800 | [diff] [blame] | 379 | "l2cap/l2cap_packets_python3.cc", |
Jack He | f2d1460 | 2019-11-20 17:24:16 -0800 | [diff] [blame] | 380 | "l2cap/l2cap_packets_python3_shard_0.cc", |
| 381 | "l2cap/l2cap_packets_python3_shard_1.cc", |
| 382 | "l2cap/l2cap_packets_python3_shard_2.cc", |
| 383 | "l2cap/l2cap_packets_python3_shard_3.cc", |
| 384 | "l2cap/l2cap_packets_python3_shard_4.cc", |
Jack He | 9be1dcd | 2019-11-18 19:20:41 -0800 | [diff] [blame] | 385 | "security/smp_packets_python3.cc", |
Jack He | f2d1460 | 2019-11-20 17:24:16 -0800 | [diff] [blame] | 386 | "security/smp_packets_python3_shard_0.cc", |
| 387 | "security/smp_packets_python3_shard_1.cc", |
| 388 | "security/smp_packets_python3_shard_2.cc", |
| 389 | "security/smp_packets_python3_shard_3.cc", |
| 390 | "security/smp_packets_python3_shard_4.cc", |
Jack He | 9be1dcd | 2019-11-18 19:20:41 -0800 | [diff] [blame] | 391 | ], |
| 392 | } |
| 393 | |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 394 | filegroup { |
Zach Johnson | 3470360 | 2019-04-29 16:45:21 -0700 | [diff] [blame] | 395 | name: "BluetoothFacadeProto", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 396 | srcs: [ |
Chienyuan | 4adb042 | 2019-04-25 15:11:54 -0700 | [diff] [blame] | 397 | "facade/common.proto", |
Hansong Zhang | 30bf869 | 2019-05-02 15:25:54 -0700 | [diff] [blame] | 398 | "facade/rootservice.proto", |
Zach Johnson | 3470360 | 2019-04-29 16:45:21 -0700 | [diff] [blame] | 399 | "hal/facade.proto", |
Hansong Zhang | c5ec8f9 | 2019-06-19 17:22:21 -0700 | [diff] [blame] | 400 | "hci/facade.proto", |
Jack He | ff38d89 | 2019-10-03 17:11:07 -0700 | [diff] [blame] | 401 | "l2cap/classic/facade.proto", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 402 | ], |
| 403 | } |
| 404 | |
| 405 | genrule { |
Zach Johnson | 3470360 | 2019-04-29 16:45:21 -0700 | [diff] [blame] | 406 | name: "BluetoothFacadeGeneratedStub_h", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 407 | tools: [ |
| 408 | "aprotoc", |
| 409 | "protoc-gen-grpc-cpp-plugin", |
| 410 | ], |
| 411 | 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)", |
| 412 | srcs: [ |
Zach Johnson | 3470360 | 2019-04-29 16:45:21 -0700 | [diff] [blame] | 413 | ":BluetoothFacadeProto", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 414 | ], |
| 415 | out: [ |
Chienyuan | 4adb042 | 2019-04-25 15:11:54 -0700 | [diff] [blame] | 416 | "facade/common.grpc.pb.h", |
| 417 | "facade/common.pb.h", |
Hansong Zhang | 30bf869 | 2019-05-02 15:25:54 -0700 | [diff] [blame] | 418 | "facade/rootservice.grpc.pb.h", |
| 419 | "facade/rootservice.pb.h", |
Zach Johnson | 3470360 | 2019-04-29 16:45:21 -0700 | [diff] [blame] | 420 | "hal/facade.grpc.pb.h", |
| 421 | "hal/facade.pb.h", |
Hansong Zhang | c5ec8f9 | 2019-06-19 17:22:21 -0700 | [diff] [blame] | 422 | "hci/facade.grpc.pb.h", |
| 423 | "hci/facade.pb.h", |
Jack He | ff38d89 | 2019-10-03 17:11:07 -0700 | [diff] [blame] | 424 | "l2cap/classic/facade.grpc.pb.h", |
| 425 | "l2cap/classic/facade.pb.h", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 426 | ], |
| 427 | } |
| 428 | |
| 429 | genrule { |
Zach Johnson | 3470360 | 2019-04-29 16:45:21 -0700 | [diff] [blame] | 430 | name: "BluetoothFacadeGeneratedStub_cc", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 431 | tools: [ |
| 432 | "aprotoc", |
| 433 | "protoc-gen-grpc-cpp-plugin", |
| 434 | ], |
| 435 | 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)", |
| 436 | srcs: [ |
Zach Johnson | 3470360 | 2019-04-29 16:45:21 -0700 | [diff] [blame] | 437 | ":BluetoothFacadeProto", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 438 | ], |
| 439 | out: [ |
Chienyuan | 4adb042 | 2019-04-25 15:11:54 -0700 | [diff] [blame] | 440 | "facade/common.grpc.pb.cc", |
| 441 | "facade/common.pb.cc", |
Hansong Zhang | 30bf869 | 2019-05-02 15:25:54 -0700 | [diff] [blame] | 442 | "facade/rootservice.grpc.pb.cc", |
| 443 | "facade/rootservice.pb.cc", |
Zach Johnson | 3470360 | 2019-04-29 16:45:21 -0700 | [diff] [blame] | 444 | "hal/facade.grpc.pb.cc", |
| 445 | "hal/facade.pb.cc", |
Hansong Zhang | c5ec8f9 | 2019-06-19 17:22:21 -0700 | [diff] [blame] | 446 | "hci/facade.grpc.pb.cc", |
| 447 | "hci/facade.pb.cc", |
Jack He | ff38d89 | 2019-10-03 17:11:07 -0700 | [diff] [blame] | 448 | "l2cap/classic/facade.grpc.pb.cc", |
| 449 | "l2cap/classic/facade.pb.cc", |
Hansong Zhang | 29f9900 | 2019-04-24 17:25:42 +0000 | [diff] [blame] | 450 | ], |
| 451 | } |
Zach Johnson | facafb0 | 2019-04-22 16:34:49 -0700 | [diff] [blame] | 452 | |
| 453 | genrule { |
Hansong Zhang | 90ec740 | 2019-04-29 16:04:07 -0700 | [diff] [blame] | 454 | name: "BluetoothFacadeAndCertGeneratedStub_py", |
Zach Johnson | facafb0 | 2019-04-22 16:34:49 -0700 | [diff] [blame] | 455 | tools: [ |
| 456 | "aprotoc", |
| 457 | "protoc-gen-grpc-python-plugin", |
| 458 | ], |
| 459 | 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] | 460 | "touch $(genDir)/facade/__init__.py; " + |
Hansong Zhang | 90ec740 | 2019-04-29 16:04:07 -0700 | [diff] [blame] | 461 | "touch $(genDir)/hal/__init__.py; " + |
Hansong Zhang | c5ec8f9 | 2019-06-19 17:22:21 -0700 | [diff] [blame] | 462 | "touch $(genDir)/hal/cert/__init__.py; " + |
| 463 | "touch $(genDir)/hci/__init__.py; " + |
Jack He | fcb2bbf | 2019-07-31 15:44:05 -0700 | [diff] [blame] | 464 | "touch $(genDir)/hci/cert/__init__.py; " + |
Jack He | ff38d89 | 2019-10-03 17:11:07 -0700 | [diff] [blame] | 465 | "touch $(genDir)/l2cap/classic/__init__.py; " + |
| 466 | "touch $(genDir)/l2cap/classic/cert/__init__.py; ", |
Zach Johnson | facafb0 | 2019-04-22 16:34:49 -0700 | [diff] [blame] | 467 | srcs: [ |
Zach Johnson | 3470360 | 2019-04-29 16:45:21 -0700 | [diff] [blame] | 468 | ":BluetoothFacadeProto", |
Hansong Zhang | 90ec740 | 2019-04-29 16:04:07 -0700 | [diff] [blame] | 469 | ":BluetoothCertStackProto", |
Zach Johnson | facafb0 | 2019-04-22 16:34:49 -0700 | [diff] [blame] | 470 | ], |
| 471 | out: [ |
Hansong Zhang | 30bf869 | 2019-05-02 15:25:54 -0700 | [diff] [blame] | 472 | "cert/rootservice_pb2_grpc.py", |
| 473 | "cert/rootservice_pb2.py", |
Chienyuan | 4adb042 | 2019-04-25 15:11:54 -0700 | [diff] [blame] | 474 | "facade/__init__.py", |
| 475 | "facade/common_pb2_grpc.py", |
| 476 | "facade/common_pb2.py", |
Hansong Zhang | 30bf869 | 2019-05-02 15:25:54 -0700 | [diff] [blame] | 477 | "facade/rootservice_pb2_grpc.py", |
| 478 | "facade/rootservice_pb2.py", |
Zach Johnson | facafb0 | 2019-04-22 16:34:49 -0700 | [diff] [blame] | 479 | "hal/__init__.py", |
Zach Johnson | 3470360 | 2019-04-29 16:45:21 -0700 | [diff] [blame] | 480 | "hal/facade_pb2_grpc.py", |
| 481 | "hal/facade_pb2.py", |
Hansong Zhang | c5ec8f9 | 2019-06-19 17:22:21 -0700 | [diff] [blame] | 482 | "hci/__init__.py", |
| 483 | "hci/facade_pb2_grpc.py", |
| 484 | "hci/facade_pb2.py", |
Jack He | ff38d89 | 2019-10-03 17:11:07 -0700 | [diff] [blame] | 485 | "l2cap/classic/__init__.py", |
| 486 | "l2cap/classic/facade_pb2_grpc.py", |
| 487 | "l2cap/classic/facade_pb2.py", |
Hansong Zhang | 90ec740 | 2019-04-29 16:04:07 -0700 | [diff] [blame] | 488 | "hal/cert/__init__.py", |
| 489 | "hal/cert/api_pb2_grpc.py", |
| 490 | "hal/cert/api_pb2.py", |
Hansong Zhang | c5ec8f9 | 2019-06-19 17:22:21 -0700 | [diff] [blame] | 491 | "hci/cert/__init__.py", |
| 492 | "hci/cert/api_pb2_grpc.py", |
| 493 | "hci/cert/api_pb2.py", |
Jack He | ff38d89 | 2019-10-03 17:11:07 -0700 | [diff] [blame] | 494 | "l2cap/classic/cert/__init__.py", |
| 495 | "l2cap/classic/cert/api_pb2_grpc.py", |
| 496 | "l2cap/classic/cert/api_pb2.py", |
Hansong Zhang | 90ec740 | 2019-04-29 16:04:07 -0700 | [diff] [blame] | 497 | ], |
| 498 | } |
| 499 | |
| 500 | filegroup { |
| 501 | name: "BluetoothCertStackProto", |
| 502 | srcs: [ |
Hansong Zhang | 30bf869 | 2019-05-02 15:25:54 -0700 | [diff] [blame] | 503 | "cert/rootservice.proto", |
Hansong Zhang | 90ec740 | 2019-04-29 16:04:07 -0700 | [diff] [blame] | 504 | "hal/cert/api.proto", |
Hansong Zhang | c5ec8f9 | 2019-06-19 17:22:21 -0700 | [diff] [blame] | 505 | "hci/cert/api.proto", |
Jack He | ff38d89 | 2019-10-03 17:11:07 -0700 | [diff] [blame] | 506 | "l2cap/classic/cert/api.proto", |
Hansong Zhang | 90ec740 | 2019-04-29 16:04:07 -0700 | [diff] [blame] | 507 | ], |
| 508 | } |
| 509 | |
| 510 | genrule { |
| 511 | name: "BluetoothCertStackGeneratedStub_h", |
| 512 | tools: [ |
| 513 | "aprotoc", |
| 514 | "protoc-gen-grpc-cpp-plugin", |
| 515 | ], |
| 516 | 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)", |
| 517 | srcs: [ |
| 518 | ":BluetoothCertStackProto", |
Colin Cross | 6208435 | 2019-05-23 14:12:59 -0700 | [diff] [blame] | 519 | ":BluetoothFacadeProto", // we need to use facade/common.proto |
Hansong Zhang | 90ec740 | 2019-04-29 16:04:07 -0700 | [diff] [blame] | 520 | ], |
| 521 | out: [ |
Hansong Zhang | 30bf869 | 2019-05-02 15:25:54 -0700 | [diff] [blame] | 522 | "cert/rootservice.grpc.pb.h", |
| 523 | "cert/rootservice.pb.h", |
Hansong Zhang | 90ec740 | 2019-04-29 16:04:07 -0700 | [diff] [blame] | 524 | "facade/common.grpc.pb.h", |
| 525 | "facade/common.pb.h", |
| 526 | "hal/cert/api.grpc.pb.h", |
| 527 | "hal/cert/api.pb.h", |
Hansong Zhang | c5ec8f9 | 2019-06-19 17:22:21 -0700 | [diff] [blame] | 528 | "hci/cert/api.grpc.pb.h", |
| 529 | "hci/cert/api.pb.h", |
Jack He | ff38d89 | 2019-10-03 17:11:07 -0700 | [diff] [blame] | 530 | "l2cap/classic/cert/api.grpc.pb.h", |
| 531 | "l2cap/classic/cert/api.pb.h", |
Hansong Zhang | 90ec740 | 2019-04-29 16:04:07 -0700 | [diff] [blame] | 532 | ], |
| 533 | } |
| 534 | |
| 535 | genrule { |
| 536 | name: "BluetoothCertStackGeneratedStub_cc", |
| 537 | tools: [ |
| 538 | "aprotoc", |
| 539 | "protoc-gen-grpc-cpp-plugin", |
| 540 | ], |
| 541 | 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)", |
| 542 | srcs: [ |
| 543 | ":BluetoothCertStackProto", |
Colin Cross | 6208435 | 2019-05-23 14:12:59 -0700 | [diff] [blame] | 544 | ":BluetoothFacadeProto", // we need to use facade/common.proto |
Hansong Zhang | 90ec740 | 2019-04-29 16:04:07 -0700 | [diff] [blame] | 545 | ], |
| 546 | out: [ |
Hansong Zhang | 30bf869 | 2019-05-02 15:25:54 -0700 | [diff] [blame] | 547 | "cert/rootservice.grpc.pb.cc", |
| 548 | "cert/rootservice.pb.cc", |
Hansong Zhang | 90ec740 | 2019-04-29 16:04:07 -0700 | [diff] [blame] | 549 | "facade/common.grpc.pb.cc", |
| 550 | "facade/common.pb.cc", |
| 551 | "hal/cert/api.grpc.pb.cc", |
| 552 | "hal/cert/api.pb.cc", |
Hansong Zhang | c5ec8f9 | 2019-06-19 17:22:21 -0700 | [diff] [blame] | 553 | "hci/cert/api.grpc.pb.cc", |
| 554 | "hci/cert/api.pb.cc", |
Jack He | ff38d89 | 2019-10-03 17:11:07 -0700 | [diff] [blame] | 555 | "l2cap/classic/cert/api.grpc.pb.cc", |
| 556 | "l2cap/classic/cert/api.pb.cc", |
Zach Johnson | facafb0 | 2019-04-22 16:34:49 -0700 | [diff] [blame] | 557 | ], |
| 558 | } |
Jack He | 9be1dcd | 2019-11-18 19:20:41 -0800 | [diff] [blame] | 559 | |
| 560 | cc_defaults { |
| 561 | name: "bluetooth_py3_native_extension_defaults", |
| 562 | include_dirs: [ |
| 563 | "external/python/cpython3/Include", |
| 564 | ], |
| 565 | target: { |
| 566 | android: { |
| 567 | include_dirs: ["external/python/cpython3/android/bionic/pyconfig"], |
| 568 | }, |
| 569 | android_arm: { |
| 570 | cflags: ["-DSOABI=\"cpython-38android-arm-android-bionic\""], |
| 571 | suffix: ".cpython-38android-arm-android-bionic", |
| 572 | }, |
| 573 | android_arm64: { |
| 574 | cflags: ["-DSOABI=\"cpython-38android-arm64-android-bionic\""], |
| 575 | suffix: ".cpython-38android-arm64-android-bionic", |
| 576 | }, |
| 577 | android_x86: { |
| 578 | cflags: ["-DSOABI=\"cpython-38android-x86-android-bionic\""], |
| 579 | suffix: ".cpython-38android-x86-android-bionic", |
| 580 | }, |
| 581 | android_x86_64: { |
| 582 | cflags: ["-DSOABI=\"cpython-38android-x86_64-android-bionic\""], |
| 583 | suffix: ".cpython-38android-x86_64-android-bionic", |
| 584 | }, |
| 585 | // Regenerate include dirs with android_regen.sh |
| 586 | darwin_x86_64: { |
| 587 | include_dirs: ["external/python/cpython3/android/darwin_x86_64/pyconfig"], |
| 588 | cflags: [ |
| 589 | "-Wno-deprecated-declarations", |
| 590 | "-Wno-pointer-arith", |
| 591 | "-DSOABI=\"cpython-38android-x86_64-darwin\"", |
| 592 | ], |
| 593 | suffix: ".cpython-38android-x86_64-darwin", |
| 594 | }, |
| 595 | linux_bionic: { |
| 596 | // NB linux_bionic is a 'host' architecture but it uses the bionic libc like 'android' |
| 597 | // targets so use the android pyconfig. |
| 598 | include_dirs: ["external/python/cpython3/android/bionic/pyconfig"], |
| 599 | cflags: ["-DSOABI=\"cpython-38android-x86_64-linux-bionic\""], |
| 600 | suffix: ".cpython-38android-x86_64-linux-bionic", |
| 601 | }, |
| 602 | linux_glibc_x86: { |
| 603 | enabled: false, |
| 604 | }, |
| 605 | linux_glibc_x86_64: { |
| 606 | include_dirs: ["external/python/cpython3/android/linux_x86_64/pyconfig"], |
| 607 | cflags: ["-DSOABI=\"cpython-38android-x86_64-linux-gnu\""], |
Jack He | 8768f57 | 2019-11-20 21:44:55 -0800 | [diff] [blame] | 608 | // Commenting out the Linux suffix so that cpython-38-x86_64-linux-gnu |
| 609 | // Python 3.8 can also import the untagged .so library per PEP 3149 |
| 610 | // Keep this change until Android py3-cmd can run ACTS, gRPC and can |
| 611 | // Export Python native symbols such as PyType_Type |
| 612 | // suffix: ".cpython-38android-x86_64-linux-gnu", |
Jack He | 9be1dcd | 2019-11-18 19:20:41 -0800 | [diff] [blame] | 613 | }, |
| 614 | windows: { |
| 615 | enabled: false, |
| 616 | }, |
| 617 | }, |
| 618 | allow_undefined_symbols: true, |
| 619 | } |
| 620 | |
| 621 | cc_library{ |
| 622 | name: "bluetooth_packets_python3", |
| 623 | defaults: [ |
| 624 | "gd_defaults", |
| 625 | "bluetooth_py3_native_extension_defaults" |
| 626 | ], |
| 627 | host_supported: true, |
| 628 | srcs: [ |
| 629 | "packet/python3_module.cc", |
| 630 | "l2cap/fcs.cc", |
| 631 | ":BluetoothPacketSources", |
| 632 | ], |
| 633 | generated_headers: [ |
| 634 | "BluetoothGeneratedPackets_h", |
| 635 | ], |
| 636 | generated_sources: [ |
| 637 | "BluetoothGeneratedPackets_python3_cc", |
| 638 | ], |
| 639 | header_libs: [ |
| 640 | "pybind11_headers", |
| 641 | ], |
| 642 | cflags: [ |
| 643 | "-fexceptions", |
| 644 | ], |
| 645 | rtti: true, |
| 646 | } |