-
Notifications
You must be signed in to change notification settings - Fork 1
/
project.ps1
35 lines (29 loc) · 1.15 KB
/
project.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
$BuildPath = 'build'
if ($Null -eq $Env:GITHUB_WORKSPACE) {
$WorkDir = '.'
}
else {
$WorkDir = $Env:GITHUB_WORKSPACE
}
$VsWhere = Join-Path (Join-Path (Join-Path ${Env:ProgramFiles(x86)} 'Microsoft Visual Studio') Installer) vswhere.exe
$VsPath = & $VsWhere -prerelease -latest -property installationPath | Select-Object -Last 1
Import-Module -ea stop (Join-Path (Join-Path (Join-Path $VsPath Common7) Tools) Microsoft.VisualStudio.DevShell.dll)
Enter-VsDevShell -VsInstallPath $VsPath -SkipAutomaticLocation -DevCmdArguments '-arch=x86'
switch ($args[0]) {
'generate' {
$UseFloat = ($args[1] -eq 'float') ? 1 : 0
cmake.exe -G 'Ninja' -DCONFIG_IOT_LIB_FORMULAS_USE_FLOAT:BOOL=$UseFloat -DBUILD_TEST:BOOL=ON -B "$WorkDir\$BuildPath"
}
'build' {
cmake.exe --build "$WorkDir\$BuildPath" -v --config Release
}
'test' {
& "$WorkDir\$BuildPath\test\test_app.exe" -v -c
}
Default {
Write-Host "Command not recognized. Valid commands:"
Write-Host "`t* generate: generate compilation files"
Write-Host "`t* build: build the project"
Write-Host "`t* test: run the tests"
}
}