// SPDX-License-Identifier: GPL-2.0-or-later // Copyright DroidVM contributors // Additional permissions apply; see ADDITIONAL-PERMISSIONS in the repository root. // Rust bindings for the Android NDK camera APIs, plus a probe that exercises them on a device. // build: m camera_probe // collect: out/soong/.intermediates/external/crosvm/android_camera/camera_probe_bin/*/camera_probe package { default_applicable_licenses: ["external_crosvm_license"], } rust_library { name: "libandroid_camera", defaults: ["crosvm_defaults"], host_supported: false, crate_name: "android_camera", cargo_env_compat: true, cargo_pkg_version: "0.1.0", crate_root: "src/lib.rs", edition: "2021", rustlibs: [ "libbase_rust", "liblibc", "libthiserror", ], // libcamera2ndk (Camera2) and libmediandk (AImageReader) are opened with dlopen at run time, // not linked: both reach libgui, whose build needs projects a crosvm-only AOSP checkout does // not carry. dlopen itself comes from the default system_shared_libs -- naming libdl here // instead asks for the full bionic build, which wants projects this tree does not carry either. } // installable:false, like crosvm_device_only_bin: installing into system/bin makes the install // rule depend on the installed system/lib64/libc.so, which builds bionic from source and wants // external/llvm-libc. Nothing here needs to be in an image -- the binary is pushed by hand. rust_binary { name: "camera_probe_bin", defaults: ["crosvm_defaults"], host_supported: false, installable: false, stem: "camera_probe", crate_name: "camera_probe", cargo_env_compat: true, cargo_pkg_version: "0.1.0", crate_root: "src/probe.rs", edition: "2021", prefer_rlib: true, rustlibs: [ "libandroid_camera", "liblibc", ], } // An installable:false module gets no phony of its own, so `m camera_probe_bin` is an unknown // target. This gives `m camera_probe` a real one. phony { name: "camera_probe", required: ["camera_probe_bin"], }