macos build for veilid-cli

This commit is contained in:
John Smith 2023-05-29 20:13:06 -04:00
parent 21009c91d1
commit 8651e39ca8
5 changed files with 17 additions and 57 deletions

13
Cargo.lock generated
View File

@ -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"

2
external/cursive vendored

@ -1 +1 @@
Subproject commit 31ea07fde2191be2ff8eb7c46c6fc2a1bfd8e311
Subproject commit 250d35f37f526221539c8d59d7a2056803bf0010

View File

@ -1,54 +0,0 @@
[package]
name = "veilid-cli"
version = "0.1.0"
authors = ["John Smith <jsmith@example.com>"]
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"

View File

@ -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" ]

View File

@ -710,9 +710,9 @@ impl UI {
// Instantiate the cursive runnable
let runnable = CursiveRunnable::new(
|| -> Result<Box<dyn cursive::backend::Backend>, Box<DumbError>> {
#[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))