-
Notifications
You must be signed in to change notification settings - Fork 20
/
.run.ps1
51 lines (43 loc) · 1.29 KB
/
.run.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
. .\tools\Exec.ps1
. .\tools\Invoke-BatchFile.ps1
function buildenv() {
$vswhere = Resolve-Path "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$vsDir = & $vswhere -latest `
-requires Microsoft.VisualStudio.Workload.NativeDesktop `
-property installationPath
if (-not $vsDir) {
throw 'MSVC is not installed.'
}
Invoke-BatchFile "$vsDir\VC\Auxiliary\Build\vcvars64.bat" "-vcvars_ver=14.38"
}
if ($args.Length -lt 1) {
throw 'No task is specified.'
}
Set-Location $PSScriptRoot
switch -regex ($args[0]) {
'^c(onfigure)?$' {
buildenv
Exec { cmake -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_TOOLCHAIN_FILE='vcpkg/scripts/buildsystems/vcpkg.cmake' }
break
}
'^b(uild)?$' {
buildenv
Exec { cmake --build build }
break
}
'^t(est)?$' {
buildenv
Exec { ctest -V --test-dir build }
break
}
'^configure-on-ci$' {
buildenv
Exec { cmake -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE='C:/vcpkg/scripts/buildsystems/vcpkg.cmake' }
break
}
default {
throw "Unrecognized task: $($args[0])"
}
}