update
This commit is contained in:
28
cmd/build.windows_linux.bat
Normal file
28
cmd/build.windows_linux.bat
Normal file
@@ -0,0 +1,28 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
:: 设置目标平台为 Linux 和 amd64
|
||||
set GOOS=linux
|
||||
set GOARCH=amd64
|
||||
|
||||
:: 可选:设置编译输出目录
|
||||
set OUTPUT_DIR=../bin
|
||||
|
||||
:: 确保输出目录存在
|
||||
if not exist %OUTPUT_DIR% (
|
||||
mkdir %OUTPUT_DIR%
|
||||
)
|
||||
|
||||
:: 编译 Go 程序
|
||||
go build -o %OUTPUT_DIR%/client_linux main.go
|
||||
|
||||
:: 检查编译结果
|
||||
if %ERRORLEVEL% NEQ 0 (
|
||||
echo 编译失败!
|
||||
exit /b %ERRORLEVEL%
|
||||
)
|
||||
|
||||
echo 编译成功!可执行文件位于 %OUTPUT_DIR%/client_linux
|
||||
|
||||
endlocal
|
||||
pause
|
||||
Reference in New Issue
Block a user