You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
1.9 KiB
87 lines
1.9 KiB
@echo off
|
|
REM Build pi-launcher.exe for Windows (amd64).
|
|
REM
|
|
REM 用法: 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
|
|
REM 注意: Wails v2 的 Windows build 需要 MSVC toolchain (cgo 编译 webview2 loader)。
|
|
REM 不能在 macOS / Linux 上 cross-compile 出 .exe。
|
|
REM
|
|
REM 产物: build\bin\pi-launcher.exe
|
|
|
|
setlocal enabledelayedexpansion
|
|
|
|
cd /d "%~dp0\.."
|
|
|
|
echo ^>^> pi-launcher · Windows build
|
|
echo.
|
|
|
|
REM 1. 基础工具检查
|
|
where go >nul 2>nul
|
|
if errorlevel 1 (
|
|
echo [X] go not installed
|
|
exit /b 1
|
|
)
|
|
where node >nul 2>nul
|
|
if errorlevel 1 (
|
|
echo [X] node not installed
|
|
exit /b 1
|
|
)
|
|
where npm >nul 2>nul
|
|
if errorlevel 1 (
|
|
echo [X] npm not installed
|
|
exit /b 1
|
|
)
|
|
where wails >nul 2>nul
|
|
if errorlevel 1 (
|
|
echo [X] wails CLI not installed - run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
|
|
exit /b 1
|
|
)
|
|
|
|
REM 2. 检查 WINDOWS 环境
|
|
if not "%OS%"=="Windows_NT" (
|
|
echo [X] must run on Windows, current: %OS%
|
|
exit /b 1
|
|
)
|
|
|
|
REM 3. 同步前端依赖
|
|
echo ^>^> npm install
|
|
cd frontend
|
|
call npm install
|
|
if errorlevel 1 (
|
|
echo [X] npm install failed
|
|
exit /b 1
|
|
)
|
|
cd ..
|
|
|
|
REM 4. 编译
|
|
echo.
|
|
echo ^>^> wails build
|
|
wails build -clean -platform windows/amd64
|
|
if errorlevel 1 (
|
|
echo [X] wails build failed
|
|
exit /b 1
|
|
)
|
|
|
|
REM 5. 校验产物
|
|
set EXE=build\bin\pi-launcher.exe
|
|
if not exist "%EXE%" (
|
|
echo [X] %EXE% not found
|
|
exit /b 1
|
|
)
|
|
|
|
echo.
|
|
echo [OK] exe: %EXE%
|
|
echo size: %~z1 bytes
|
|
echo.
|
|
echo run: %EXE%
|
|
echo build dir: build\bin\
|
|
echo.
|
|
|
|
endlocal |