[workspace]
members = [".", "ddevmem-macros"]

[workspace.package]
version = "0.4.0-alpha.5"
edition = "2021"
authors = ["Dodeca Shaven <dodeca@tutamail.com>"]
repository = "https://github.com/dodeca1337/ddevmem"
license = "MIT"

[package]
name = "ddevmem"
description = "Safe, ergonomic access to physical memory via /dev/mem with volatile MMIO semantics, declarative register maps, and an optional web UI."
readme = "README.md"
keywords = ["devmem", "mmio", "register", "embedded", "hardware"]
categories = ["embedded", "hardware-support", "os::linux-apis"]
documentation = "https://docs.rs/ddevmem"
version.workspace = true
edition.workspace = true
authors.workspace = true
repository.workspace = true
license.workspace = true

[dependencies]
memmap2 = { version = "0.9.10", optional = true }
page_size = "0.6.0"
bytemuck = "1.25.0"
ddevmem-macros = { path = "ddevmem-macros", version = "=0.4.0-alpha.5", optional = true }
axum = { version = "0.8", optional = true }
tokio = { version = "1", features = ["sync"], optional = true }
serde = { version = "1", features = ["derive"], optional = true }
serde_json = { version = "1", optional = true }
base64 = { version = "0.22.1", optional = true }
subtle = { version = "2.6.1", optional = true }

# Self-dev-dependency: when Cargo builds examples / tests / benches it
# unifies features from `[dependencies]` and `[dev-dependencies]`. Pulling
# the crate in here with `emulator` activates that feature for every
# example build without changing `[features].default`. Downstream users
# are unaffected (dev-deps don't propagate). `src/devmem.rs` lets
# `emulator` win when both backends are enabled simultaneously.
[dev-dependencies]
ddevmem = { path = ".", features = ["emulator"] }

[build-dependencies]
# Used by build.rs to minify src/web_ui.html into OUT_DIR. Always compiled
# (Cargo has no clean way to gate build-deps on feature flags), but the
# minifier is pure Rust and fast.
minify-html = "0.18.1"

[features]
default = ["device", "register-map", "web"]
register-map = ["ddevmem-macros"]
device = ["memmap2"]
emulator = []
web = [
    "register-map",
    "ddevmem-macros/web",
    "axum",
    "tokio",
    "serde",
    "serde_json",
    "base64",
    "subtle",
]

[[example]]
name = "bitfield"
required-features = ["register-map", "emulator"]

[[example]]
name = "default_bus"
required-features = ["register-map", "emulator"]

[[example]]
name = "web_server"
required-features = ["web", "emulator"]

[[example]]
name = "web_auth"
required-features = ["web", "emulator"]

[[example]]
name = "web_showcase"
required-features = ["web", "emulator"]

[[example]]
name = "web_same_map"
required-features = ["web", "emulator"]

[[example]]
name = "typed_bitfield"
required-features = ["register-map", "emulator"]

[[example]]
name = "array_regs"
required-features = ["register-map", "emulator"]
