[package]
name = "llama-cpp-2"
description = "llama.cpp bindings for Rust"
version = "0.1.147"
edition = "2021"
license = "MIT OR Apache-2.0"
repository = "https://github.com/utilityai/llama-cpp-rs"

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

[dependencies]
enumflags2 = "0.7.12"
llama-cpp-sys-2 = { path = "../llama-cpp-sys-2", version = "0.1.147" }
thiserror = { workspace = true }
tracing = { workspace = true }
tracing-core = { workspace = true }
encoding_rs = { workspace = true }
llguidance = { version = "1.7.5", optional = true }
toktrie = { version = "1.7.5", optional = true }

[dev-dependencies]
encoding_rs = { workspace = true }
tracing-subscriber = { workspace = true }

[features]
default = ["openmp", "android-shared-stdcxx", "common"]
# Enable the JSON-schema-to-grammar API. Backed by `llama.cpp`'s `common/`
# static library; disabling drops `libcommon.a` (~14 MB) plus the
# `wrapper_common.cpp` bindings from the link line. Enabled by default for
# backwards compatibility.
common = ["llama-cpp-sys-2/common"]
cuda = ["llama-cpp-sys-2/cuda"]
cuda-no-vmm = ["cuda", "llama-cpp-sys-2/cuda-no-vmm"]
metal = ["llama-cpp-sys-2/metal"]
dynamic-link = ["llama-cpp-sys-2/dynamic-link"]
vulkan = ["llama-cpp-sys-2/vulkan"]
openmp = ["llama-cpp-sys-2/openmp"]
# Link GNU OpenMP (`libgomp`) statically on GNU targets while keeping OpenMP
# enabled. Useful for self-contained downstream binaries.
static-openmp = ["llama-cpp-sys-2/static-openmp"]
rocm = ["llama-cpp-sys-2/rocm"]
sampler = []
# Only has an impact on Android.
android-shared-stdcxx = ["llama-cpp-sys-2/shared-stdcxx"]
android-static-stdcxx = ["llama-cpp-sys-2/static-stdcxx"]
# Generic alias for non-Android targets that also support static C++ stdlib
# linkage through the sys crate.
static-stdcxx = ["llama-cpp-sys-2/static-stdcxx"]
mtmd = ["llama-cpp-sys-2/mtmd"]
system-ggml = ["llama-cpp-sys-2/system-ggml"]
system-ggml-static = ["llama-cpp-sys-2/system-ggml-static"]
llguidance = ["dep:llguidance", "dep:toktrie"]
dynamic-backends = ["llama-cpp-sys-2/dynamic-backends"]


[target.'cfg(all(target_os = "macos", any(target_arch = "aarch64", target_arch = "arm64")))'.dependencies]
llama-cpp-sys-2 = { path = "../llama-cpp-sys-2", version = "0.1.147", features = [
    "metal",
] }

[lints]
workspace = true

[package.metadata.docs.rs]
features = ["sampler"]

[[example]]
name = "usage"
path = "../examples/usage.rs"

[[example]]
name = "llguidance"
path = "../examples/llguidance.rs"
required-features = ["llguidance"]
