跳转至

crates\nfarms-gui\Cargo.toml

源码路径:crates\nfarms-gui\Cargo.toml · 45 行

[package]
name = "nfarms-gui"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
description = "NFarms HUB 图形界面(egui/eframe):C# 版 MainForm.cs 的等价移植,Windows 与 Android 共用"

[features]
# 安卓构建时由 nfarms-mobile 打开。
#
# 为什么做成 feature 而不是直接写死:eframe 的 Android 后端会拉进
# `android-activity`,那是个纯安卓的 crate。写死的话 Windows 构建也会去编它;
# 做成 feature 之后,桌面构建**完全不碰**安卓相关依赖。
android = ["eframe/android-native-activity"]

[dependencies]
eframe = { version = "0.32.3", default-features = false, features = ["glow", "default_fonts"] }
# 背景图片解码:png / jpeg / bmp / webp —— 覆盖日常所有照片、截图与网页图。
# 不开 gif:动图当背景没意义,还会白拖一个 color_quant。
image = { version = "0.25.9", default-features = false, features = ["png", "jpeg", "bmp", "webp"] }
nfarms-core = { path = "../nfarms-core" }
# 插件内核(cordis 风格)。零依赖,桌面和安卓 .so 共用同一份。
nfarms-plugin = { path = "../nfarms-plugin" }

# 安卓入口点要拿到 `AndroidApp` 类型;eframe 不 re-export winit,所以这里直接依赖。
# 只在安卓目标下引入 —— Windows 构建里根本没有这个依赖。
#
# `default-features = false` 很重要:winit 的默认特性是 x11 / wayland /
# wayland-csd-adwaita 这些 **Linux** 后端,安卓上完全用不到,开着只会白拉一堆包。
# eframe 自己那份 winit 依赖会按需开它要的特性,两边不冲突。
[target.'cfg(target_os = "android")'.dependencies]
winit = { version = "0.30", default-features = false }

# 桌宠的**真透明**只能靠 Win32 分层窗口(`UpdateLayeredWindow` 逐像素 alpha)。
# egui 的立即视口做不到 —— 它渲染进父窗口那一帧,没有自己的 GL 表面,
# `with_transparent(true)` 会被忽略(实测只得到不透明黑块)。
# 只给 Windows 编;安卓那边桌宠这套本来也没有。
[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.61", features = [
    "Win32_Foundation",
    "Win32_Graphics_Gdi",
    "Win32_System_LibraryLoader",
    "Win32_UI_Input_KeyboardAndMouse",
    "Win32_UI_WindowsAndMessaging",
] }