From ff8885017fbb9540c8c21967acc05d026c606ee5 Mon Sep 17 00:00:00 2001 From: lroyia Date: Fri, 5 Dec 2025 08:58:34 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E8=B7=A8=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E7=BC=96=E8=AF=91=E8=84=9A=E6=9C=AC=E5=92=8C=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加Windows和Linux/macOS编译脚本 - 支持多架构编译(amd64/arm64) - 生成各平台可执行文件到dist目录 - 添加构建使用说明文档 --- BUILD_README.md | 67 +++++++++++++++++++++++++++++++++++++++++++++++++ build.bat | 52 ++++++++++++++++++++++++++++++++++++++ build.sh | 33 ++++++++++++++++++++++++ 3 files changed, 152 insertions(+) create mode 100644 BUILD_README.md create mode 100644 build.bat create mode 100644 build.sh diff --git a/BUILD_README.md b/BUILD_README.md new file mode 100644 index 0000000..ce62121 --- /dev/null +++ b/BUILD_README.md @@ -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通知功能 \ No newline at end of file diff --git a/build.bat b/build.bat new file mode 100644 index 0000000..e3fcdc5 --- /dev/null +++ b/build.bat @@ -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 \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..76e87e7 --- /dev/null +++ b/build.sh @@ -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/" \ No newline at end of file