Build tests on Windows
This commit is contained in:
parent
3c4112d080
commit
8c153b5321
15
build.ps1
15
build.ps1
@ -3,11 +3,16 @@ Param(
|
|||||||
)
|
)
|
||||||
|
|
||||||
$Compiler = "cl.exe"
|
$Compiler = "cl.exe"
|
||||||
|
|
||||||
$GeneralFlags = "/Wall /WX /wd4996"
|
$GeneralFlags = "/Wall /WX /wd4996"
|
||||||
$LibraryFlags = "/LD"
|
$LibraryFlags = "/LD"
|
||||||
|
|
||||||
$IncludeDirs = Get-ChildItem -Path src -Recurse -Directory -ErrorAction SilentlyContinue -Force | %{$("/I " + '"' + $_.FullName + '"')}
|
$IncludeDirs = Get-ChildItem -Path src -Recurse -Directory -ErrorAction SilentlyContinue -Force | %{$("/I " + '"' + $_.FullName + '"')}
|
||||||
$SrcFiles = Get-ChildItem -Path src -Recurse -Filter *.c -ErrorAction SilentlyContinue -Force | %{$('"' + $_.FullName + '"')}
|
$SrcFiles = Get-ChildItem -Path src -Recurse -Filter *.c -ErrorAction SilentlyContinue -Force | %{$('"' + $_.FullName + '"')}
|
||||||
|
|
||||||
|
$TestIncludeDirs = Get-ChildItem -Path tests -Recurse -Directory -ErrorAction SilentlyContinue -Force | %{$("/I " + '"' + $_.FullName + '"')}
|
||||||
|
$TestSrcFiles = Get-ChildItem -Path tests -Recurse -Filter *.c -ErrorAction SilentlyContinue -Force | %{$('"' + $_.FullName + '"')}
|
||||||
|
|
||||||
If ($Release -eq $True) {
|
If ($Release -eq $True) {
|
||||||
$GeneralFlags += " /O2 /Og"
|
$GeneralFlags += " /O2 /Og"
|
||||||
$BuildType = "release"
|
$BuildType = "release"
|
||||||
@ -19,15 +24,25 @@ If ($Release -eq $True) {
|
|||||||
$BuildDir = "./libwapp-build/windows-$BuildType"
|
$BuildDir = "./libwapp-build/windows-$BuildType"
|
||||||
$ObjDir = "$BuildDir/objects"
|
$ObjDir = "$BuildDir/objects"
|
||||||
$OutDir = "$BuildDir/output"
|
$OutDir = "$BuildDir/output"
|
||||||
|
$TestsDir = "$BuildDir/tests"
|
||||||
|
|
||||||
$OutBasename = "libwapp"
|
$OutBasename = "libwapp"
|
||||||
$Objects = "/Fo:$ObjDir/"
|
$Objects = "/Fo:$ObjDir/"
|
||||||
$Outputs = "/Fd:$OutDir/$OutBasename /Fe:$OutDir/$OutBasename"
|
$Outputs = "/Fd:$OutDir/$OutBasename /Fe:$OutDir/$OutBasename"
|
||||||
|
|
||||||
|
$TestOutBasename = "wapptest"
|
||||||
|
$TestOutputs = "/Fo:$TestsDir/ /Fe:$TestsDir/$TestOutBasename"
|
||||||
|
|
||||||
If (Test-Path $BuildDir) {
|
If (Test-Path $BuildDir) {
|
||||||
Remove-Item $BuildDir -Recurse -Force
|
Remove-Item $BuildDir -Recurse -Force
|
||||||
}
|
}
|
||||||
|
|
||||||
mkdir -p $ObjDir > $null
|
mkdir -p $ObjDir > $null
|
||||||
mkdir -p $OutDir > $null
|
mkdir -p $OutDir > $null
|
||||||
|
mkdir -p $TestsDir > $null
|
||||||
|
|
||||||
|
# Build and run tests
|
||||||
|
Invoke-Expression "$Compiler $GeneralFlags $IncludeDirs $TestIncludeDirs $SrcFiles $TestSrcFiles $TestOutputs"
|
||||||
|
|
||||||
|
# Build library
|
||||||
Invoke-Expression "$Compiler $GeneralFlags $LibraryFlags $IncludeDirs $SrcFiles $Objects $Outputs"
|
Invoke-Expression "$Compiler $GeneralFlags $LibraryFlags $IncludeDirs $SrcFiles $Objects $Outputs"
|
||||||
|
Loading…
Reference in New Issue
Block a user