[workspace]
members = ["crates/forth", "crates/markdown", "crates/project", "crates/ratatui", "plugins/cagire-plugins", "plugins/baseview", "plugins/egui-baseview", "plugins/nih-plug-egui", "xtask"]

[workspace.package]
version = "0.0.9"
edition = "2021"
authors = ["Raphaël Forment <raphael.forment@gmail.com>"]
license = "AGPL-3.0"
repository = "https://github.com/Bubobubobubobubo/cagire"
homepage = "https://cagire.raphaelforment.fr"
description = "Forth-based live coding music sequencer"

[package]
name = "cagire"
version.workspace = true
edition.workspace = true
authors.workspace = true
license.workspace = true
repository.workspace = true
homepage.workspace = true
description.workspace = true

[lib]
name = "cagire"
path = "src/lib.rs"

[[bin]]
name = "cagire"
path = "src/main.rs"

[[bin]]
name = "cagire-desktop"
path = "src/bin/desktop/main.rs"
required-features = ["desktop"]

[features]
default = ["cli"]
cli = ["dep:cpal", "dep:midir", "dep:confy", "dep:clap", "dep:thread-priority"]
block-renderer = ["dep:soft_ratatui", "dep:rustc-hash", "dep:egui"]
desktop = [
    "cli",
    "block-renderer",
    "cagire-forth/desktop",
    "dep:eframe",
    "dep:egui_ratatui",
    "dep:image",
]

[dependencies]
cagire-forth = { path = "crates/forth" }
cagire-markdown = { path = "crates/markdown" }
cagire-project = { path = "crates/project" }
cagire-ratatui = { path = "crates/ratatui" }
doux = { git = "https://github.com/sova-org/doux", features = ["native", "soundfont"] }
rusty_link = "0.4"
ratatui = "0.30"
crossterm = "0.29"
cpal = { version = "0.17", optional = true }
clap = { version = "4", features = ["derive"], optional = true }
rand = "0.8"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tachyonfx = { version = "0.22", features = ["std-duration"] }
tui-big-text = "0.8"
arboard = "3"
minimad = "0.13"
crossbeam-channel = "0.5"
confy = { version = "2", optional = true }
rustfft = "6"
thread-priority = { version = "1", optional = true }
ringbuf = "0.4"
arc-swap = "1"
midir = { version = "0.10", optional = true }
parking_lot = "0.12"
libc = "0.2"

# Desktop-only dependencies (behind feature flag)
egui = { version = "0.33", optional = true }
eframe = { version = "0.33", optional = true }
egui_ratatui = { version = "2.1", optional = true }
soft_ratatui = { version = "0.1.3", features = ["unicodefonts"], optional = true }
rustc-hash = { version = "2", optional = true }
image = { version = "0.25", default-features = false, features = ["png"], optional = true }


[target.'cfg(target_os = "linux")'.dependencies]
cpal = { version = "0.17", optional = true, features = ["jack"] }

[target.'cfg(windows)'.build-dependencies]
winres = "0.1"

[profile.release]
opt-level = 3
lto = "fat"
codegen-units = 1
panic = "abort"
strip = true

[patch."https://github.com/robbert-vdh/nih-plug"]
nih_plug_egui = { path = "plugins/nih-plug-egui" }

[patch."https://github.com/BillyDM/egui-baseview.git"]
egui-baseview = { path = "plugins/egui-baseview" }

[patch."https://github.com/RustAudio/baseview.git"]
baseview = { path = "plugins/baseview" }

[package.metadata.bundle.bin.cagire-desktop]
name = "Cagire"
identifier = "com.sova.cagire"
icon = ["assets/Cagire.icns", "assets/Cagire.ico", "assets/Cagire.png"]
copyright = "Copyright (c) 2025 Raphaël Forment"
category = "Music"
short_description = "Forth-based music sequencer"
minimum_system_version = "12.0"
