71 lines
2.2 KiB
PowerShell
71 lines
2.2 KiB
PowerShell
# Build script for creating release binaries for Windows
|
|
# PowerShell script for Windows users
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
Write-Host "RLogg - Multi-platform Release Builder (Windows)" -ForegroundColor Cyan
|
|
Write-Host "=" * 50 -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
# Create dist directory
|
|
$DistDir = "dist"
|
|
if (-not (Test-Path $DistDir)) {
|
|
New-Item -ItemType Directory -Path $DistDir | Out-Null
|
|
}
|
|
|
|
# Function to build for a target
|
|
function Build-Target {
|
|
param (
|
|
[string]$Target,
|
|
[string]$Name
|
|
)
|
|
|
|
Write-Host "Building for $Name ($Target)..." -ForegroundColor Yellow
|
|
|
|
try {
|
|
cargo build --release --target $Target
|
|
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Host "✓ Build successful for $Name" -ForegroundColor Green
|
|
|
|
# Copy binary to dist directory
|
|
if ($Target -like "*windows*") {
|
|
$SourcePath = "target\$Target\release\rlogg.exe"
|
|
$DestPath = "$DistDir\rlogg-$Name.exe"
|
|
} else {
|
|
$SourcePath = "target\$Target\release\rlogg"
|
|
$DestPath = "$DistDir\rlogg-$Name"
|
|
}
|
|
|
|
Copy-Item $SourcePath $DestPath -Force
|
|
Write-Host "✓ Binary copied to $DestPath" -ForegroundColor Green
|
|
Write-Host ""
|
|
return $true
|
|
}
|
|
} catch {
|
|
Write-Host "✗ Build failed for $Name" -ForegroundColor Red
|
|
Write-Host $_.Exception.Message -ForegroundColor Red
|
|
Write-Host ""
|
|
return $false
|
|
}
|
|
}
|
|
|
|
# Build for Windows
|
|
Write-Host "=== Building for Windows ===" -ForegroundColor Cyan
|
|
$success = Build-Target "x86_64-pc-windows-msvc" "windows-x86_64"
|
|
|
|
if ($success) {
|
|
Write-Host ""
|
|
Write-Host "=== Build Complete ===" -ForegroundColor Green
|
|
Write-Host "Binaries are in the '$DistDir' directory:" -ForegroundColor Green
|
|
Get-ChildItem $DistDir | Format-Table Name, Length, LastWriteTime
|
|
Write-Host ""
|
|
Write-Host "To build for additional platforms, install the target and run:"
|
|
Write-Host " rustup target add <target-triple>"
|
|
Write-Host " cargo build --release --target <target-triple>"
|
|
} else {
|
|
Write-Host ""
|
|
Write-Host "Build failed!" -ForegroundColor Red
|
|
exit 1
|
|
}
|