build(deps): gate CUDA behind default feature, add CPU build scripts

Applies the stashed 'deps and cpu mode' work: cuda was hardcoded on the
candle dependency lines, making the candle-cuda feature flag dead and any
non-CUDA build impossible. Now default = [candle-cuda] for the main dev
machine, with pnpm dev:app:cpu / build:app:cpu (--no-default-features) for
CPU-only machines and CI. Also trims unused deps (log, uuid, tokio-full,
chrono-serde). Verified: cargo check --locked --no-default-features passes.
This commit is contained in:
2026-06-12 18:41:32 +01:00
parent 1d782a6d57
commit 1629339569
3 changed files with 10 additions and 24 deletions
+2
View File
@@ -9,6 +9,8 @@
"build:vite": "tsc && vite build", "build:vite": "tsc && vite build",
"clean:app": "cd src-tauri && cargo clean", "clean:app": "cd src-tauri && cargo clean",
"dev:app": "tauri dev", "dev:app": "tauri dev",
"dev:app:cpu": "tauri dev -- --no-default-features",
"build:app:cpu": "tauri build -- --no-default-features",
"dev:vite": "vite", "dev:vite": "vite",
"preview": "vite preview", "preview": "vite preview",
"tauri": "tauri" "tauri": "tauri"
-16
View File
@@ -4439,7 +4439,6 @@ dependencies = [
"hnsw_rs", "hnsw_rs",
"image", "image",
"kamadak-exif", "kamadak-exif",
"log",
"memmap2", "memmap2",
"mozjpeg", "mozjpeg",
"notify", "notify",
@@ -4461,7 +4460,6 @@ dependencies = [
"tokenizers", "tokenizers",
"tokio", "tokio",
"ureq", "ureq",
"uuid",
"walkdir", "walkdir",
"xxhash-rust", "xxhash-rust",
"zip 4.6.1", "zip 4.6.1",
@@ -6537,25 +6535,11 @@ dependencies = [
"bytes", "bytes",
"libc", "libc",
"mio 1.2.0", "mio 1.2.0",
"parking_lot",
"pin-project-lite", "pin-project-lite",
"signal-hook-registry",
"socket2", "socket2",
"tokio-macros",
"windows-sys 0.61.2", "windows-sys 0.61.2",
] ]
[[package]]
name = "tokio-macros"
version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.117",
]
[[package]] [[package]]
name = "tokio-native-tls" name = "tokio-native-tls"
version = "0.3.1" version = "0.3.1"
+8 -8
View File
@@ -14,7 +14,9 @@ crate-type = ["staticlib", "cdylib", "rlib"]
tauri-build = { version = "2", features = [] } tauri-build = { version = "2", features = [] }
[features] [features]
default = [] # CUDA is on by default for the main dev machine; build with
# `--no-default-features` (pnpm dev:app:cpu) on machines without the toolkit.
default = ["candle-cuda"]
candle-cuda = ["candle-core/cuda", "candle-nn/cuda", "candle-transformers/cuda"] candle-cuda = ["candle-core/cuda", "candle-nn/cuda", "candle-transformers/cuda"]
[dependencies] [dependencies]
@@ -33,18 +35,16 @@ image = { version = "0.25", default-features = false, features = ["jpeg", "png",
fast_image_resize = { version = "6.0.0", features = ["image"] } fast_image_resize = { version = "6.0.0", features = ["image"] }
walkdir = "2" walkdir = "2"
rayon = "1" rayon = "1"
tokio = { version = "1", features = ["full"] } tokio = { version = "1", features = ["rt-multi-thread"] }
chrono = { version = "0.4", features = ["serde"] } chrono = "0.4"
uuid = { version = "1", features = ["v4"] }
anyhow = "1" anyhow = "1"
log = "0.4"
ffmpeg-sidecar = "2.5.0" ffmpeg-sidecar = "2.5.0"
xxhash-rust = { version = "0.8", features = ["xxh3"] } xxhash-rust = { version = "0.8", features = ["xxh3"] }
memmap2 = "0.9" memmap2 = "0.9"
sysinfo = "0.38.4" sysinfo = "0.38.4"
candle-core = { version = "0.10.2", features = ["cuda"] } candle-core = "0.10.2"
candle-nn = { version = "0.10.2", features = ["cuda"] } candle-nn = "0.10.2"
candle-transformers = { version = "0.10.2", features = ["cuda"] } candle-transformers = "0.10.2"
hf-hub = { version = "0.5.0", default-features = false, features = ["ureq", "native-tls"] } hf-hub = { version = "0.5.0", default-features = false, features = ["ureq", "native-tls"] }
tokenizers = "0.22.1" tokenizers = "0.22.1"
ort = { version = "2.0.0-rc.12", default-features = false, features = ["std", "ndarray", "download-binaries", "copy-dylibs", "load-dynamic", "directml", "api-24", "tls-native"] } ort = { version = "2.0.0-rc.12", default-features = false, features = ["std", "ndarray", "download-binaries", "copy-dylibs", "load-dynamic", "directml", "api-24", "tls-native"] }