Skip to content

Commit

Permalink
nostd support with c-scape
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanisaacs committed Jan 30, 2023
1 parent 33c857c commit 8ddc8f5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mustang/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ features = [
[target.'cfg(target_vendor = "mustang")'.dependencies]
origin = { path = "../origin", default-features = false, version = "^0.6.1" }
c-gull = { path = "../c-gull", version = "^0.6.1", optional = true }
c-scape = { path = "../c-scape", version = "^0.6.1", default-features = false, optional = true }

# A general-purpose `global_allocator` implementation.
dlmalloc = { version = "0.2", features = ["global"], optional = true }
Expand All @@ -42,9 +43,12 @@ wee_alloc = { version = "0.4", optional = true }

[features]
default = ["default-alloc", "threads", "std"]
default-nostd = ["default-alloc", "nostd-threads", "nostd"]
default-alloc = ["dlmalloc"]
threads = ["origin/threads", "c-gull/threads"]
env_logger = ["origin/env_logger"]
log = ["origin/log"]
max_level_off = ["origin/max_level_off"]
std = ["c-gull"]
nostd-threads = ["origin/threads", "c-scape/threads"]
nostd = ["c-scape"]
8 changes: 8 additions & 0 deletions mustang/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ macro_rules! can_run_this {
#[cfg(feature = "std")]
#[cfg(target_vendor = "mustang")]
extern crate c_gull;
#[cfg(feature = "nostd")]
#[cfg(target_vendor = "mustang")]
extern crate c_scape;
#[cfg(target_vendor = "mustang")]
extern crate origin;
#[cfg(not(target_arch = "arm"))]
Expand All @@ -50,3 +53,8 @@ static GLOBAL_ALLOCATOR: wee_alloc::WeeAlloc<'static> = wee_alloc::WeeAlloc::INI
#[cfg(target_vendor = "mustang")]
#[cfg(not(any(feature = "dlmalloc", feature = "wee_alloc")))]
compile_error!("Either feature \"dlmalloc\" or \"wee_alloc\" must be enabled for this crate.");

// `c-gull` contains `c-scape`, thus do not want to extern both crates
#[cfg(target_vendor = "mustang")]
#[cfg(all(feature = "std", feature = "nostd"))]
compile_error!("\"std\" and \"nostd\" cannot both be enabled for this crate.");

0 comments on commit 8ddc8f5

Please sign in to comment.