This commit is contained in:
2026-09-14 17:40:01 +08:00
parent 96b15ab6ca
commit be142da78b
6 changed files with 172 additions and 92 deletions
+16 -18
View File
@@ -1,28 +1,28 @@
@echo off
REM Build dsh-launcher.exe for Windows (amd64).
REM
REM 用法: scripts\build-windows.bat
REM Usage: scripts\build-windows.bat
REM
REM 前置依赖(Windows 上装好后):
REM - Go 1.21+ https://go.dev/dl/
REM - Node.js 18+ https://nodejs.org/
REM - Wails CLI go install github.com/wailsapp/wails/v2/cmd/wails@latest
REM - WebView2 Runtime Win10 1803+ 自带,否则 https://aka.ms/webview2
REM - MSVC build tools https://visualstudio.microsoft.com/downloads/ (Build Tools for Visual Studio, 勾选 "Desktop development with C++")
REM Prerequisites on Windows:
REM - Go 1.21+ https://go.dev/dl/
REM - Node.js 18+ https://nodejs.org/
REM - Wails CLI go install github.com/wailsapp/wails/v2/cmd/wails@latest
REM - WebView2 Runtime Win10 1803+ ships it, else https://aka.ms/webview2
REM - MSVC build tools https://visualstudio.microsoft.com/downloads/ (Build Tools, "Desktop development with C++")
REM
REM 注意: Wails v2 的 Windows build 需要 MSVC toolchain (cgo 编译 webview2 loader)。
REM 不能在 macOS / Linux 上 cross-compile 出 .exe。
REM Note: Wails v2 Windows build needs MSVC toolchain (cgo for webview2 loader).
REM Cannot cross-compile .exe from macOS / Linux.
REM
REM 产物: build\bin\dsh-launcher.exe
REM Output: build\bin\dsh-launcher.exe
setlocal enabledelayedexpansion
cd /d "%~dp0\.."
echo ^>^> dsh-launcher · Windows build
echo ^>^> dsh-launcher Windows build
echo.
REM 1. 基础工具检查
REM 1. Tool check
where go >nul 2>nul
if errorlevel 1 (
echo [X] go not installed
@@ -44,13 +44,13 @@ if errorlevel 1 (
exit /b 1
)
REM 2. 检查 WINDOWS 环境
REM 2. Must run on Windows
if not "%OS%"=="Windows_NT" (
echo [X] must run on Windows, current: %OS%
exit /b 1
)
REM 3. 同步前端依赖
REM 3. Sync frontend deps
echo ^>^> npm install
cd frontend
call npm install
@@ -60,7 +60,7 @@ if errorlevel 1 (
)
cd ..
REM 4. 编译
REM 4. Build
echo.
echo ^>^> wails build
wails build -clean -platform windows/amd64
@@ -69,7 +69,7 @@ if errorlevel 1 (
exit /b 1
)
REM 5. 校验产物
REM 5. Verify
set EXE=build\bin\dsh-launcher.exe
if not exist "%EXE%" (
echo [X] %EXE% not found
@@ -78,8 +78,6 @@ if not exist "%EXE%" (
echo.
echo [OK] exe: %EXE%
echo size: %~z1 bytes
echo.
echo run: %EXE%
echo build dir: build\bin\
echo.