1package { 2 // See: http://go/android-license-faq 3 // A large-scale-change added 'default_applicable_licenses' to import 4 // all of the 'license_kinds' from "system_bt_license" 5 // to get the below license kinds: 6 // SPDX-license-identifier-Apache-2.0 7 default_applicable_licenses: ["system_bt_license"], 8} 9 10rust_library_host_rlib { 11 name: "libbt_topshim", 12 defaults: ["gd_rust_defaults"], 13 crate_name: "bt_topshim", 14 srcs: [ 15 "src/lib.rs", 16 17 ":libbt_topshim_wrapper_bindgen", 18 ], 19 rustlibs: [ 20 "libbitflags", 21 "libbt_common", 22 "libcxx", 23 "libfutures", 24 "libgrpcio", 25 "liblog_rust", 26 "libnix", 27 "libnum_traits", 28 "libtokio", 29 "libtokio_stream", 30 ], 31 proc_macros: [ 32 "libnum_derive", 33 "libpaste", 34 "libtopshim_macros", 35 ], 36 lints: "none", 37 clippy_lints: "none", 38} 39 40cc_library_static { 41 name: "libbt_topshim_cxx", 42 srcs: [ 43 "btav/btav_shim.cc", 44 "btav_sink/btav_sink_shim.cc", 45 "controller/controller_shim.cc", 46 "csis/csis_shim.cc", 47 "gatt/gatt_ble_advertiser_shim.cc", 48 "gatt/gatt_ble_scanner_shim.cc", 49 "gatt/gatt_shim.cc", 50 "hfp/hfp_shim.cc", 51 "le_audio/le_audio_shim.cc", 52 "vc/vc_shim.cc", 53 ], 54 generated_headers: [ 55 "cxx-bridge-header", 56 "libbt_topshim_bridge_header", 57 ], 58 generated_sources: ["libbt_topshim_bridge_code"], 59 include_dirs: [ 60 "packages/modules/Bluetooth/system", 61 "packages/modules/Bluetooth/system/gd", 62 "packages/modules/Bluetooth/system/gd/rust/topshim", 63 "packages/modules/Bluetooth/system/include", 64 ], 65 host_supported: true, 66 static_libs: [ 67 "aics", 68 "libbluetooth_hci_pdl", 69 "libbluetooth_log", 70 "libchrome", 71 "libflatbuffers-cpp", 72 ], 73 aidl: { 74 libs: ["bluetooth_constants"], 75 }, 76 shared_libs: [ 77 "libbinder", 78 ], 79 target: { 80 darwin: { 81 enabled: false, 82 }, 83 }, 84} 85 86gensrcs { 87 name: "libbt_topshim_bridge_header", 88 tools: ["cxxbridge"], 89 cmd: "$(location cxxbridge) $(in) --header > $(out)", 90 srcs: [ 91 "src/controller.rs", 92 "src/profiles/a2dp.rs", 93 "src/profiles/avrcp.rs", 94 "src/profiles/csis.rs", 95 "src/profiles/gatt.rs", 96 "src/profiles/hfp.rs", 97 "src/profiles/le_audio.rs", 98 "src/profiles/vc.rs", 99 ], 100 output_extension: "rs.h", 101 export_include_dirs: ["."], 102} 103 104gensrcs { 105 name: "libbt_topshim_bridge_code", 106 tools: ["cxxbridge"], 107 cmd: "$(location cxxbridge) $(in) > $(out)", 108 srcs: [ 109 "src/controller.rs", 110 "src/profiles/a2dp.rs", 111 "src/profiles/avrcp.rs", 112 "src/profiles/csis.rs", 113 "src/profiles/gatt.rs", 114 "src/profiles/hfp.rs", 115 "src/profiles/le_audio.rs", 116 "src/profiles/vc.rs", 117 ], 118 output_extension: "cc", 119 export_include_dirs: ["."], 120} 121 122rust_bindgen { 123 name: "libbt_topshim_wrapper_bindgen", 124 wrapper_src: "bindings/wrapper.hpp", 125 crate_name: "bt_topshim_wrapper_bindgen", 126 source_stem: "bindings", 127 defaults: ["bluetooth_cflags"], 128 c_std: "", 129 host_supported: true, 130 bindgen_flags: [ 131 "--allowlist-function=bt_.*", 132 "--allowlist-function=btgatt_.*", 133 "--allowlist-function=bthh_.*", 134 "--allowlist-function=btsdp.*", 135 "--allowlist-function=hal_util_.*", 136 "--allowlist-function=osi_property_get.*", 137 "--allowlist-type=bluetooth_sdp.*", 138 "--allowlist-type=bt_.*", 139 "--allowlist-type=btgatt_.*", 140 "--allowlist-type=bthf_.*", 141 "--allowlist-type=bthh_.*", 142 "--allowlist-type=btrc_.*", 143 "--allowlist-type=btsdp.*", 144 "--allowlist-type=btsock_.*", 145 "--allowlist-type=sock_connect_signal_t", 146 "--enable-cxx-namespaces", 147 "--opaque-type=std::.*", 148 "--with-derive-default", 149 "--with-derive-eq", 150 "--with-derive-partialeq", 151 ], 152 shared_libs: [ 153 "libc++", 154 ], 155 cflags: [ 156 "-DTARGET_FLOSS", 157 ], 158 static_libs: [ 159 "libbluetooth_log", 160 ], 161 // The bindgen rule can only include headers via header_libs and does not 162 // support include_dirs. Make sure newly added headers have the correct 163 // header export target listed here. 164 header_libs: [ 165 "libbluetooth_headers", 166 "libbluetooth_system_headers", 167 ], 168} 169