Turn ftdi and piston into features

This commit is contained in:
Kyan 2025-09-19 18:42:51 +02:00
parent 4f959d217d
commit 6d1f45c92a
5 changed files with 12 additions and 5 deletions

1
Cargo.lock generated
View file

@ -10,7 +10,6 @@ dependencies = [
"ftdi-embedded-hal", "ftdi-embedded-hal",
"image", "image",
"piston_window", "piston_window",
"rgb",
"unreal_asset", "unreal_asset",
"url", "url",
] ]

View file

@ -9,13 +9,17 @@ readme = "README.md"
[dependencies] [dependencies]
clap = { version = "4.5.17", features = ["derive"] } clap = { version = "4.5.17", features = ["derive"] }
ftdi-embedded-hal = { version = "0.22.0", features = ["libftd2xx"] } ftdi-embedded-hal = { version = "0.22.0", features = ["libftd2xx"], optional = true }
image = "0.25.2" image = "0.25.2"
piston_window = "0.132.0" piston_window = { version = "0.132.0", optional = true }
rgb = "0.8.52"
unreal_asset = "0.1.16" unreal_asset = "0.1.16"
url = "2.5.2" url = "2.5.2"
[features]
default = ["ftdi","piston"]
ftdi = ["dep:ftdi-embedded-hal"]
piston = ["dep:piston_window"]
[profile.dev] [profile.dev]
opt-level = 3 opt-level = 3

View file

@ -48,7 +48,9 @@ fn main() {
} }
} }
match args.output.as_str() { match args.output.as_str() {
#[cfg(feature = "piston")]
"piston" => Output::piston(rx), "piston" => Output::piston(rx),
#[cfg(feature = "ftdi")]
"ftd2xx" => Output::ft2dxx(rx), "ftd2xx" => Output::ft2dxx(rx),
_ => { _ => {
match Url::parse(&args.output) { match Url::parse(&args.output) {

View file

@ -1,4 +1,6 @@
mod ft2dxx; #[cfg(feature = "ftdi")]
mod ftd2xx;
#[cfg(feature = "piston")]
mod piston; mod piston;
mod realtimeudp; mod realtimeudp;