mirror of
https://github.com/cap153/LANChat.git
synced 2026-12-06 00:00:33 +00:00
99 lines
3.7 KiB
TOML
99 lines
3.7 KiB
TOML
[package]
|
|
name = "lanchat"
|
|
version = "0.1.5"
|
|
edition = "2021"
|
|
default-run = "lanchat"
|
|
|
|
[lib]
|
|
name = "lanchat"
|
|
crate-type = ["staticlib", "cdylib", "rlib"]
|
|
|
|
# 定义两个独立的二进制入口
|
|
[[bin]]
|
|
name = "lanchat"
|
|
path = "src/main.rs"
|
|
required-features = ["desktop"]
|
|
|
|
[[bin]]
|
|
name = "lanchat-web"
|
|
path = "src/server_main.rs"
|
|
required-features = ["web"]
|
|
|
|
[features]
|
|
default = ["desktop"]
|
|
desktop = ["tauri", "tauri-plugin-shell", "tauri-plugin-fs", "tauri-plugin-dialog", "tauri-plugin-sql", "tauri-plugin-log", "tauri-plugin-single-instance", "tauri-plugin-opener", "tauri-build", "sysinfo", "clipboard-rs", "wl-clipboard-rs"]
|
|
web = ["sysinfo"]
|
|
|
|
[build-dependencies]
|
|
tauri-build = { version = "2.0", features = [], optional = true }
|
|
|
|
[dependencies]
|
|
# 核心 - 所有 Tauri 平台都需要的基础功能
|
|
tauri = { version = "2.0", features = ["protocol-asset"], optional = true }
|
|
tauri-plugin-fs = { version = "2.0", optional = true }
|
|
tauri-plugin-dialog = { version = "2.0", optional = true }
|
|
tauri-plugin-sql = { version = "2.0", features = ["sqlite"], optional = true }
|
|
tauri-plugin-log = { version = "2.0", optional = true }
|
|
tauri-plugin-shell = { version = "2.0", optional = true }
|
|
log = "0.4"
|
|
# 数据库 - 两端都需要
|
|
sqlx = { version = "0.8", features = ["runtime-tokio", "sqlite", "macros"] }
|
|
# Web 服务器 - 两端都需要
|
|
axum = { version = "0.7", features = ["ws", "multipart"] }
|
|
tower-http = { version = "0.5", features = ["fs", "cors"] }
|
|
tokio-tungstenite = "0.24"
|
|
futures-util = "0.3"
|
|
clap = { version = "4.4", features = ["derive"] }
|
|
rust-embed = "8.0"
|
|
# 工具 - 两端都需要
|
|
tokio = { version = "1", features = ["rt", "rt-multi-thread", "net", "time", "sync", "macros", "fs", "io-util"] }
|
|
tokio-util = { version = "0.7", features = ["io"] }
|
|
serde = { version = "1.0", features = ["derive"] }
|
|
serde_json = "1.0"
|
|
chrono = { version = "0.4", default-features = false, features = ["clock", "serde"] }
|
|
uuid = { version = "1.0", features = ["v4"] }
|
|
rand = "0.8"
|
|
mime_guess = "2.0.5"
|
|
socket2 = { version = "0.5", features = ["all"] }
|
|
directories = "5.0"
|
|
dirs = "5.0"
|
|
urlencoding = "2.1"
|
|
sysinfo = { version = "0.30", optional = true }
|
|
|
|
# ━━━ 平台特定依赖(以下均为 [target.'cfg()'.dependencies] ━━━
|
|
|
|
# 桌面端独占的 tauri 功能(托盘、图标解码、单实例、打开文件)
|
|
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
|
tauri = { version = "2.0", features = ["tray-icon", "image-png"], optional = true }
|
|
tauri-plugin-single-instance = { version = "2.0", optional = true }
|
|
tauri-plugin-opener = { version = "2.0", optional = true }
|
|
|
|
# 非 Android 平台:使用 native-tls 和剪贴板
|
|
[target.'cfg(not(target_os = "android"))'.dependencies]
|
|
reqwest = { version = "0.12", default-features = false, features = ["multipart", "json", "native-tls"] }
|
|
clipboard-rs = { version = "0.3.3", optional = true }
|
|
|
|
# Android 平台:使用 rustls-tls(避免 vendored OpenSSL 交叉编译问题)
|
|
[target.'cfg(target_os = "android")'.dependencies]
|
|
reqwest = { version = "0.12", default-features = false, features = ["multipart", "json", "rustls-tls"] }
|
|
jni = "0.21"
|
|
ndk-context = "0.1"
|
|
|
|
# Wayland 剪贴板 - 仅 Linux 桌面端
|
|
[target.'cfg(target_os = "linux")'.dependencies]
|
|
wl-clipboard-rs = { version = "0.9", optional = true }
|
|
|
|
# macOS 和 Android 需要通知插件
|
|
[target.'cfg(any(target_os = "macos", target_os = "android"))'.dependencies]
|
|
tauri-plugin-notification = "2.0"
|
|
|
|
|
|
|
|
# Release 优化配置
|
|
[profile.release]
|
|
strip = true # 移除调试符号
|
|
opt-level = "z" # 优化体积
|
|
lto = true # 链接时优化(thin LTO 更有利于体积)
|
|
codegen-units = 1 # 更好的优化
|
|
panic = "abort" # 减小体积
|