[package]
name = "hello-agent"
version = "0.1.0"
edition = "2021"
rust-version = "1.75"
description = "Headless RustDesk-protocol-compatible support agent for Windows"
publish = false

[[bin]]
name = "hello-agent"
path = "src/main.rs"

# The full RustDesk protocol stack is vendored under `vendor/rustdesk/`.
# We consume it as a path dependency on the `librustdesk` crate (the rlib
# crate-type in its Cargo.toml's [lib] section is what makes this work).
#
# We deliberately turn off rustdesk's `flutter` feature: we don't ship the
# Flutter UI. We keep `hwcodec` for parity with the upstream Windows build
# and `vram` for hardware-accelerated encoding paths.
[dependencies]
# The vendored rustdesk crate's [package] name is "rustdesk" but its [lib]
# name is "librustdesk". `package = "rustdesk"` aliases it so we can keep
# `use librustdesk::…` in source.
librustdesk = { package = "rustdesk", path = "vendor/rustdesk", default-features = false, features = ["use_dasp", "hwcodec", "vram"] }
hbb_common  = { path = "vendor/rustdesk/libs/hbb_common" }

tokio       = { version = "1", features = ["rt-multi-thread", "macros", "sync", "time", "io-util"] }
log         = "0.4"
env_logger  = "0.10"
anyhow      = "1"

[target.'cfg(target_os = "windows")'.dependencies]
windows-service = "0.6"
winapi          = { version = "0.3", features = ["winuser", "wtsapi32", "processthreadsapi", "synchapi", "handleapi", "winbase"] }
winreg          = "0.11"

# Embed the icon and EXE metadata via the Windows resource compiler.
# Same crate (and version) the vendored rustdesk uses for its own icon —
# keeping them in lockstep avoids a duplicate `winres` in Cargo.lock.
#
# Unconditional rather than target-gated: build.rs runs on the *host* and
# decides via `CARGO_CFG_TARGET_OS` whether the target is Windows. A
# host-conditional build-dep would hide winres on a Linux/macOS host even
# when cross-compiling to Windows.
[build-dependencies]
winres = "0.1"

# Match upstream's release profile so the resulting binary has the same
# stripping / LTO behavior. Diverging here would surprise CI.
[profile.release]
lto = true
codegen-units = 1
panic = "abort"
strip = true

# Mirror the [patch.crates-io] from the vendored rustdesk Cargo.toml. Cargo
# only honors [patch] at the *outermost* workspace root, so we have to
# repeat it here. (The Linux-only libxdo-sys-stub avoids requiring libxdo
# on the build host; on Windows it's conditionally compiled out anyway, but
# keeping the patch makes a future Linux build configuration easier.)
[patch.crates-io]
libxdo-sys = { path = "vendor/rustdesk/libs/libxdo-sys-stub" }
