2016-09-19 03:50:08 +00:00
|
|
|
[CmdletBinding()]
|
|
|
|
param(
|
|
|
|
[ValidateNotNullOrEmpty()]
|
|
|
|
[string]$disableMetrics = "0"
|
|
|
|
)
|
|
|
|
|
2016-09-20 01:46:02 +00:00
|
|
|
$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition
|
|
|
|
$vcpkgRootDir = & $scriptsDir\findFileRecursivelyUp.ps1 $scriptsDir .vcpkg-root
|
2016-09-19 03:50:08 +00:00
|
|
|
|
2016-11-22 02:10:21 +00:00
|
|
|
$gitHash = "unknownhash"
|
|
|
|
if (Get-Command "git.exe" -ErrorAction SilentlyContinue)
|
|
|
|
{
|
|
|
|
$gitHash = git rev-parse HEAD
|
|
|
|
}
|
2016-09-19 03:50:08 +00:00
|
|
|
Write-Verbose("Git hash is " + $gitHash)
|
2016-09-20 01:46:02 +00:00
|
|
|
$vcpkgSourcesPath = "$vcpkgRootDir\toolsrc"
|
2016-09-19 03:50:08 +00:00
|
|
|
Write-Verbose("vcpkg Path " + $vcpkgSourcesPath)
|
|
|
|
|
|
|
|
if (!(Test-Path $vcpkgSourcesPath))
|
|
|
|
{
|
|
|
|
New-Item -ItemType directory -Path $vcpkgSourcesPath -force | Out-Null
|
|
|
|
}
|
|
|
|
|
|
|
|
try{
|
|
|
|
pushd $vcpkgSourcesPath
|
2017-01-23 20:54:33 +00:00
|
|
|
$msbuildExeWithPlatformToolset = & $scriptsDir\findAnyMSBuildWithCppPlatformToolset.ps1
|
|
|
|
$msbuildExe = $msbuildExeWithPlatformToolset[0]
|
|
|
|
$platformToolset = $msbuildExeWithPlatformToolset[1]
|
2017-02-09 03:34:19 +00:00
|
|
|
$targetPlatformVersion = & $scriptsDir\findTargetPlatformVersion.ps1
|
|
|
|
& $msbuildExe "/p:VCPKG_VERSION=-$gitHash" "/p:DISABLE_METRICS=$disableMetrics" /p:Configuration=Release /p:Platform=x86 /p:PlatformToolset=$platformToolset /p:TargetPlatformVersion=$targetPlatformVersion /m dirs.proj
|
2016-09-19 03:50:08 +00:00
|
|
|
|
|
|
|
Write-Verbose("Placing vcpkg.exe in the correct location")
|
|
|
|
|
2016-09-20 01:46:02 +00:00
|
|
|
Copy-Item $vcpkgSourcesPath\Release\vcpkg.exe $vcpkgRootDir\vcpkg.exe | Out-Null
|
|
|
|
Copy-Item $vcpkgSourcesPath\Release\vcpkgmetricsuploader.exe $vcpkgRootDir\scripts\vcpkgmetricsuploader.exe | Out-Null
|
2016-09-19 03:50:08 +00:00
|
|
|
}
|
|
|
|
finally{
|
|
|
|
popd
|
|
|
|
}
|