本指南介绍如何在本地开发和构建 ProxyCast。
# 使用 nvm 安装
nvm install 18
nvm use 18
npm install -g pnpm
# macOS/Linux
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Windows
# 下载并运行 rustup-init.exe
macOS:
xcode-select --install
Windows:
Linux:
sudo apt install libwebkit2gtk-4.1-dev build-essential curl wget file libssl-dev libayatana-appindicator3-dev librsvg2-dev
# 安装依赖
pnpm install
# 启动开发模式
pnpm tauri dev
开发模式特性:
vite.config.ts:
export default defineConfig({
plugins: [react()],
server: {
port: 1420,
strictPort: true,
},
});
src-tauri/tauri.conf.json:
{
"build": {
"devPath": "http://localhost:1420",
"distDir": "../dist"
}
}
# 构建当前平台
pnpm tauri build
# 构建 debug 版本
pnpm tauri build --debug
| 平台 | 产物位置 |
|---|---|
| macOS | src-tauri/target/release/bundle/dmg/ |
| Windows | src-tauri/target/release/bundle/msi/ |
| Linux | src-tauri/target/release/bundle/deb/ |
# 构建 Apple Silicon
pnpm tauri build --target aarch64-apple-darwin
# 构建 Intel
pnpm tauri build --target x86_64-apple-darwin
# 构建 Universal
pnpm tauri build --target universal-apple-darwin
# 构建 64 位
pnpm tauri build --target x86_64-pc-windows-msvc
# 构建 deb 包
pnpm tauri build --target x86_64-unknown-linux-gnu
package.json:{
"version": "1.0.1"
}
src-tauri/Cargo.toml:[package]
version = "1.0.1"
src-tauri/tauri.conf.json:{
"version": "1.0.1"
}
# 创建 tag
git tag v1.0.1
git push origin v1.0.1
项目使用 GitHub Actions 自动构建:
| 平台 | 架构 | Runner |
|---|---|---|
| macOS | arm64 | macos-latest |
| macOS | x64 | macos-13 |
| Windows | x64 | windows-latest |
| Linux | x64 | ubuntu-latest |
开发模式下按 F12 打开开发者工具。
# 启用 Rust 日志
RUST_LOG=debug pnpm tauri dev
| 平台 | 路径 |
|---|---|
| macOS | ~/Library/Logs/ProxyCast/ |
| Windows | %APPDATA%\ProxyCast\logs\ |
| Linux | ~/.local/share/proxycast/logs/ |
# 清理前端
rm -rf node_modules dist
pnpm install
# 清理 Rust
cd src-tauri
cargo clean
macOS 构建需要代码签名:
# 设置签名身份
export APPLE_SIGNING_IDENTITY="Developer ID Application: ..."
Windows 构建可选签名:
# 设置签名证书
export TAURI_SIGNING_PRIVATE_KEY="..."