34 lines
973 B
PowerShell
34 lines
973 B
PowerShell
Param(
|
|
[switch]$Release
|
|
)
|
|
|
|
$Compiler = "cl.exe"
|
|
$GeneralFlags = "/Wall /WX /wd4996"
|
|
$LibraryFlags = "/LD"
|
|
$IncludeDirs = Get-ChildItem -Path src -Recurse -Directory -ErrorAction SilentlyContinue -Force | %{$("/I " + '"' + $_.FullName + '"')}
|
|
$SrcFiles = Get-ChildItem -Path src -Recurse -Filter *.c -ErrorAction SilentlyContinue -Force | %{$('"' + $_.FullName + '"')}
|
|
|
|
If ($Release -eq $True) {
|
|
$GeneralFlags += " /O2 /Og"
|
|
$BuildType = "release"
|
|
} Else {
|
|
$GeneralFlags += " /Zi /Od /fsanitize=address"
|
|
$BuildType = "debug"
|
|
}
|
|
|
|
$BuildDir = "./libwapp-build/windows-$BuildType"
|
|
$ObjDir = "$BuildDir/objects"
|
|
$OutDir = "$BuildDir/output"
|
|
$OutBasename = "libwapp"
|
|
$Objects = "/Fo:$ObjDir/"
|
|
$Outputs = "/Fd:$OutDir/$OutBasename /Fe:$OutDir/$OutBasename"
|
|
|
|
If (Test-Path $BuildDir) {
|
|
Remove-Item $BuildDir -Recurse -Force
|
|
}
|
|
|
|
mkdir -p $ObjDir > $null
|
|
mkdir -p $OutDir > $null
|
|
|
|
Invoke-Expression "$Compiler $GeneralFlags $LibraryFlags $IncludeDirs $SrcFiles $Objects $Outputs"
|