-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ps1
More file actions
36 lines (30 loc) · 1.26 KB
/
Copy pathbuild.ps1
File metadata and controls
36 lines (30 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Set up environment variables for MSYS2 GCC and TensorFlow Lite C DLL
$scriptDir = $PSScriptRoot
if (-not $scriptDir) { $scriptDir = $PWD.Path }
if (-not $env:TENSORFLOW_PATH) {
Write-Error "TENSORFLOW_PATH environment variable is not set. Please set it to your TensorFlow header path (see .env.example)."
exit 1
}
if (-not (Test-Path -Path $env:TENSORFLOW_PATH)) {
Write-Error "TENSORFLOW_PATH '$env:TENSORFLOW_PATH' does not exist."
exit 1
}
$env:PATH = "F:\msys64\ucrt64\bin;$scriptDir;" + $env:PATH
$env:CGO_ENABLED = "1"
$env:CGO_CFLAGS = "-I$env:TENSORFLOW_PATH"
$version = "unknown"
if (Test-Path -Path "$scriptDir\version.txt") {
$version = (Get-Content -Path "$scriptDir\version.txt" -Raw).Trim()
} else {
$gitVersion = git describe --tags --always 2>$null
if ($gitVersion) { $version = $gitVersion }
}
$buildDate = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
$ldflags = "-s -w -X 'main.buildDate=$buildDate' -X 'main.version=$version'"
Write-Host "Building birdnet-go.exe with version: $version..."
go build -trimpath -ldflags $ldflags -o birdnet-go.exe .
if ($LASTEXITCODE -eq 0) {
Write-Host "Build succeeded!" -ForegroundColor Green
} else {
Write-Host "Build failed with exit code $LASTEXITCODE" -ForegroundColor Red
}