llama-cpp-sys-4 0.8.0

Low Level Bindings to llama.cpp
Documentation
[package]
name = "llama-cpp-sys-4"
description = "Low Level Bindings to llama.cpp"
version = "0.8.0"
edition = "2021"
# The floor is set by the dependency graph, not by this crate's own syntax.
# `llama-cpp-sys-4`'s `ureq` build-dependency pulls url -> idna -> icu_*, which
# declare 1.88; this crate's own code only needs 1.82 (for `&raw const`). Lower
# it only after checking the graph again:
#   cargo metadata | jq -r '.packages[]|select(.rust_version)|.rust_version'
rust-version = "1.88"
license = "MIT OR Apache-2.0"
repository = "https://github.com/eugenehp/llama-cpp-rs"
keywords = ["llama", "llm", "ggml", "gguf", "inference"]
categories = ["api-bindings", "external-ffi-bindings"]
links = "llama"

include = [
    # Licence texts. `license = "MIT OR Apache-2.0"` is only a declaration;
    # Cargo can package a file only from inside the package directory, and the
    # repository's copies live at the workspace root — so without these the
    # published crate ships a licence it does not contain. Keep them in sync
    # with the root copies.
    "LICENSE-MIT",
    "LICENSE-APACHE",

    # Crate sources
    "build.rs",
    "prebuilt_download.rs",
    "wrapper.h",
    "/src",

    # Feature patches (applied at build time to the llama.cpp copy in OUT_DIR)
    "/patches",

    # MTP shim — small C++ wrapper around common/speculative.cpp
    "/mtp_shim/**/*",

    # shim_support — status codes and error buffer shared by every shim
    "/shim_support/**/*",

    # ext_shim — C wrappers for C++-only llama.cpp helpers (memory breakdown, fit)
    "/ext_shim/**/*",

    # chat_shim — C wrappers for common/chat.h and json-schema-to-grammar
    "/chat_shim/**/*",

    # common_shim — C wrappers for the rest of common/ (sampler, ngram, …)
    "/common_shim/**/*",

    # llama.cpp top-level
    "/llama.cpp/CMakeLists.txt",
    "/llama.cpp/convert_hf_to_gguf.py",
    # Vendored project's licence. CMake's license.cmake warns without it, and
    # shipping it alongside the vendored sources is the right thing regardless.
    "/llama.cpp/LICENSE",

    # llama.cpp cmake
    "/llama.cpp/cmake",

    # llama.cpp headers & sources
    "/llama.cpp/include/llama.h",
    "/llama.cpp/include/llama-cpp.h",
    "/llama.cpp/src/**/*",
    "/llama.cpp/common/**/*",

    # ggml cmake
    "/llama.cpp/ggml/CMakeLists.txt",
    "/llama.cpp/ggml/cmake",
    "/llama.cpp/ggml/src/CMakeLists.txt",

    # ggml headers & sources
    "/llama.cpp/ggml/include/*.h",
    "/llama.cpp/ggml/src/*.h",
    "/llama.cpp/ggml/src/*.c",
    "/llama.cpp/ggml/src/*.cpp",
    # `configure_file` inputs. These are matched by extension here, not by a
    # recursive glob like `/llama.cpp/src/**/*`, so a new template upstream is
    # silently dropped from the package and only `cargo package` reveals it —
    # which is how `ggml-version.h.in` (llama.cpp #28364) broke the published
    # crate.
    "/llama.cpp/ggml/src/*.in",

    # ggml legacy top-level backend files
    "/llama.cpp/ggml/src/ggml-cuda.cu",
    "/llama.cpp/ggml/src/ggml-metal.m",
    "/llama.cpp/ggml/src/ggml-metal.metal",

    # ggml backends (ggml-kompute intentionally omitted — its only content is
    # an uninitialised nested submodule with no git-tracked files, which causes
    # `cargo publish` to abort with "uncommitted changes")
    "/llama.cpp/ggml/src/ggml-blas/**/*",
    "/llama.cpp/ggml/src/ggml-cann/**/*",
    "/llama.cpp/ggml/src/ggml-cpu/**/*",
    "/llama.cpp/ggml/src/ggml-cuda/**/*",
    # GGML_ET and GGML_OPENVINO default OFF, so cmake never descends into these
    # today — but `ggml_add_backend()` is called for both unconditionally, so
    # the day a feature turns one on, a published crate without the directory
    # fails to configure. Same trap as `ggml-version.h.in`, noted above.
    "/llama.cpp/ggml/src/ggml-et/**/*",
    "/llama.cpp/ggml/src/ggml-hexagon/**/*",
    "/llama.cpp/ggml/src/ggml-hip/**/*",
    "/llama.cpp/ggml/src/ggml-metal/**/*",
    "/llama.cpp/ggml/src/ggml-musa/**/*",
    "/llama.cpp/ggml/src/ggml-opencl/**/*",
    "/llama.cpp/ggml/src/ggml-openvino/**/*",
    "/llama.cpp/ggml/src/ggml-rpc/**/*",
    "/llama.cpp/ggml/src/ggml-sycl/**/*",
    "/llama.cpp/ggml/src/ggml-virtgpu/**/*",
    "/llama.cpp/ggml/src/ggml-vulkan/**/*",
    "/llama.cpp/ggml/src/ggml-webgpu/**/*",
    "/llama.cpp/ggml/src/ggml-zdnn/**/*",
    "/llama.cpp/ggml/src/ggml-zendnn/**/*",

    # ggml misc
    "/llama.cpp/ggml/src/llamafile/sgemm.h",
    "/llama.cpp/ggml/src/llamafile/sgemm.cpp",
    "/llama.cpp/ggml/src/vulkan-shaders/**/*",

    # tools (tools/CMakeLists.txt unconditionally add_subdirectory()s all of
    # these, so every subdirectory must be present even when only mtmd is
    # needed; otherwise cmake exits 1 with "not an existing directory" errors)
    "/llama.cpp/tools/CMakeLists.txt",
    # All tools sources — cmake's tools/CMakeLists.txt unconditionally
    # add_subdirectory()s every tool, so all must be present.
    # Exclude server webui public/ assets (5.5 MB JS bundle, not needed for library).
    "/llama.cpp/tools/CMakeLists.txt",
    "/llama.cpp/tools/batched-bench/**/*",
    "/llama.cpp/tools/cli/**/*",
    "/llama.cpp/tools/completion/**/*",
    "/llama.cpp/tools/cvector-generator/**/*",
    "/llama.cpp/tools/export-lora/**/*",
    "/llama.cpp/tools/fit-params/**/*",
    "/llama.cpp/tools/gguf-split/**/*",
    "/llama.cpp/tools/imatrix/**/*",
    "/llama.cpp/tools/llama-bench/**/*",
    "/llama.cpp/tools/mtmd/**/*",
    "/llama.cpp/tools/parser/**/*",
    "/llama.cpp/tools/perplexity/**/*",
    "/llama.cpp/tools/quantize/**/*",
    "/llama.cpp/tools/results/**/*",
    "/llama.cpp/tools/rpc/**/*",
    "/llama.cpp/tools/server/CMakeLists.txt",
    "/llama.cpp/tools/server/server.cpp",
    "/llama.cpp/tools/server/httplib.h",
    "/llama.cpp/tools/tokenize/**/*",
    "/llama.cpp/tools/tts/**/*",

    # vendor
    "/llama.cpp/vendor/**/*",
]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

[build-dependencies]
bindgen = { workspace = true }
cc = { workspace = true, features = ["parallel"] }
cmake = "0.1"
flate2 = "1.0"
glob = "0.3.3"
patch-apply = "0.8.3"
tar = "0.4"
# Reading `[package.metadata.llama-cpp-sys-4]` and `llama-cpp.toml`. `toml_edit`
# rather than `toml` because the latter gates its document type behind serde,
# which a sys crate has no reason to pull into its build graph.
toml_edit = { version = "0.25", default-features = false, features = ["parse"] }
ureq = { version = "2.12", default-features = false, features = ["tls"] }

[target.'cfg(windows)'.build-dependencies]
winreg = "0.56"

[features]
default = []
cuda = []
metal = []
dynamic-link = []
vulkan = []
webgpu = []
blas = []
opencl = []
hip = []
native = []
openmp = []
mpi = []
rpc = []
mtmd = []
q1 = []
prebuilt = []

# By default, static libraries are built
# Enable dynamic-link feature to build shared libraries instead