Files
BL616-firmware/scripts/build_gui.ps1
T

26 lines
1.3 KiB
PowerShell
Raw Normal View History

# Build TangProgrammer.exe (the GUI for openFPGALoader and the bridge firmware)
# with the C# compiler that comes with Windows (.NET Framework 4.x): nothing
# has to be installed.
#
# .\scripts\build_gui.ps1 -> TangProgrammer.exe in the project root
# .\scripts\build_gui.ps1 -Out some.exe -> elsewhere
param([string]$Out)
$ErrorActionPreference = 'Stop'
$root = Split-Path $PSScriptRoot -Parent
$src = Join-Path $root 'gui'
if (-not $Out) { $Out = Join-Path $root 'TangProgrammer.exe' }
$csc = Join-Path $env:WINDIR 'Microsoft.NET\Framework64\v4.0.30319\csc.exe'
if (-not (Test-Path $csc)) {
$csc = Join-Path $env:WINDIR 'Microsoft.NET\Framework\v4.0.30319\csc.exe'
}
if (-not (Test-Path $csc)) { throw '.NET Framework 4 C# compiler (csc.exe) not found' }
$sources = Get-ChildItem (Join-Path $src '*.cs') | ForEach-Object { $_.FullName }
& $csc /nologo /target:winexe /optimize+ /codepage:65001 "/out:$Out" `
"/win32icon:$src\app.ico" "/win32manifest:$src\app.manifest" "/resource:$src\app.ico,TangProgrammer.app.ico" `
/r:System.dll /r:System.Drawing.dll /r:System.Windows.Forms.dll /r:System.Management.dll `
$sources
if ($LASTEXITCODE) { throw "csc failed ($LASTEXITCODE) - is $Out running?" }
Write-Host "OK: $Out" -ForegroundColor Green