- 源码 316 文件收编为 rusto-rs/ 文件夹,随本仓库管理 - 移除内部 .git(补丁已存档 docs/rusto-rs-metal-patch-20260912.patch,上游可随时 re-clone) - target/ 与 docs/.yarn 缓存不入库;本地改动:ROCR_* 环境变量调优 + Metal 链接修复 + 预处理测试脚本
MNN-sys
Low-level FFI bindings for the MNN (Mobile Neural Network) library.
Overview
This crate provides unsafe C bindings to MNN through a custom C wrapper layer. It is not intended to be used directly - use the mnn crate instead for safe, idiomatic Rust bindings.
Building
Requirements
- CMake 3.10 or higher
- C++11 compatible compiler (GCC 4.8+, Clang 3.3+, MSVC 2015+)
- Platform-specific dependencies:
- macOS/iOS: Xcode with Metal SDK
- Linux: Standard build tools
- Android: NDK
Build Process
The build script (build.rs) performs the following:
- Compiles MNN from the vendored source using CMake
- Compiles the C wrapper (
mnn_wrapper.cpp) - Generates Rust bindings using bindgen
- Links everything together
The build is configured for static linking by default to ensure the binaries are self-contained.
Platform Configuration
The build script automatically enables platform-specific backends:
- macOS/iOS: Metal, CoreML
- Linux: OpenCL
- Android: OpenCL
License
MNN is licensed under Apache 2.0. See the vendor/mnn directory for details.