From 8651e39ca8cada3fcb9023f7bd01df28ee5caeb1 Mon Sep 17 00:00:00 2001 From: John Smith Date: Mon, 29 May 2023 20:13:06 -0400 Subject: [PATCH] macos build for veilid-cli --- Cargo.lock | 13 +++++++++ external/cursive | 2 +- veilid-cli/Cargo-macos.toml | 54 ------------------------------------- veilid-cli/Cargo.toml | 1 + veilid-cli/src/ui.rs | 4 +-- 5 files changed, 17 insertions(+), 57 deletions(-) delete mode 100644 veilid-cli/Cargo-macos.toml diff --git a/Cargo.lock b/Cargo.lock index 8c855857..047c015a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1428,6 +1428,8 @@ dependencies = [ "lazy_static", "libc", "log", + "maplit", + "ncurses", "signal-hook", "tokio 1.28.2", "unicode-segmentation", @@ -3229,6 +3231,17 @@ dependencies = [ "socket2 0.4.9", ] +[[package]] +name = "ncurses" +version = "5.101.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e2c5d34d72657dc4b638a1c25d40aae81e4f1c699062f72f467237920752032" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + [[package]] name = "ndk" version = "0.7.0" diff --git a/external/cursive b/external/cursive index 31ea07fd..250d35f3 160000 --- a/external/cursive +++ b/external/cursive @@ -1 +1 @@ -Subproject commit 31ea07fde2191be2ff8eb7c46c6fc2a1bfd8e311 +Subproject commit 250d35f37f526221539c8d59d7a2056803bf0010 diff --git a/veilid-cli/Cargo-macos.toml b/veilid-cli/Cargo-macos.toml deleted file mode 100644 index a88b7c65..00000000 --- a/veilid-cli/Cargo-macos.toml +++ /dev/null @@ -1,54 +0,0 @@ -[package] -name = "veilid-cli" -version = "0.1.0" -authors = ["John Smith "] -edition = "2021" -build = "build.rs" -license = "LGPL-2.0-or-later OR MPL-2.0 OR (MIT AND BSD-3-Clause)" - -[[bin]] -name = "veilid-cli" -path = "src/main.rs" - -[features] -default = [ "rt-tokio" ] -rt-async-std = [ "async-std", "veilid-core/rt-async-std", "cursive-ncurses/rt-async-std", "cursive-crossterm/rt-async-std" ] -rt-tokio = [ "tokio", "tokio-util", "veilid-core/rt-tokio", "cursive-ncurses/rt-tokio", "cursive-crossterm/rt-tokio" ] - -[dependencies] -async-std = { version = "^1.9", features = ["unstable", "attributes"], optional = true } -tokio = { version = "^1", features = ["full"], optional = true } -tokio-util = { version = "^0", features = ["compat"], optional = true} -async-tungstenite = { version = "^0.8" } -cursive-flexi-logger-view = { path = "../external/cursive-flexi-logger-view" } -cursive_buffered_backend = { path = "../external/cursive_buffered_backend" } -cursive = { path = "../external/cursive/cursive", default-features = false, features = [ "ncurses-backend", "toml", "ansi" ]} -# cursive-multiplex = "0.6.0" -# cursive_tree_view = "0.6.0" -cursive_table_view = "0.14.0" -# cursive-tabs = "0.5.0" -clap = "^3" -directories = "^4" -log = "^0" -futures = "^0" -serde = "^1" -serde_derive = "^1" -parking_lot = "^0" -cfg-if = "^1" -capnp = "^0" -capnp-rpc = "^0" -config = { version = "^0", features = ["yaml"] } -bugsalot = { git = "https://github.com/crioux/bugsalot.git" } -flexi_logger = { version = "^0", features = ["use_chrono_for_offset"] } -thiserror = "^1" -crossbeam-channel = "^0" -hex = "^0" -veilid-core = { path = "../veilid-core" } -json = "^0" - - -[dev-dependencies] -serial_test = "^0" - -[build-dependencies] -capnpc = "^0" diff --git a/veilid-cli/Cargo.toml b/veilid-cli/Cargo.toml index db13cee5..f98dd173 100644 --- a/veilid-cli/Cargo.toml +++ b/veilid-cli/Cargo.toml @@ -12,6 +12,7 @@ path = "src/main.rs" [features] default = [ "rt-tokio" ] +macos = [ "cursive/ncurses-backend" ] rt-async-std = [ "async-std", "veilid-core/rt-async-std", "cursive/rt-async-std" ] rt-tokio = [ "tokio", "tokio-util", "veilid-core/rt-tokio", "cursive/rt-tokio" ] diff --git a/veilid-cli/src/ui.rs b/veilid-cli/src/ui.rs index 5fa5a2dc..48b38db9 100644 --- a/veilid-cli/src/ui.rs +++ b/veilid-cli/src/ui.rs @@ -710,9 +710,9 @@ impl UI { // Instantiate the cursive runnable let runnable = CursiveRunnable::new( || -> Result, Box> { - #[cfg(target_os = "macos")] + #[cfg(feature = "macos")] let backend = cursive::backends::curses::n::Backend::init().unwrap(); - #[cfg(not(target_os = "macos"))] + #[cfg(not(feature = "macos"))] let backend = cursive::backends::crossterm::Backend::init().unwrap(); let buffered_backend = cursive_buffered_backend::BufferedBackend::new(backend); Ok(Box::new(buffered_backend))