feat: 添加跨平台编译脚本和构建文档
- 添加Windows和Linux/macOS编译脚本 - 支持多架构编译(amd64/arm64) - 生成各平台可执行文件到dist目录 - 添加构建使用说明文档
This commit is contained in:
parent
cb21ee9918
commit
ff8885017f
|
|
@ -0,0 +1,67 @@
|
||||||
|
# System Toast - 跨平台系统通知应用
|
||||||
|
|
||||||
|
这是一个简单的跨平台系统通知应用,支持Windows、macOS和Linux系统。
|
||||||
|
|
||||||
|
## 编译输出
|
||||||
|
|
||||||
|
应用已编译为以下平台和架构:
|
||||||
|
|
||||||
|
### Windows
|
||||||
|
- `dist/windows/system-toast-windows-amd64.exe` - Windows 64位 (AMD64)
|
||||||
|
- `dist/windows/system-toast-windows-arm64.exe` - Windows 64位 (ARM64)
|
||||||
|
|
||||||
|
### macOS
|
||||||
|
- `dist/macos/system-toast-macos-amd64` - macOS Intel 64位
|
||||||
|
- `dist/macos/system-toast-macos-arm64` - macOS Apple Silicon (M1/M2)
|
||||||
|
|
||||||
|
### Linux
|
||||||
|
- `dist/linux/system-toast-linux-amd64` - Linux 64位 (AMD64)
|
||||||
|
- `dist/linux/system-toast-linux-arm64` - Linux 64位 (ARM64)
|
||||||
|
|
||||||
|
## 使用方法
|
||||||
|
|
||||||
|
### Windows
|
||||||
|
```cmd
|
||||||
|
system-toast-windows-amd64.exe -message "你的消息内容" -title "通知标题"
|
||||||
|
```
|
||||||
|
|
||||||
|
### macOS
|
||||||
|
```bash
|
||||||
|
./system-toast-macos-amd64 -message "你的消息内容" -title "通知标题"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Linux
|
||||||
|
```bash
|
||||||
|
./system-toast-linux-amd64 -message "你的消息内容" -title "通知标题"
|
||||||
|
```
|
||||||
|
|
||||||
|
## 参数说明
|
||||||
|
|
||||||
|
- `-message` (必需): 通知消息内容
|
||||||
|
- `-title` (可选): 通知标题,默认为"提醒"
|
||||||
|
|
||||||
|
## 示例
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Windows
|
||||||
|
system-toast-windows-amd64.exe -message "任务已完成" -title "系统通知"
|
||||||
|
|
||||||
|
# macOS
|
||||||
|
./system-toast-macos-amd64 -message "任务已完成" -title "系统通知"
|
||||||
|
|
||||||
|
# Linux
|
||||||
|
./system-toast-linux-amd64 -message "任务已完成" -title "系统通知"
|
||||||
|
```
|
||||||
|
|
||||||
|
## 重新编译
|
||||||
|
|
||||||
|
如需重新编译,可以运行以下脚本:
|
||||||
|
|
||||||
|
- Windows: `build.bat`
|
||||||
|
- Linux/macOS: `build.sh`
|
||||||
|
|
||||||
|
## 注意事项
|
||||||
|
|
||||||
|
- 在Linux系统上需要安装`libnotify-bin`包才能使用通知功能
|
||||||
|
- macOS系统会自动使用内置的通知系统
|
||||||
|
- Windows系统使用PowerShell的Toast通知功能
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
@echo off
|
||||||
|
chcp 65001 >nul
|
||||||
|
echo Building system notification application...
|
||||||
|
|
||||||
|
:: Set Go path
|
||||||
|
set GO_EXE="C:\Program Files\Go\bin\go.exe"
|
||||||
|
|
||||||
|
:: Create output directories
|
||||||
|
if not exist "dist" mkdir dist
|
||||||
|
if not exist "dist\windows" mkdir dist\windows
|
||||||
|
if not exist "dist\macos" mkdir dist\macos
|
||||||
|
if not exist "dist\linux" mkdir dist\linux
|
||||||
|
|
||||||
|
:: Windows AMD64
|
||||||
|
echo Building Windows AMD64...
|
||||||
|
set GOOS=windows
|
||||||
|
set GOARCH=amd64
|
||||||
|
%GO_EXE% build -o dist/windows/system-toast-windows-amd64.exe main.go
|
||||||
|
|
||||||
|
:: Windows ARM64
|
||||||
|
echo Building Windows ARM64...
|
||||||
|
set GOOS=windows
|
||||||
|
set GOARCH=arm64
|
||||||
|
%GO_EXE% build -o dist/windows/system-toast-windows-arm64.exe main.go
|
||||||
|
|
||||||
|
:: macOS AMD64
|
||||||
|
echo Building macOS AMD64...
|
||||||
|
set GOOS=darwin
|
||||||
|
set GOARCH=amd64
|
||||||
|
%GO_EXE% build -o dist/macos/system-toast-macos-amd64 main.go
|
||||||
|
|
||||||
|
:: macOS ARM64 (Apple Silicon)
|
||||||
|
echo Building macOS ARM64...
|
||||||
|
set GOOS=darwin
|
||||||
|
set GOARCH=arm64
|
||||||
|
%GO_EXE% build -o dist/macos/system-toast-macos-arm64 main.go
|
||||||
|
|
||||||
|
:: Linux AMD64
|
||||||
|
echo Building Linux AMD64...
|
||||||
|
set GOOS=linux
|
||||||
|
set GOARCH=amd64
|
||||||
|
%GO_EXE% build -o dist/linux/system-toast-linux-amd64 main.go
|
||||||
|
|
||||||
|
:: Linux ARM64
|
||||||
|
echo Building Linux ARM64...
|
||||||
|
set GOOS=linux
|
||||||
|
set GOARCH=arm64
|
||||||
|
%GO_EXE% build -o dist/linux/system-toast-linux-arm64 main.go
|
||||||
|
|
||||||
|
echo Build completed!
|
||||||
|
echo Output directory: dist\
|
||||||
|
pause
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "正在编译系统通知应用..."
|
||||||
|
|
||||||
|
# 创建输出目录
|
||||||
|
mkdir -p dist/{windows,macos,linux}
|
||||||
|
|
||||||
|
# Windows AMD64
|
||||||
|
echo "编译 Windows AMD64..."
|
||||||
|
GOOS=windows GOARCH=amd64 go build -o dist/windows/system-toast-windows-amd64.exe main.go
|
||||||
|
|
||||||
|
# Windows ARM64
|
||||||
|
echo "编译 Windows ARM64..."
|
||||||
|
GOOS=windows GOARCH=arm64 go build -o dist/windows/system-toast-windows-arm64.exe main.go
|
||||||
|
|
||||||
|
# macOS AMD64
|
||||||
|
echo "编译 macOS AMD64..."
|
||||||
|
GOOS=darwin GOARCH=amd64 go build -o dist/macos/system-toast-macos-amd64 main.go
|
||||||
|
|
||||||
|
# macOS ARM64 (Apple Silicon)
|
||||||
|
echo "编译 macOS ARM64..."
|
||||||
|
GOOS=darwin GOARCH=arm64 go build -o dist/macos/system-toast-macos-arm64 main.go
|
||||||
|
|
||||||
|
# Linux AMD64
|
||||||
|
echo "编译 Linux AMD64..."
|
||||||
|
GOOS=linux GOARCH=amd64 go build -o dist/linux/system-toast-linux-amd64 main.go
|
||||||
|
|
||||||
|
# Linux ARM64
|
||||||
|
echo "编译 Linux ARM64..."
|
||||||
|
GOOS=linux GOARCH=arm64 go build -o dist/linux/system-toast-linux-arm64 main.go
|
||||||
|
|
||||||
|
echo "编译完成!"
|
||||||
|
echo "输出目录: dist/"
|
||||||
Loading…
Reference in New Issue