ik_llama_cpp_sys/lib.rs
1//! Low-level FFI bindings to `ik_llama.cpp` (ikawrakow's SOTA-quant fork of llama.cpp).
2//!
3//! The bindings are generated by `bindgen` in `build.rs` against the vendored
4//! `ik_llama.cpp/include/llama.h` + `ggml/include/gguf.h` and included below.
5#![allow(
6 non_upper_case_globals,
7 non_camel_case_types,
8 non_snake_case,
9 dead_code,
10 unnecessary_transmutes,
11 unpredictable_function_pointer_comparisons,
12 clippy::all,
13 clippy::pedantic
14)]
15
16include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
17
18/// Multimodal (`mtmd_*`) FFI bindings, generated by a dedicated C++-mode bindgen
19/// pass (see `build.rs::generate_mtmd_bindings`). Gated behind the `mtmd` feature.
20///
21/// The mtmd pass emits **only** `mtmd_*` items and references the shared
22/// `llama_*`/`ggml_*` types by bare name; `use super::*` below resolves those to
23/// the main bindings above, so there is no duplicate/clashing type definition.
24#[cfg(feature = "mtmd")]
25mod mtmd_bindings {
26 #![allow(
27 non_upper_case_globals,
28 non_camel_case_types,
29 non_snake_case,
30 dead_code,
31 unnecessary_transmutes,
32 unpredictable_function_pointer_comparisons,
33 clippy::all,
34 clippy::pedantic
35 )]
36 // Resolve blocklisted llama/ggml/gguf types referenced by the mtmd_* items
37 // (e.g. `llama_model`, `llama_context`, `llama_token`, `llama_pos`,
38 // `ggml_log_level`, `llama_flash_attn_type`, `ggml_type`) to the main
39 // bindings included at the crate root above.
40 use super::*;
41 include!(concat!(env!("OUT_DIR"), "/mtmd_bindings.rs"));
42}
43
44// Re-export the `mtmd_*` items at the crate root. This is a `pub use` of the
45// module's own public defs only (the private `use super::*` glob above is not
46// re-exported), and the mtmd pass emits no `llama_*`/`ggml_*` defs, so nothing
47// clashes with the main bindings.
48#[cfg(feature = "mtmd")]
49pub use mtmd_bindings::*;