[package]
name = "saudade"
version = "0.5.0"
edition = "2024"
rust-version = "1.88"
description = "Classic looking retained-mode, cross-platform Rust GUI library"
repository = "https://github.com/roblillack/saudade"
license = "MIT"
keywords = ["gui", "ui", "retained-mode", "cross-platform", "widgets"]
categories = ["gui"]

# Test snapshot baselines (2.2 MB of PNGs) and the test fonts are only needed to
# run the test suite, not to build or use the library. Keep them out of the
# published crate.
exclude = ["tests/snapshots", "tests/fonts"]

# saudade-specific cargo-release settings (workspace-wide defaults live in
# release.toml). These rewrites run on each `saudade` release (not the macro
# crate's, since they live in saudade's own package metadata).
[package.metadata.release]
pre-release-replacements = [
    # Keep the README install snippet (`saudade = "…"`) on the new version.
    { file = "README.md", search = 'saudade = "[0-9.]+"', replace = 'saudade = "{{version}}"' },

    # Roll CHANGELOG's [Unreleased] over to the new version and re-seed a fresh
    # [Unreleased] above it (the Keep a Changelog + cargo-release marker idiom).
    # Order matters: the version/date/compare substitutions run first, *then*
    # the markers re-insert the literal "Unreleased"/"ReleaseDate" tokens so the
    # next release finds them again.
    { file = "CHANGELOG.md", search = "Unreleased", replace = "{{version}}" },
    { file = "CHANGELOG.md", search = '\.\.\.HEAD', replace = "...{{tag_name}}", exactly = 1 },
    { file = "CHANGELOG.md", search = "ReleaseDate", replace = "{{date}}" },
    { file = "CHANGELOG.md", search = "<!-- next-header -->", replace = "<!-- next-header -->\n\n## [Unreleased] - ReleaseDate", exactly = 1 },
    { file = "CHANGELOG.md", search = "<!-- next-url -->", replace = "<!-- next-url -->\n[Unreleased]: https://github.com/roblillack/saudade/compare/{{tag_name}}...HEAD", exactly = 1 },
]

# saudade is also the root of a tiny workspace. The only other member is
# `saudade-macros`, the proc-macro crate that backs `include_svg!`. It lives in
# its own crate because a `proc-macro = true` library can't share a crate with
# regular code. Its heavy build-time deps (usvg + kurbo) are confined there and
# never reach saudade's own runtime dependency tree.
[workspace]
members = ["macros"]

# The reference apps in `examples/` are plain Cargo examples — run any of them
# with `cargo run --example <name>` (filer, notepad, picker). They build as
# part of this package, so they're covered by `cargo build --all-targets`.

[dependencies]
# winit drives X11 only. We bypass it entirely on Wayland sessions and
# talk to the compositor through smithay-client-toolkit, which gives us
# real xdg_popup and proper window placement. Disabling winit's Wayland
# features drops `wayland-csd-adwaita` and `wayland-dlopen` from the
# tree as a side benefit. The `x11` feature is a harmless no-op off
# free-unix (winit's X11 platform crates are themselves target-gated).
winit = { version = "0.30", default-features = false, features = ["rwh_06", "x11"] }
softbuffer = "0.4"
fontdue = "0.8"
fontdb = "0.16"
png = "0.17"

# The `include_svg!` proc macro. All of the SVG-parsing weight (usvg, kurbo)
# lives inside this crate and runs only at *compile* time — the macro emits
# plain flattened-polygon data, so nothing from that tree is linked into a
# saudade binary. Path dep for local builds; the version pin lets the crate
# still be published to crates.io.
saudade-macros = { path = "macros", version = "0.2.0" }

# Linux/BSD only: the SCTK Wayland backend (see src/wayland.rs) plus arboard's
# wl-data-control clipboard backend. These crates don't build on macOS/Windows,
# where winit's native windowing and arboard's native clipboard take over.
[target.'cfg(all(unix, not(target_os = "macos")))'.dependencies]
smithay-client-toolkit = "0.19"
wayland-client = "0.31"
wayland-protocols = { version = "0.32", features = ["client", "staging"] }
arboard = { version = "3", default-features = false, features = ["wayland-data-control"] }

# macOS/Windows: arboard with its native (Cocoa / Win32) clipboard backend.
# default-features = false drops the unused `image-data` feature (and the heavy
# `image` crate it pulls in) — we only use the text clipboard.
[target.'cfg(any(target_os = "macos", windows))'.dependencies]
arboard = { version = "3", default-features = false }

[dev-dependencies]
# Snapshot tests decode their baseline PNGs for a tolerant pixel comparison
# (see tests/common/mod.rs). `png` is also a normal dependency above, but
# integration tests only see dev-dependencies, so it's listed again here.
png = "0.17"

# Only the `svg` example uses resvg — it's the *runtime* rasterizer the example
# benchmarks `include_svg!` against (the `include_str!` + parse-at-runtime
# approach control-panel currently uses). It is a dev-dependency, so it never
# ships in the library or in any app that depends on saudade.
resvg = "0.42"
