make qrcode stuff optional desktop

This commit is contained in:
Joe Ardent 2023-08-08 13:57:47 -07:00
parent 67c8883254
commit c2ed9702cc
3 changed files with 8 additions and 6 deletions

View file

@ -5,15 +5,15 @@ edition = "2021"
[features] [features]
default = ["desktop"] default = ["desktop"]
desktop = ["dep:eframe", "dep:egui_extras"] desktop = ["dep:clap", "dep:eframe", "dep:egui_extras", "dep:fast_qr", "dep:png"]
[dependencies] [dependencies]
clap = { version = "4.3.19", features = ["derive", "env"] } clap = { version = "4.3", optional = true, features = ["derive", "env"] }
eframe = { version = "0.22", default-features = false, optional = true, features = ["default_fonts", "wgpu", "tts", "accesskit"] } eframe = { version = "0.22", default-features = false, optional = true, features = ["default_fonts", "wgpu", "tts", "accesskit"] }
egui_extras = { version = "0.22", default-features = false, optional = true, features = ["chrono", "image"] } egui_extras = { version = "0.22", default-features = false, optional = true, features = ["chrono", "image"] }
env_logger = "*" env_logger = "*"
fast_qr = { version = "0.9", default-features = false, features = ["image"] } fast_qr = { version = "0.9", optional = true, default-features = false, features = ["image"] }
png = "0.17.6" # pinning this to resolve conflict between eframe and fast_qr with the image crate png = { version = "0.17.6", optional = true } # pinning this to resolve conflict between eframe and fast_qr with the image crate
rand = { version = "0.8", default-features = false, features = ["std", "std_rng"] } rand = { version = "0.8", default-features = false, features = ["std", "std_rng"] }
raptorq = "1.7" raptorq = "1.7"
rkyv = { version = "0.7.42", features = ["validation"] } rkyv = { version = "0.7.42", features = ["validation"] }

View file

@ -7,9 +7,11 @@ use rkyv::{Archive, Deserialize, Serialize};
#[cfg(feature = "desktop")] #[cfg(feature = "desktop")]
mod desktop; mod desktop;
mod util; #[cfg(feature = "desktop")]
mod qr_utils;
pub use util::{get_content, mk_qr_bytes, stream_bytes}; #[cfg(feature = "desktop")]
pub use qr_utils::{get_content, mk_qr_bytes, stream_bytes};
pub type CuttleSender = std::sync::mpsc::SyncSender<Vec<u8>>; pub type CuttleSender = std::sync::mpsc::SyncSender<Vec<u8>>;
pub type CuttleReceiver = std::sync::mpsc::Receiver<Vec<u8>>; pub type CuttleReceiver = std::sync::mpsc::Receiver<Vec<u8>>;