From 60c28c10b42c69ee15c326662ad0df76aad563fc Mon Sep 17 00:00:00 2001 From: buncram Date: Tue, 11 Feb 2025 08:36:58 +0800 Subject: [PATCH] patch modals to handle multiple platform targets --- services/modals/Cargo.toml | 16 +++++++++++----- services/modals/src/api.rs | 3 +++ services/modals/src/lib.rs | 3 +++ services/modals/src/main.rs | 3 +++ 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/services/modals/Cargo.toml b/services/modals/Cargo.toml index b927749ed..77cfdfdcf 100644 --- a/services/modals/Cargo.toml +++ b/services/modals/Cargo.toml @@ -19,20 +19,26 @@ rkyv = { version = "0.8.8", default-features = false, features = [ "std", "alloc", ] } -gam = { path = "../gam" } +gam = { path = "../gam", optional = true } trng = { path = "../trng", optional = true } cram-hal-service = { path = "../cram-hal-service", optional = true } # provides trng for cramium-soc -tts-frontend = { path = "../tts" } +tts-frontend = { path = "../tts", optional = true } locales = { path = "../../locales" } bit_field = "0.9.0" +cramium-hal = { path = "../../libs/cramium-hal", optional = true, features = [ + "std", +] } +ux-api = { path = "../../libs/ux-api", optional = true, features = ["std"] } utralib = { version = "0.1.25", optional = true, default-features = false } [features] -precursor = ["utralib/precursor", "trng"] -hosted = ["utralib/hosted", "trng"] -renode = ["utralib/renode", "trng"] +precursor = ["utralib/precursor", "trng", "gam", "tts-frontend"] +hosted = ["utralib/hosted", "trng", "gam", "tts-frontend"] +hosted-baosec = ["ux-api"] +renode = ["utralib/renode", "trng", "gam", "tts-frontend"] cramium-soc = ["utralib/cramium-soc", "cram-hal-service"] + tts = [] ditherpunk = [] hazardous-debug = [] diff --git a/services/modals/src/api.rs b/services/modals/src/api.rs index 83e049c46..e2f0d0a48 100644 --- a/services/modals/src/api.rs +++ b/services/modals/src/api.rs @@ -1,6 +1,9 @@ #[cfg(feature = "ditherpunk")] use gam::Tile; +#[cfg(not(any(feature = "hosted-baosec")))] use gam::modal::*; +#[cfg(any(feature = "hosted-baosec"))] +use ux_api::widgets::*; pub(crate) const SERVER_NAME_MODALS: &str = "_Modal Dialog Server_"; diff --git a/services/modals/src/lib.rs b/services/modals/src/lib.rs index ca63cd53f..503303e41 100644 --- a/services/modals/src/lib.rs +++ b/services/modals/src/lib.rs @@ -12,8 +12,11 @@ use std::cmp::max; use std::convert::TryInto; use bit_field::BitField; +#[cfg(not(any(feature = "hosted-baosec")))] use gam::*; use num_traits::*; +#[cfg(any(feature = "hosted-baosec"))] +use ux_api::widgets::*; use xous::{CID, Message, send_message}; use xous_ipc::Buffer; diff --git a/services/modals/src/main.rs b/services/modals/src/main.rs index bd76008fb..de6908660 100644 --- a/services/modals/src/main.rs +++ b/services/modals/src/main.rs @@ -31,10 +31,13 @@ mod api; use api::*; #[cfg(feature = "ditherpunk")] use gam::Bitmap; +#[cfg(not(any(feature = "hosted-baosec")))] use gam::modal::*; use locales::t; #[cfg(feature = "tts")] use tts_frontend::TtsFrontend; +#[cfg(any(feature = "hosted-baosec"))] +use ux_api::widgets::*; use xous::{Message, msg_blocking_scalar_unpack, msg_scalar_unpack, send_message}; use xous_ipc::Buffer; #[cfg(feature = "tts")]