-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathbuild-deps.ps1
46 lines (41 loc) · 1.38 KB
/
build-deps.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
param(
[ValidateSet("x64", "x86")][string]$Arch = "x64"
)
function SetEnv() {
$vswhere = "${env:ProgramFiles(x86)}/Microsoft Visual Studio/Installer/vswhere.exe"
$ip = & $vswhere -prerelease -latest -property InstallationPath
if ($ip -and (test-path "$ip\Common7\Tools\vsdevcmd.bat")) {
& "${env:COMSPEC}" /s /c "`"$ip\Common7\Tools\vsdevcmd.bat`" -arch=x64 -no_logo && set" | foreach-object {
$name, $value = $_ -split '=', 2
set-content env:\"$name" $value
}
}
}
function InstallPackages() {
$vcpkg = "$env:VCPKG_ROOT/vcpkg.exe"
if (!(Get-Command $vcpkg -ErrorAction SilentlyContinue)) {
$vcpkg = "vcpkg"
}
$local_vcpkg = $false
if(!(Get-Command $vcpkg -ErrorAction SilentlyContinue)) {
if (!(Test-Path build/vcpkg)) {
echo "Cloning vcpkg..."
mkdir build -Force | Out-Null
pushd build
& git clone https://github.com/Microsoft/vcpkg.git --depth 1
pushd vcpkg
./bootstrap-vcpkg -disableMetrics
popd
popd
$vcpkg = "build/vcpkg/vcpkg.exe"
}
$local_vcpkg = $true
}
& $vcpkg integrate install
if ($local_vcpkg) {
Write-Output "Cleaning up..."
Remove-Item build/vcpkg/downloads -Recurse
Remove-Item build/vcpkg/buildtrees -Recurse
}
}
InstallPackages