Both `kon-transcription` and `kon-llm` previously hardcoded their native acceleration features in Cargo.toml — `whisper-rs` with `vulkan`, `llama-cpp-2` with `openmp` + `vulkan`. That worked everywhere desktop ships (Linux/macOS/Windows all have Vulkan via MoltenVK on Mac), but it made an Android build structurally impossible: NDK builds against drivers that vary wildly across SoCs (Adreno OK, Mali patchy, PowerVR worse), and some older devices have no Vulkan at all. Roadmap step 0 from the Android plan: make the GPU acceleration opt-in so a CPU-only target compiles. Reuses the existing pattern that README's "future Windows non-AVX2 build" comment hinted at. - kon-transcription: new `whisper-vulkan` feature gates `whisper-rs/vulkan` via the optional-syntax `whisper-rs?/vulkan`. Default features stay as `["whisper", "whisper-vulkan"]` so desktop is unchanged. - kon-llm: new `gpu-vulkan` and `openmp` features each gate the matching `llama-cpp-2` feature. Default stays `["gpu-vulkan", "openmp"]`. They are independent so an Android Vulkan build can opt into vulkan without openmp (NDK OpenMP linking has known cross-version fragility). CPU-only build invocations: cargo build -p kon-transcription --no-default-features --features whisper cargo build -p kon-llm --no-default-features Verified: all 91 tests in the buildable-in-sandbox crates still pass. The two crates whose Cargo.toml changed (kon-transcription, kon-llm) can't be compiled in this sandbox (ort-sys CDN + cmake-built llama.cpp); CI's Linux/macOS/Windows builders will exercise the default-feature path exactly as before. https://claude.ai/code/session_0189xUb6ie6t9qHkzatGZ9Rb
33 lines
1.0 KiB
TOML
33 lines
1.0 KiB
TOML
[package]
|
|
name = "kon-llm"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
|
|
[features]
|
|
# Default desktop build keeps the existing openmp + vulkan acceleration.
|
|
# Mobile / CPU-only targets can drop one or both via:
|
|
# cargo build -p kon-llm --no-default-features
|
|
# These are independent so an Android Vulkan build can opt into vulkan
|
|
# without openmp (the NDK ships OpenMP libs but the toolchain configuration
|
|
# is fragile across NDK versions).
|
|
default = ["gpu-vulkan", "openmp"]
|
|
gpu-vulkan = ["llama-cpp-2/vulkan"]
|
|
openmp = ["llama-cpp-2/openmp"]
|
|
|
|
[dependencies]
|
|
kon-core = { path = "../core" }
|
|
encoding_rs = "0.8"
|
|
futures-util = "0.3"
|
|
llama-cpp-2 = { version = "0.1.144", default-features = false }
|
|
num_cpus = "1"
|
|
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls", "stream"] }
|
|
serde = { version = "1", features = ["derive"] }
|
|
serde_json = "1"
|
|
sha2 = "0.10"
|
|
thiserror = "2"
|
|
tokio = { version = "1", features = ["fs", "io-util", "macros", "net", "rt-multi-thread", "sync", "time"] }
|
|
tracing = "0.1"
|
|
|
|
[dev-dependencies]
|
|
tempfile = "3"
|