chore: init bj_power monorepo (dashboard/mes/wms/wms_client/workstation), clear subproject git metadata and align naming to folder names
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
chcp 65001 >nul
|
||||
|
||||
set "EXE_NAME=spherical-gui"
|
||||
set "OUTPUT_DIR=..\..\bin"
|
||||
set "GOOS=windows"
|
||||
set "GOARCH=amd64"
|
||||
set "VERSION=dev"
|
||||
|
||||
for /f "tokens=*" %%a in ('git rev-parse --short HEAD 2^>nul') do set "COMMIT=%%a"
|
||||
if not defined COMMIT set "COMMIT=unknown"
|
||||
|
||||
for /f "tokens=*" %%a in ('powershell -Command "Get-Date -Format 'yyyy-MM-dd_HH:mm:ss'"') do set "BUILD_TIME=%%a"
|
||||
|
||||
set "LDFLAGS=-s -w -H=windowsgui -X main.Version=%VERSION% -X main.Commit=%COMMIT% -X main.BuildTime=%BUILD_TIME%"
|
||||
set "BUILD_FLAGS=-trimpath"
|
||||
|
||||
echo Cleaning up...
|
||||
if exist "%OUTPUT_DIR%" rmdir /s /q "%OUTPUT_DIR%"
|
||||
if not exist "%OUTPUT_DIR%" mkdir "%OUTPUT_DIR%"
|
||||
|
||||
echo Generating version info for Windows...
|
||||
go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@latest
|
||||
goversioninfo -icon=app.ico -manifest=app.manifest -64 -o=app.syso
|
||||
|
||||
echo Building %EXE_NAME% for %GOOS%/%GOARCH% ...
|
||||
set "CGO_ENABLED=0"
|
||||
go build %BUILD_FLAGS% -tags tempdll -ldflags "%LDFLAGS%" -o "%OUTPUT_DIR%\%EXE_NAME%.exe" .
|
||||
if errorlevel 1 (
|
||||
echo Build failed
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Copying config files...
|
||||
copy ".\config.json" "%OUTPUT_DIR%\config.json" >nul
|
||||
if errorlevel 1 (
|
||||
echo Copy config files failed
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Build completed: %OUTPUT_DIR%\%EXE_NAME%.exe
|
||||
|
||||
endlocal
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"api_url": "http://192.168.115.96:8888",
|
||||
"serial_port": "COM7",
|
||||
"baud_rate": 115200,
|
||||
"display_unit": "mm"
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/ying32/govcl/vcl"
|
||||
|
||||
"bj_power_workstation/internal/autostart"
|
||||
"bj_power_workstation/internal/config"
|
||||
"bj_power_workstation/internal/ui"
|
||||
)
|
||||
|
||||
const AppName = "spherical_mill_gui"
|
||||
|
||||
func main() {
|
||||
if exe, err := os.Executable(); err == nil {
|
||||
if dir := filepath.Dir(exe); dir != "" {
|
||||
_ = os.Chdir(dir)
|
||||
}
|
||||
}
|
||||
|
||||
cfg, err := config.Load("config.json")
|
||||
if err != nil {
|
||||
log.Fatalf("åŠ è½½é…�置失败: %v", err)
|
||||
}
|
||||
|
||||
// 自动创建桌�快�方�
|
||||
_ = autostart.CreateDesktopShortcut("�分�)
|
||||
|
||||
ui.InitForm(cfg, AppName)
|
||||
|
||||
vcl.Application.Initialize()
|
||||
vcl.Application.SetMainFormOnTaskBar(true)
|
||||
vcl.Application.CreateForm(&ui.MainFormPtr)
|
||||
vcl.Application.Run()
|
||||
}
|
||||
Reference in New Issue
Block a user