blob: ad3fb0c6754de58d0ff3224aacc60eec120a44a4 [file] [edit]
//
// Copyright (C) 2026 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package {
default_applicable_licenses: ["Android-Apache-2.0"],
default_team: "trendy_team_machine_learning",
}
rust_bindgen {
name: "libwrapfd_bindings",
wrapper_src: "include/wrapfd.h",
crate_name: "wrapfd_bindings",
source_stem: "bindings",
bindgen_flags: [
"--allowlist-type=WrapfdState",
],
apex_available: [
"//apex_available:platform",
"com.android.npumanager",
],
min_sdk_version: "36",
}
rust_ffi_static {
name: "libwrapfd_ffi",
crate_name: "wrapfd",
srcs: ["lib.rs"],
rustlibs: [
"libnix",
"libbitflags",
"liblibc",
"liberrno",
"liblog_rust",
"libwrapfd_bindings",
],
export_include_dirs: ["include"],
visibility: ["//visibility:private"],
}
cc_library_shared {
name: "libwrapfd",
whole_static_libs: ["libwrapfd_ffi"],
llndk: {
symbol_file: "libwrapfd.map.txt",
},
}
rust_library {
name: "libwrapfd_rust",
crate_name: "wrapfd",
srcs: ["lib.rs"],
rustlibs: [
"libnix",
"libbitflags",
"liblibc",
"liberrno",
"liblog_rust",
"libwrapfd_bindings",
],
apex_available: ["com.android.npumanager"],
min_sdk_version: "36",
}
rust_test {
name: "libwrapfd_test",
test_suites: ["general-tests"],
srcs: ["tests.rs"],
rustlibs: [
"libdmabufheap_rust",
"libgoogletest_rust",
"liblibc",
"liblog_rust",
"libmemmap2",
"libnix",
"libpage_size",
"librand",
"libtempfile",
"libwrapfd_rust",
],
auto_gen_config: true,
require_root: true,
}