Skip to content

Commit b345f2e

Browse files
committed
Add PowerShell build script and update .gitignore to include goengine.exe
1 parent 11c042d commit b345f2e

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ libgoengine.h
66
libgoengine.so
77
goengine
88
ctypes
9+
goengine.exe

build.ps1

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# PowerShell build script for GoInGo
2+
Write-Host "Running tests..." -ForegroundColor Green
3+
go test ./pkg/...
4+
5+
if ($LASTEXITCODE -ne 0) {
6+
Write-Host "Tests failed. Exiting build process." -ForegroundColor Red
7+
exit 1
8+
}
9+
10+
Write-Host "Building main executable..." -ForegroundColor Green
11+
$env:CGO_ENABLED = "1"
12+
go build -o goengine.exe ./cmd/main.go
13+
14+
Write-Host "Checking CGO availability..." -ForegroundColor Yellow
15+
16+
$cgoEnabled = (go env CGO_ENABLED)
17+
if ($cgoEnabled -eq "1") {
18+
Write-Host "Building shared library..." -ForegroundColor Green
19+
go build -buildmode=c-shared -o libgoengine.so ./export/export.go
20+
if ($LASTEXITCODE -eq 0) {
21+
Write-Host "Build completed successfully!" -ForegroundColor Green
22+
} else {
23+
Write-Host "Shared library build failed, but main executable was built successfully." -ForegroundColor Yellow
24+
}
25+
} else {
26+
Write-Host "CGO is disabled. Skipping shared library build." -ForegroundColor Yellow
27+
Write-Host "To enable CGO, install a C compiler (like MinGW-w64) and set CGO_ENABLED=1" -ForegroundColor Yellow
28+
}
29+
30+
Write-Host "Build process completed!" -ForegroundColor Green

0 commit comments

Comments
 (0)