Initial implementation of Windows build script
This commit is contained in:
parent
6c82898225
commit
2c556e12f1
33
build.ps1
Normal file
33
build.ps1
Normal file
@ -0,0 +1,33 @@
|
||||
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"
|
Loading…
x
Reference in New Issue
Block a user