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 "libbluetooth_rs", 22 "libbt_common", 23 "libbt_facade_helpers", 24 "libbt_packets", 25 "libcxx", 26 "libfutures", 27 "libgrpcio", 28 "liblazy_static", 29 "liblog_rust", 30 "libnix", 31 "libnum_traits", 32 "libtokio", 33 "libtokio_stream", 34 ], 35 proc_macros: [ 36 "libnum_derive", 37 "libpaste", 38 "libtopshim_macros", 39 ], 40 lints: "none", 41 clippy_lints: "none", 42} 43 44cc_library_static { 45 name: "libbt_topshim_cxx", 46 defaults: [ 47 "gd_ffi_defaults", 48 "libchrome_support_defaults", 49 ], 50 srcs: [ 51 "btav/btav_shim.cc", 52 "btav_sink/btav_sink_shim.cc", 53 "btif/btif_shim.cc", 54 "controller/controller_shim.cc", 55 "gatt/gatt_ble_advertiser_shim.cc", 56 "gatt/gatt_ble_scanner_shim.cc", 57 "gatt/gatt_shim.cc", 58 "hfp/hfp_shim.cc", 59 ], 60 generated_headers: [ 61 "cxx-bridge-header", 62 "libbt_init_flags_bridge_header", 63 "libbt_topshim_bridge_header", 64 ], 65 generated_sources: ["libbt_topshim_bridge_code"], 66 include_dirs: [ 67 "packages/modules/Bluetooth/system", 68 "packages/modules/Bluetooth/system/gd", 69 "packages/modules/Bluetooth/system/gd/rust/topshim", 70 "packages/modules/Bluetooth/system/include", 71 "packages/modules/Bluetooth/system/types", 72 ], 73 host_supported: true, 74} 75 76gensrcs { 77 name: "libbt_topshim_bridge_header", 78 tools: ["cxxbridge"], 79 cmd: "$(location cxxbridge) $(in) --header > $(out)", 80 srcs: [ 81 "src/btif.rs", 82 "src/controller.rs", 83 "src/profiles/a2dp.rs", 84 "src/profiles/avrcp.rs", 85 "src/profiles/gatt.rs", 86 "src/profiles/hfp.rs", 87 ], 88 output_extension: "rs.h", 89 export_include_dirs: ["."], 90} 91 92gensrcs { 93 name: "libbt_topshim_bridge_code", 94 tools: ["cxxbridge"], 95 cmd: "$(location cxxbridge) $(in) > $(out)", 96 srcs: [ 97 "src/btif.rs", 98 "src/controller.rs", 99 "src/profiles/a2dp.rs", 100 "src/profiles/avrcp.rs", 101 "src/profiles/gatt.rs", 102 "src/profiles/hfp.rs", 103 ], 104 output_extension: "cc", 105 export_include_dirs: ["."], 106} 107 108rust_bindgen { 109 name: "libbt_topshim_wrapper_bindgen", 110 wrapper_src: "bindings/wrapper.hpp", 111 crate_name: "bt_topshim_wrapper_bindgen", 112 source_stem: "bindings", 113 cpp_std: "c++17", 114 host_supported: true, 115 bindgen_flags: [ 116 "--allowlist-function=bt_.*", 117 "--allowlist-function=btgatt_.*", 118 "--allowlist-function=bthh_.*", 119 "--allowlist-function=btsdp.*", 120 "--allowlist-function=hal_util_.*", 121 "--allowlist-function=osi_property_get.*", 122 "--allowlist-type=bluetooth_sdp.*", 123 "--allowlist-type=bt_.*", 124 "--allowlist-type=btgatt_.*", 125 "--allowlist-type=bthf_.*", 126 "--allowlist-type=bthh_.*", 127 "--allowlist-type=btrc_.*", 128 "--allowlist-type=btsdp.*", 129 "--allowlist-type=btsock_.*", 130 "--allowlist-type=sock_connect_signal_t", 131 "--enable-cxx-namespaces", 132 "--opaque-type=std::.*", 133 "--size_t-is-usize", 134 "--with-derive-default", 135 "--with-derive-eq", 136 "--with-derive-partialeq", 137 ], 138 shared_libs: [ 139 "libc++", 140 ], 141 // The bindgen rule can only include headers via header_libs and does not 142 // support include_dirs. Make sure newly added headers have the correct 143 // header export target listed here. 144 header_libs: [ 145 "libbluetooth_headers", 146 "libbluetooth_system_headers", 147 ], 148} 149