-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-desktop.sh
More file actions
executable file
·80 lines (64 loc) · 1.78 KB
/
Copy pathbuild-desktop.sh
File metadata and controls
executable file
·80 lines (64 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
# SocialSim 桌面应用构建脚本
set -e
echo "🚀 开始构建 SocialSim 桌面应用..."
# 颜色定义
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
# 检查依赖
echo -e "${YELLOW}检查构建依赖...${NC}"
# 检查 Rust
if ! command -v cargo &> /dev/null; then
echo -e "${RED}❌ Rust 未安装!请访问 https://rustup.rs/ 安装 Rust${NC}"
exit 1
fi
# 检查 Node.js
if ! command -v npm &> /dev/null; then
echo -e "${RED}❌ Node.js 未安装!${NC}"
exit 1
fi
# 检查 Python/uv
if ! command -v uv &> /dev/null; then
echo -e "${YELLOW}⚠️ uv 未安装,使用 pip 代替${NC}"
UV_CMD="pip"
else
UV_CMD="uv"
fi
echo -e "${GREEN}✅ 依赖检查完成${NC}"
# 1. 构建前端
echo -e "${YELLOW}📦 构建前端...${NC}"
cd frontend
npm install
npm run build
cd ..
echo -e "${GREEN}✅ 前端构建完成${NC}"
# 2. 构建后端(PyInstaller)
echo -e "${YELLOW}📦 构建后端...${NC}"
cd backend
# 安装 PyInstaller
if [ "$UV_CMD" = "uv" ]; then
uv add --dev pyinstaller
else
pip install pyinstaller
fi
# 运行 PyInstaller
pyinstaller build.spec
# 复制后端可执行文件到 Tauri 资源目录
mkdir -p ../src-tauri/resources
cp -r dist/socialsim-backend/* ../src-tauri/resources/
cd ..
echo -e "${GREEN}✅ 后端构建完成${NC}"
# 3. 构建桌面应用(Tauri)
echo -e "${YELLOW}📦 构建桌面应用...${NC}"
cd src-tauri
cargo tauri build --release
cd ..
echo -e "${GREEN}✅ 桌面应用构建完成${NC}"
# 4. 输出结果
echo -e "${GREEN}🎉 构建完成!${NC}"
echo -e "${GREEN}安装包位置:${NC}"
echo -e " macOS: src-tauri/target/release/bundle/dmg/"
echo -e " Windows: src-tauri/target/release/bundle/nsis/"
echo -e " Linux: src-tauri/target/release/bundle/deb/"