Files
ssw c303c315e5 rocr: rusto-rs 源码入库(上游 v0.2.5 基线 57609fc + 本地补丁)
- 源码 316 文件收编为 rusto-rs/ 文件夹,随本仓库管理
- 移除内部 .git(补丁已存档 docs/rusto-rs-metal-patch-20260912.patch,上游可随时 re-clone)
- target/ 与 docs/.yarn 缓存不入库;本地改动:ROCR_* 环境变量调优 + Metal 链接修复 + 预处理测试脚本
2026-09-12 17:30:04 +08:00
..

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:

  1. Compiles MNN from the vendored source using CMake
  2. Compiles the C wrapper (mnn_wrapper.cpp)
  3. Generates Rust bindings using bindgen
  4. 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.