aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorPhil Christensen <philc@microsoft.com>2018-12-06 15:06:28 -0800
committerPhil Christensen <philc@microsoft.com>2018-12-06 15:06:28 -0800
commit7347305e8459fcc78553a9f88196e0d93eb0a8fe (patch)
treeac9eee9ff267c6a71a83249bed7a94f02b00d9a5 /scripts
parented9357a5aafea7192932b5874264bd103fc61255 (diff)
parent63c1b2628e958f8e02356411f032941c0c2f3bbb (diff)
downloadvcpkg-7347305e8459fcc78553a9f88196e0d93eb0a8fe.tar.gz
vcpkg-7347305e8459fcc78553a9f88196e0d93eb0a8fe.zip
Merge branch 'master' of https://github.com/microsoft/vcpkg into dev/philc/3425
Diffstat (limited to 'scripts')
-rw-r--r--scripts/VcpkgPowershellUtils.ps1318
-rw-r--r--scripts/addPoshVcpkgToPowershellProfile.ps18
-rw-r--r--scripts/bootstrap.ps1379
-rw-r--r--scripts/bootstrap.sh21
-rw-r--r--scripts/buildsystems/msbuild/applocal.ps12
-rw-r--r--scripts/buildsystems/msbuild/vcpkg.targets8
-rw-r--r--scripts/cleanEnvironmentHelper.ps1 (renamed from scripts/VcpkgPowershellUtils-ClearEnvironment.ps1)2
-rw-r--r--scripts/cmake/vcpkg_acquire_msys.cmake4
-rw-r--r--scripts/cmake/vcpkg_add_to_path.cmake41
-rw-r--r--scripts/cmake/vcpkg_apply_patches.cmake4
-rw-r--r--scripts/cmake/vcpkg_build_cmake.cmake12
-rw-r--r--scripts/cmake/vcpkg_build_msbuild.cmake9
-rw-r--r--scripts/cmake/vcpkg_build_qmake.cmake11
-rw-r--r--scripts/cmake/vcpkg_check_linkage.cmake53
-rw-r--r--scripts/cmake/vcpkg_clean_msbuild.cmake19
-rw-r--r--scripts/cmake/vcpkg_common_functions.cmake10
-rw-r--r--scripts/cmake/vcpkg_configure_cmake.cmake27
-rw-r--r--scripts/cmake/vcpkg_configure_meson.cmake7
-rw-r--r--scripts/cmake/vcpkg_copy_pdbs.cmake19
-rw-r--r--scripts/cmake/vcpkg_download_distfile.cmake17
-rw-r--r--scripts/cmake/vcpkg_extract_source_archive.cmake34
-rw-r--r--scripts/cmake/vcpkg_extract_source_archive_ex.cmake130
-rw-r--r--scripts/cmake/vcpkg_find_acquire_program.cmake68
-rw-r--r--scripts/cmake/vcpkg_fixup_cmake_targets.cmake8
-rw-r--r--scripts/cmake/vcpkg_from_bitbucket.cmake34
-rw-r--r--scripts/cmake/vcpkg_from_git.cmake127
-rw-r--r--scripts/cmake/vcpkg_from_github.cmake80
-rw-r--r--scripts/cmake/vcpkg_from_gitlab.cmake169
-rw-r--r--scripts/cmake/vcpkg_get_windows_sdk.cmake14
-rw-r--r--scripts/cmake/vcpkg_install_meson.cmake2
-rw-r--r--scripts/cmake/vcpkg_install_msbuild.cmake226
-rw-r--r--scripts/cmake/vcpkg_test_cmake.cmake53
-rw-r--r--scripts/fetchTool.ps1107
-rw-r--r--scripts/findAnyMSBuildWithCppPlatformToolset.ps158
-rw-r--r--scripts/findVisualStudioInstallationInstances.ps161
-rw-r--r--scripts/getProgramFiles32bit.ps117
-rw-r--r--scripts/getProgramFilesPlatformBitness.ps117
-rw-r--r--scripts/getWindowsSDK.ps1126
-rw-r--r--scripts/internalCI.ps122
-rw-r--r--scripts/ports.cmake19
-rw-r--r--scripts/templates/portfile.in.cmake3
-rw-r--r--scripts/toolchains/android.cmake28
-rw-r--r--scripts/toolchains/freebsd.cmake16
-rw-r--r--scripts/toolchains/linux.cmake16
-rw-r--r--scripts/toolchains/osx.cmake24
-rw-r--r--scripts/vcpkgTools.xml78
46 files changed, 1541 insertions, 967 deletions
diff --git a/scripts/VcpkgPowershellUtils.ps1 b/scripts/VcpkgPowershellUtils.ps1
deleted file mode 100644
index fdd89e7b9..000000000
--- a/scripts/VcpkgPowershellUtils.ps1
+++ /dev/null
@@ -1,318 +0,0 @@
-function vcpkgHasModule([Parameter(Mandatory=$true)][string]$moduleName)
-{
- return [bool](Get-Module -ListAvailable -Name $moduleName)
-}
-
-function vcpkgHasProperty([Parameter(Mandatory=$true)][AllowNull()]$object, [Parameter(Mandatory=$true)]$propertyName)
-{
- if ($object -eq $null)
- {
- return $false
- }
-
- return [bool]($object.psobject.Properties | where { $_.Name -eq "$propertyName"})
-}
-
-function vcpkgCreateDirectoryIfNotExists([Parameter(Mandatory=$true)][string]$dirPath)
-{
- if (!(Test-Path $dirPath))
- {
- New-Item -ItemType Directory -Path $dirPath | Out-Null
- }
-}
-
-function vcpkgCreateParentDirectoryIfNotExists([Parameter(Mandatory=$true)][string]$path)
-{
- $parentDir = split-path -parent $path
- if ([string]::IsNullOrEmpty($parentDir))
- {
- return
- }
-
- if (!(Test-Path $parentDir))
- {
- New-Item -ItemType Directory -Path $parentDir | Out-Null
- }
-}
-
-function vcpkgIsDirectory([Parameter(Mandatory=$true)][string]$path)
-{
- return (Get-Item $path) -is [System.IO.DirectoryInfo]
-}
-
-function vcpkgRemoveItem([Parameter(Mandatory=$true)][string]$path)
-{
- if ([string]::IsNullOrEmpty($path))
- {
- return
- }
-
- if (Test-Path $path)
- {
- # Remove-Item -Recurse occasionally fails. This is a workaround
- if (vcpkgIsDirectory $path)
- {
- & cmd.exe /c rd /s /q $path
- }
- else
- {
- Remove-Item $path -Force
- }
- }
-}
-
-function vcpkgHasCommand([Parameter(Mandatory=$true)][string]$commandName)
-{
- return [bool](Get-Command -Name $commandName -ErrorAction SilentlyContinue)
-}
-
-function vcpkgHasCommandParameter([Parameter(Mandatory=$true)][string]$commandName, [Parameter(Mandatory=$true)][string]$parameterName)
-{
- return (Get-Command $commandName).Parameters.Keys -contains $parameterName
-}
-
-function vcpkgGetCredentials()
-{
- if (vcpkgHasCommandParameter -commandName 'Get-Credential' -parameterName 'Message')
- {
- return Get-Credential -Message "Enter credentials for Proxy Authentication"
- }
- else
- {
- Write-Host "Enter credentials for Proxy Authentication"
- return Get-Credential
- }
-}
-
-function vcpkgGetSHA512([Parameter(Mandatory=$true)][string]$filePath)
-{
- if (vcpkgHasCommand -commandName 'Microsoft.PowerShell.Utility\Get-FileHash')
- {
- Write-Verbose("Hashing with Microsoft.PowerShell.Utility\Get-FileHash")
- $hash = (Microsoft.PowerShell.Utility\Get-FileHash -Path $filePath -Algorithm SHA512).Hash
- }
- elseif(vcpkgHasCommand -commandName 'Pscx\Get-Hash')
- {
- Write-Verbose("Hashing with Pscx\Get-Hash")
- $hash = (Pscx\Get-Hash -Path $filePath -Algorithm SHA512).HashString
- }
- else
- {
- Write-Verbose("Hashing with .NET")
- $hashAlgorithm = [Security.Cryptography.HashAlgorithm]::Create("SHA512")
- $fileAsByteArray = [io.File]::ReadAllBytes($filePath)
- $hashByteArray = $hashAlgorithm.ComputeHash($fileAsByteArray)
- $hash = -Join ($hashByteArray | ForEach-Object {"{0:x2}" -f $_})
- }
-
- return $hash.ToLower()
-}
-
-function vcpkgCheckEqualFileHash( [Parameter(Mandatory=$true)][string]$url,
- [Parameter(Mandatory=$true)][string]$filePath,
- [Parameter(Mandatory=$true)][string]$expectedHash)
-{
- $actualHash = vcpkgGetSHA512 $filePath
- if ($expectedHash -ne $actualHash)
- {
- Write-Host ("`nFile does not have expected hash:`n" +
- " url: [ $url ]`n" +
- " File path: [ $filePath ]`n" +
- " Expected hash: [ $expectedHash ]`n" +
- " Actual hash: [ $actualHash ]`n")
- throw
- }
-}
-
-function vcpkgDownloadFile( [Parameter(Mandatory=$true)][string]$url,
- [Parameter(Mandatory=$true)][string]$downloadPath,
- [Parameter(Mandatory=$true)][string]$sha512)
-{
- if ($url -match "github")
- {
- if ([System.Enum]::IsDefined([Net.SecurityProtocolType], "Tls12"))
- {
- [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
- }
- else
- {
- Write-Warning "Github has dropped support for TLS versions prior to 1.2, which is not available on your system"
- Write-Warning "Please manually download $url to $downloadPath"
- Write-Warning "To solve this issue for future downloads, you can also install Windows Management Framework 5.1+"
- throw "Download failed"
- }
- }
-
- vcpkgCreateParentDirectoryIfNotExists $downloadPath
-
- $downloadPartPath = "$downloadPath.part"
- vcpkgRemoveItem $downloadPartPath
-
- $wc = New-Object System.Net.WebClient
- if (!$wc.Proxy.IsBypassed($url))
- {
- $wc.Proxy.Credentials = vcpkgGetCredentials
- }
-
- $wc.DownloadFile($url, $downloadPartPath)
- vcpkgCheckEqualFileHash -url $url -filePath $downloadPartPath -expectedHash $sha512
- Move-Item -Path $downloadPartPath -Destination $downloadPath
-}
-
-function vcpkgDownloadFileWithAria2( [Parameter(Mandatory=$true)][string]$aria2exe,
- [Parameter(Mandatory=$true)][string]$url,
- [Parameter(Mandatory=$true)][string]$downloadPath,
- [Parameter(Mandatory=$true)][string]$sha512)
-{
- vcpkgCreateParentDirectoryIfNotExists $downloadPath
- $downloadPartPath = "$downloadPath.part"
- vcpkgRemoveItem $downloadPartPath
-
- $parentDir = split-path -parent $downloadPath
- $filename = split-path -leaf $downloadPath
-
- if ((Test-Path $url) -or ($url.StartsWith("file://"))) # if is local file
- {
- vcpkgDownloadFile $url $downloadPath $sha512
- return
- }
-
- $ec = vcpkgInvokeCommand "$aria2exe" "--dir `"$parentDir`" --out `"$filename.part`" $url"
- if ($ec -ne 0)
- {
- Write-Host "Could not download $url"
- throw
- }
-
- vcpkgCheckEqualFileHash -url $url -filePath $downloadPartPath -expectedHash $sha512
- Move-Item -Path $downloadPartPath -Destination $downloadPath
-}
-
-function vcpkgExtractFileWith7z([Parameter(Mandatory=$true)][string]$sevenZipExe,
- [Parameter(Mandatory=$true)][string]$archivePath,
- [Parameter(Mandatory=$true)][string]$destinationDir)
-{
- vcpkgRemoveItem $destinationDir
- $destinationPartial = "$destinationDir.partial"
- vcpkgRemoveItem $destinationPartial
- vcpkgCreateDirectoryIfNotExists $destinationPartial
- $ec = vcpkgInvokeCommand "$sevenZipExe" "x `"$archivePath`" -o`"$destinationPartial`" -y"
- if ($ec -ne 0)
- {
- Write-Host "Could not extract $archivePath"
- throw
- }
- Rename-Item -Path "$destinationPartial" -NewName $destinationDir
-}
-
-function vcpkgExtractZipFile( [Parameter(Mandatory=$true)][string]$archivePath,
- [Parameter(Mandatory=$true)][string]$destinationDir)
-{
- vcpkgRemoveItem $destinationDir
- $destinationPartial = "$destinationDir.partial"
- vcpkgRemoveItem $destinationPartial
- vcpkgCreateDirectoryIfNotExists $destinationPartial
-
-
- if (vcpkgHasCommand -commandName 'Microsoft.PowerShell.Archive\Expand-Archive')
- {
- Write-Verbose("Extracting with Microsoft.PowerShell.Archive\Expand-Archive")
- Microsoft.PowerShell.Archive\Expand-Archive -path $archivePath -destinationpath $destinationPartial
- }
- elseif (vcpkgHasCommand -commandName 'Pscx\Expand-Archive')
- {
- Write-Verbose("Extracting with Pscx\Expand-Archive")
- Pscx\Expand-Archive -path $archivePath -OutputPath $destinationPartial
- }
- else
- {
- Write-Verbose("Extracting via shell")
- $shell = new-object -com shell.application
- $zip = $shell.NameSpace($(Get-Item $archivePath).fullname)
- foreach($item in $zip.items())
- {
- # Piping to Out-Null is used to block until finished
- $shell.Namespace($destinationPartial).copyhere($item) | Out-Null
- }
- }
-
- Rename-Item -Path "$destinationPartial" -NewName $destinationDir
-}
-
-function vcpkgInvokeCommand()
-{
- param ( [Parameter(Mandatory=$true)][string]$executable,
- [string]$arguments = "")
-
- Write-Verbose "Executing: ${executable} ${arguments}"
- $process = Start-Process -FilePath "`"$executable`"" -ArgumentList $arguments -PassThru -NoNewWindow
- Wait-Process -InputObject $process
- $ec = $process.ExitCode
- Write-Verbose "Execution terminated with exit code $ec."
- return $ec
-}
-
-function vcpkgInvokeCommandClean()
-{
- param ( [Parameter(Mandatory=$true)][string]$executable,
- [string]$arguments = "")
-
- Write-Verbose "Clean-Executing: ${executable} ${arguments}"
- $scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition
- $cleanEnvScript = "$scriptsDir\VcpkgPowershellUtils-ClearEnvironment.ps1"
- $tripleQuotes = "`"`"`""
- $argumentsWithEscapedQuotes = $arguments -replace "`"", $tripleQuotes
- $command = ". $tripleQuotes$cleanEnvScript$tripleQuotes; & $tripleQuotes$executable$tripleQuotes $argumentsWithEscapedQuotes"
- $arg = "-NoProfile", "-ExecutionPolicy Bypass", "-command $command"
-
- $process = Start-Process -FilePath powershell.exe -ArgumentList $arg -PassThru -NoNewWindow
- Wait-Process -InputObject $process
- $ec = $process.ExitCode
- Write-Verbose "Execution terminated with exit code $ec."
- return $ec
-}
-
-function vcpkgFormatElapsedTime([TimeSpan]$ts)
-{
- if ($ts.TotalHours -ge 1)
- {
- return [string]::Format( "{0:N2} h", $ts.TotalHours);
- }
-
- if ($ts.TotalMinutes -ge 1)
- {
- return [string]::Format( "{0:N2} min", $ts.TotalMinutes);
- }
-
- if ($ts.TotalSeconds -ge 1)
- {
- return [string]::Format( "{0:N2} s", $ts.TotalSeconds);
- }
-
- if ($ts.TotalMilliseconds -ge 1)
- {
- return [string]::Format( "{0:N2} ms", $ts.TotalMilliseconds);
- }
-
- throw $ts
-}
-
-function vcpkgFindFileRecursivelyUp()
-{
- param(
- [ValidateNotNullOrEmpty()]
- [Parameter(Mandatory=$true)][string]$startingDir,
- [ValidateNotNullOrEmpty()]
- [Parameter(Mandatory=$true)][string]$filename
- )
-
- $currentDir = $startingDir
-
- while (!($currentDir -eq "") -and !(Test-Path "$currentDir\$filename"))
- {
- Write-Verbose "Examining $currentDir for $filename"
- $currentDir = Split-path $currentDir -Parent
- }
- Write-Verbose "Examining $currentDir for $filename - Found"
- return $currentDir
-}
diff --git a/scripts/addPoshVcpkgToPowershellProfile.ps1 b/scripts/addPoshVcpkgToPowershellProfile.ps1
index dcbd2e0be..1dd27aacf 100644
--- a/scripts/addPoshVcpkgToPowershellProfile.ps1
+++ b/scripts/addPoshVcpkgToPowershellProfile.ps1
@@ -14,14 +14,13 @@ function findExistingImportModuleDirectives([Parameter(Mandatory=$true)][string]
}
$scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition
-. "$scriptsDir\VcpkgPowershellUtils.ps1"
$profileEntry = "Import-Module '$scriptsDir\posh-vcpkg'"
$profilePath = $PROFILE # Implicit powershell variable
-if (!(Test-Path $profilePath))
+$profileDir = Split-Path $profilePath -Parent
+if (!(Test-Path $profileDir))
{
- $profileDir = Split-Path $profilePath -Parent
- vcpkgCreateDirectoryIfNotExists $profileDir
+ New-Item -ItemType Directory -Path $profileDir | Out-Null
}
Write-Host "`nAdding the following line to ${profilePath}:"
@@ -38,6 +37,7 @@ if ($existingImports.Count -gt 0)
return
}
+# Modifying the profile will invalidate any signatures.
# Posh-git does the following check, so we should too.
# https://github.com/dahlbyk/posh-git/blob/master/src/Utils.ps1
# If the profile script exists and is signed, then we should not modify it
diff --git a/scripts/bootstrap.ps1 b/scripts/bootstrap.ps1
index c8ba503d8..ed82a6ab1 100644
--- a/scripts/bootstrap.ps1
+++ b/scripts/bootstrap.ps1
@@ -1,38 +1,61 @@
[CmdletBinding()]
param(
- [ValidateNotNullOrEmpty()][string]$disableMetrics = "0",
- [Parameter(Mandatory=$False)][string]$withVSPath = ""
+ $badParam,
+ [Parameter(Mandatory=$False)][switch]$disableMetrics = $false,
+ [Parameter(Mandatory=$False)][switch]$win64 = $false,
+ [Parameter(Mandatory=$False)][string]$withVSPath = "",
+ [Parameter(Mandatory=$False)][string]$withWinSDK = ""
)
Set-StrictMode -Version Latest
+# Powershell2-compatible way of forcing named-parameters
+if ($badParam)
+{
+ if ($disableMetrics -and $badParam -eq "1")
+ {
+ Write-Warning "'disableMetrics 1' is deprecated, please change to 'disableMetrics' (without '1')"
+ }
+ else
+ {
+ throw "Only named parameters are allowed"
+ }
+}
+
$scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition
-. "$scriptsDir\VcpkgPowershellUtils.ps1"
-$vcpkgRootDir = vcpkgFindFileRecursivelyUp $scriptsDir .vcpkg-root
-Write-Verbose("vcpkg Path " + $vcpkgRootDir)
+$withVSPath = $withVSPath -replace "\\$" # Remove potential trailing backslash
-$gitHash = "unknownhash"
-$oldpath = $env:path
-try
+function vcpkgHasProperty([Parameter(Mandatory=$true)][AllowNull()]$object, [Parameter(Mandatory=$true)]$propertyName)
{
- [xml]$asXml = Get-Content "$scriptsDir\vcpkgTools.xml"
- $toolData = $asXml.SelectSingleNode("//tools/tool[@name=`"git`"]")
- $gitFromDownload = "$vcpkgRootDir\downloads\$($toolData.exeRelativePath)"
- $gitDir = split-path -parent $gitFromDownload
+ if ($object -eq $null)
+ {
+ return $false
+ }
+
+ return [bool]($object.psobject.Properties | Where-Object { $_.Name -eq "$propertyName"})
+}
- $env:path += ";$gitDir"
- if (Get-Command "git" -ErrorAction SilentlyContinue)
+function getProgramFiles32bit()
+{
+ $out = ${env:PROGRAMFILES(X86)}
+ if ($out -eq $null)
{
- $gitHash = git log HEAD -n 1 --format="%cd-%H" --date=short
- if ($LASTEXITCODE -ne 0)
- {
- $gitHash = "unknownhash"
- }
+ $out = ${env:PROGRAMFILES}
+ }
+
+ if ($out -eq $null)
+ {
+ throw "Could not find [Program Files 32-bit]"
}
+
+ return $out
}
-finally
+
+$vcpkgRootDir = $scriptsDir
+while (!($vcpkgRootDir -eq "") -and !(Test-Path "$vcpkgRootDir\.vcpkg-root"))
{
- $env:path = $oldpath
+ Write-Verbose "Examining $vcpkgRootDir for .vcpkg-root"
+ $vcpkgRootDir = Split-path $vcpkgRootDir -Parent
}
-Write-Verbose("Git repo version string is " + $gitHash)
+Write-Verbose "Examining $vcpkgRootDir for .vcpkg-root - Found"
$vcpkgSourcesPath = "$vcpkgRootDir\toolsrc"
@@ -42,22 +65,318 @@ if (!(Test-Path $vcpkgSourcesPath))
return
}
-$msbuildExeWithPlatformToolset = & $scriptsDir\findAnyMSBuildWithCppPlatformToolset.ps1 $withVSPath
+function getVisualStudioInstances()
+{
+ $programFiles = getProgramFiles32bit
+ $results = New-Object System.Collections.ArrayList
+ $vswhereExe = "$programFiles\Microsoft Visual Studio\Installer\vswhere.exe"
+ if (Test-Path $vswhereExe)
+ {
+ $output = & $vswhereExe -prerelease -legacy -products * -format xml
+ [xml]$asXml = $output
+
+ foreach ($instance in $asXml.instances.instance)
+ {
+ $installationPath = $instance.InstallationPath -replace "\\$" # Remove potential trailing backslash
+ $installationVersion = $instance.InstallationVersion
+
+ $isPrerelease = -7
+ if (vcpkgHasProperty -object $instance -propertyName "isPrerelease")
+ {
+ $isPrerelease = $instance.isPrerelease
+ }
+
+ if ($isPrerelease -eq 0)
+ {
+ $releaseType = "PreferenceWeight3::StableRelease"
+ }
+ elseif ($isPrerelease -eq 1)
+ {
+ $releaseType = "PreferenceWeight2::PreRelease"
+ }
+ else
+ {
+ $releaseType = "PreferenceWeight1::Legacy"
+ }
+
+ # Placed like that for easy sorting according to preference
+ $results.Add("${releaseType}::${installationVersion}::${installationPath}") > $null
+ }
+ }
+ else
+ {
+ Write-Verbose "Could not locate vswhere at $vswhereExe"
+ }
+
+ if ("$env:vs140comntools" -ne "")
+ {
+ $installationPath = Split-Path -Parent $(Split-Path -Parent "$env:vs140comntools")
+ $clExe = "$installationPath\VC\bin\cl.exe"
+ $vcvarsallbat = "$installationPath\VC\vcvarsall.bat"
+
+ if ((Test-Path $clExe) -And (Test-Path $vcvarsallbat))
+ {
+ $results.Add("PreferenceWeight1::Legacy::14.0::$installationPath") > $null
+ }
+ }
+
+ $installationPath = "$programFiles\Microsoft Visual Studio 14.0"
+ $clExe = "$installationPath\VC\bin\cl.exe"
+ $vcvarsallbat = "$installationPath\VC\vcvarsall.bat"
+
+ if ((Test-Path $clExe) -And (Test-Path $vcvarsallbat))
+ {
+ $results.Add("PreferenceWeight1::Legacy::14.0::$installationPath") > $null
+ }
+
+ $results.Sort()
+ $results.Reverse()
+
+ return $results
+}
+
+function findAnyMSBuildWithCppPlatformToolset([string]$withVSPath)
+{
+ $VisualStudioInstances = getVisualStudioInstances
+ if ($VisualStudioInstances -eq $null)
+ {
+ throw "Could not find Visual Studio. VS2015 or VS2017 (with C++) needs to be installed."
+ }
+
+ Write-Verbose "VS Candidates:`n`r$([system.String]::Join([Environment]::NewLine, $VisualStudioInstances))"
+ foreach ($instanceCandidate in $VisualStudioInstances)
+ {
+ Write-Verbose "Inspecting: $instanceCandidate"
+ $split = $instanceCandidate -split "::"
+ # $preferenceWeight = $split[0]
+ # $releaseType = $split[1]
+ $version = $split[2]
+ $path = $split[3]
+
+ if ($withVSPath -ne "" -and $withVSPath -ne $path)
+ {
+ Write-Verbose "Skipping: $instanceCandidate"
+ continue
+ }
+
+ $majorVersion = $version.Substring(0,2);
+ if ($majorVersion -eq "15")
+ {
+ $VCFolder= "$path\VC\Tools\MSVC\"
+ if (Test-Path $VCFolder)
+ {
+ Write-Verbose "Picking: $instanceCandidate"
+ return "$path\MSBuild\15.0\Bin\MSBuild.exe", "v141"
+ }
+ }
+
+ if ($majorVersion -eq "14")
+ {
+ $clExe= "$path\VC\bin\cl.exe"
+ if (Test-Path $clExe)
+ {
+ Write-Verbose "Picking: $instanceCandidate"
+ $programFilesPath = getProgramFiles32bit
+ return "$programFilesPath\MSBuild\14.0\Bin\MSBuild.exe", "v140"
+ }
+ }
+ }
+
+ throw "Could not find MSBuild version with C++ support. VS2015 or VS2017 (with C++) needs to be installed."
+}
+function getWindowsSDK( [Parameter(Mandatory=$False)][switch]$DisableWin10SDK = $False,
+ [Parameter(Mandatory=$False)][switch]$DisableWin81SDK = $False,
+ [Parameter(Mandatory=$False)][string]$withWinSDK)
+{
+ if ($DisableWin10SDK -and $DisableWin81SDK)
+ {
+ throw "Both Win10SDK and Win81SDK were disabled."
+ }
+
+ Write-Verbose "Finding WinSDK"
+
+ $validInstances = New-Object System.Collections.ArrayList
+
+ # Windows 10 SDK
+ function CheckWindows10SDK($path)
+ {
+ if ($path -eq $null)
+ {
+ return
+ }
+
+ $folder = (Join-Path $path "Include")
+ if (!(Test-Path $folder))
+ {
+ Write-Verbose "$folder - Not Found"
+ return
+ }
+
+ Write-Verbose "$folder - Found"
+ $win10sdkVersions = @(Get-ChildItem $folder | Where-Object {$_.Name -match "^10"} | Sort-Object)
+ [array]::Reverse($win10sdkVersions) # Newest SDK first
+
+ foreach ($win10sdkV in $win10sdkVersions)
+ {
+ $windowsheader = "$folder\$win10sdkV\um\windows.h"
+ if (!(Test-Path $windowsheader))
+ {
+ Write-Verbose "$windowsheader - Not Found"
+ continue
+ }
+ Write-Verbose "$windowsheader - Found"
+
+ $ddkheader = "$folder\$win10sdkV\shared\sdkddkver.h"
+ if (!(Test-Path $ddkheader))
+ {
+ Write-Verbose "$ddkheader - Not Found"
+ continue
+ }
+
+ Write-Verbose "$ddkheader - Found"
+ $win10sdkVersionString = $win10sdkV.ToString()
+ Write-Verbose "Found $win10sdkVersionString"
+ $validInstances.Add($win10sdkVersionString) > $null
+ }
+ }
+
+ Write-Verbose "`n"
+ Write-Verbose "Looking for Windows 10 SDK"
+ $regkey10 = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots\' -Name 'KitsRoot10' -ErrorAction SilentlyContinue
+ $regkey10Wow6432 = Get-ItemProperty -Path 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows Kits\Installed Roots\' -Name 'KitsRoot10' -ErrorAction SilentlyContinue
+ if (vcpkgHasProperty -object $regkey10 "KitsRoot10") { CheckWindows10SDK($regkey10.KitsRoot10) }
+ if (vcpkgHasProperty -object $regkey10Wow6432 "KitsRoot10") { CheckWindows10SDK($regkey10Wow6432.KitsRoot10) }
+ CheckWindows10SDK("$env:ProgramFiles\Windows Kits\10")
+ CheckWindows10SDK("${env:ProgramFiles(x86)}\Windows Kits\10")
+
+ # Windows 8.1 SDK
+ function CheckWindows81SDK($path)
+ {
+ if ($path -eq $null)
+ {
+ return
+ }
+
+ $folder = "$path\Include"
+ if (!(Test-Path $folder))
+ {
+ Write-Verbose "$folder - Not Found"
+ return
+ }
+
+ Write-Verbose "$folder - Found"
+ $win81sdkVersionString = "8.1"
+ Write-Verbose "Found $win81sdkVersionString"
+ $validInstances.Add($win81sdkVersionString) > $null
+ }
+
+ Write-Verbose "`n"
+ Write-Verbose "Looking for Windows 8.1 SDK"
+ $regkey81 = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots\' -Name 'KitsRoot81' -ErrorAction SilentlyContinue
+ $regkey81Wow6432 = Get-ItemProperty -Path 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows Kits\Installed Roots\' -Name 'KitsRoot81' -ErrorAction SilentlyContinue
+ if (vcpkgHasProperty -object $regkey81 "KitsRoot81") { CheckWindows81SDK($regkey81.KitsRoot81) }
+ if (vcpkgHasProperty -object $regkey81Wow6432 "KitsRoot81") { CheckWindows81SDK($regkey81Wow6432.KitsRoot81) }
+ CheckWindows81SDK("$env:ProgramFiles\Windows Kits\8.1")
+ CheckWindows81SDK("${env:ProgramFiles(x86)}\Windows Kits\8.1")
+
+ Write-Verbose "`n`n`n"
+ Write-Verbose "The following Windows SDKs were found:"
+ foreach ($instance in $validInstances)
+ {
+ Write-Verbose $instance
+ }
+
+ # Selecting
+ if ($withWinSDK -ne "")
+ {
+ foreach ($instance in $validInstances)
+ {
+ if ($instance -eq $withWinSDK)
+ {
+ return $instance
+ }
+ }
+
+ throw "Could not find the requested Windows SDK version: $withWinSDK"
+ }
+
+ foreach ($instance in $validInstances)
+ {
+ if (!$DisableWin10SDK -and $instance -match "10.")
+ {
+ return $instance
+ }
+
+ if (!$DisableWin81SDK -and $instance -match "8.1")
+ {
+ return $instance
+ }
+ }
+
+ throw "Could not detect a Windows SDK / TargetPlatformVersion"
+}
+
+$msbuildExeWithPlatformToolset = findAnyMSBuildWithCppPlatformToolset $withVSPath
$msbuildExe = $msbuildExeWithPlatformToolset[0]
$platformToolset = $msbuildExeWithPlatformToolset[1]
-$windowsSDK = & $scriptsDir\getWindowsSDK.ps1
+$windowsSDK = getWindowsSDK -withWinSDK $withWinSDK
+
+$disableMetricsValue = "0"
+if ($disableMetrics)
+{
+ $disableMetricsValue = "1"
+}
+
+$platform = "x86"
+$vcpkgReleaseDir = "$vcpkgSourcesPath\msbuild.x86.release"
+
+if ($win64)
+{
+ $architecture=(Get-WmiObject win32_operatingsystem | Select-Object osarchitecture).osarchitecture
+ if (-not $architecture -like "*64*")
+ {
+ throw "Cannot build 64-bit on non-64-bit system"
+ }
+
+ $platform = "x64"
+ $vcpkgReleaseDir = "$vcpkgSourcesPath\msbuild.x64.release"
+}
$arguments = (
-"`"/p:VCPKG_VERSION=-$gitHash`"",
-"`"/p:DISABLE_METRICS=$disableMetrics`"",
+"`"/p:VCPKG_VERSION=-nohash`"",
+"`"/p:DISABLE_METRICS=$disableMetricsValue`"",
"/p:Configuration=Release",
-"/p:Platform=x86",
+"/p:Platform=$platform",
"/p:PlatformToolset=$platformToolset",
"/p:TargetPlatformVersion=$windowsSDK",
+"/p:PreferredToolArchitecture=x64",
+"/verbosity:minimal",
"/m",
+"/nologo",
"`"$vcpkgSourcesPath\dirs.proj`"") -join " "
+function vcpkgInvokeCommandClean()
+{
+ param ( [Parameter(Mandatory=$true)][string]$executable,
+ [string]$arguments = "")
+
+ Write-Verbose "Clean-Executing: ${executable} ${arguments}"
+ $scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition
+ $cleanEnvScript = "$scriptsDir\cleanEnvironmentHelper.ps1"
+ $tripleQuotes = "`"`"`""
+ $argumentsWithEscapedQuotes = $arguments -replace "`"", $tripleQuotes
+ $command = ". $tripleQuotes$cleanEnvScript$tripleQuotes; & $tripleQuotes$executable$tripleQuotes $argumentsWithEscapedQuotes"
+ $arg = "-NoProfile", "-ExecutionPolicy Bypass", "-command $command"
+
+ $process = Start-Process -FilePath powershell.exe -ArgumentList $arg -PassThru -NoNewWindow
+ Wait-Process -InputObject $process
+ $ec = $process.ExitCode
+ Write-Verbose "Execution terminated with exit code $ec."
+ return $ec
+}
+
# vcpkgInvokeCommandClean cmd "/c echo %PATH%"
+Write-Host "`nBuilding vcpkg.exe ...`n"
$ec = vcpkgInvokeCommandClean $msbuildExe $arguments
if ($ec -ne 0)
@@ -65,8 +384,10 @@ if ($ec -ne 0)
Write-Error "Building vcpkg.exe failed. Please ensure you have installed Visual Studio with the Desktop C++ workload and the Windows SDK for Desktop C++."
return
}
+Write-Host "`nBuilding vcpkg.exe... done.`n"
Write-Verbose("Placing vcpkg.exe in the correct location")
-Copy-Item $vcpkgSourcesPath\Release\vcpkg.exe $vcpkgRootDir\vcpkg.exe | Out-Null
-Copy-Item $vcpkgSourcesPath\Release\vcpkgmetricsuploader.exe $vcpkgRootDir\scripts\vcpkgmetricsuploader.exe | Out-Null
+Copy-Item "$vcpkgReleaseDir\vcpkg.exe" "$vcpkgRootDir\vcpkg.exe"
+Copy-Item "$vcpkgReleaseDir\vcpkgmetricsuploader.exe" "$vcpkgRootDir\scripts\vcpkgmetricsuploader.exe"
+Remove-Item "$vcpkgReleaseDir" -Force -Recurse -ErrorAction SilentlyContinue
diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh
index 95ee75af1..478183372 100644
--- a/scripts/bootstrap.sh
+++ b/scripts/bootstrap.sh
@@ -1,5 +1,16 @@
#!/bin/sh
+vcpkgDisableMetrics="OFF"
+for var in "$@"
+do
+ if [ "$var" = "-disableMetrics" ]; then
+ vcpkgDisableMetrics="ON"
+ else
+ echo "Unknown argument $var"
+ exit 1
+ fi
+done
+
# Find vcpkg-root
vcpkgRootDir=$(X= cd -- "$(dirname -- "$0")" && pwd -P)
while [ "$vcpkgRootDir" != "/" ] && ! [ -e "$vcpkgRootDir/.vcpkg-root" ]; do
@@ -97,7 +108,7 @@ fetchTool()
return 1
fi
- xmlFileAsString=`cat $vcpkgRootDir/scripts/vcpkgTools.xml`
+ xmlFileAsString=`cat "$vcpkgRootDir/scripts/vcpkgTools.xml"`
toolRegexStart="<tool name=\"$tool\" os=\"$os\">"
toolData="$(extractStringBetweenDelimiters "$xmlFileAsString" "$toolRegexStart" "</tool>")"
if [ "$toolData" = "" ]; then
@@ -157,7 +168,9 @@ selectCXX()
if [ "x$CXX" = "x" ]; then
CXX=g++
- if which g++-7 >/dev/null 2>&1; then
+ if which g++-8 >/dev/null 2>&1; then
+ CXX=g++-8
+ elif which g++-7 >/dev/null 2>&1; then
CXX=g++-7
elif which g++-6 >/dev/null 2>&1; then
CXX=g++-6
@@ -166,7 +179,7 @@ selectCXX()
gccversion="$("$CXX" -v 2>&1)"
gccversion="$(extractStringBetweenDelimiters "$gccversion" "gcc version " ".")"
- if [ "$gccversion" = "5" ]; then
+ if [ "$gccversion" -lt "6" ]; then
echo "CXX ($CXX) is too old; please install a newer compiler such as g++-7."
echo "sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y"
echo "sudo apt-get update -y"
@@ -188,7 +201,7 @@ buildDir="$vcpkgRootDir/toolsrc/build.rel"
rm -rf "$buildDir"
mkdir -p "$buildDir"
-(cd "$buildDir" && CXX=$CXX "$cmakeExe" .. -DCMAKE_BUILD_TYPE=Release -G "Ninja" "-DCMAKE_MAKE_PROGRAM=$ninjaExe")
+(cd "$buildDir" && CXX=$CXX "$cmakeExe" .. -DCMAKE_BUILD_TYPE=Release -G "Ninja" "-DCMAKE_MAKE_PROGRAM=$ninjaExe" "-DDEFINE_DISABLE_METRICS=$vcpkgDisableMetrics")
(cd "$buildDir" && "$cmakeExe" --build .)
rm -rf "$vcpkgRootDir/vcpkg"
diff --git a/scripts/buildsystems/msbuild/applocal.ps1 b/scripts/buildsystems/msbuild/applocal.ps1
index e5f3c3dd0..42bad4bcd 100644
--- a/scripts/buildsystems/msbuild/applocal.ps1
+++ b/scripts/buildsystems/msbuild/applocal.ps1
@@ -62,7 +62,7 @@ function resolve([string]$targetBinary) {
$g_searched.Set_Item($_, $true)
if (Test-Path "$installedDir\$_") {
deployBinary $baseTargetBinaryDir $installedDir "$_"
- if (Test-Path function:\deployPluginsIfQt) { deployPluginsIfQt $targetBinaryDir "$g_install_root\plugins" "$_" }
+ if (Test-Path function:\deployPluginsIfQt) { deployPluginsIfQt $baseTargetBinaryDir "$g_install_root\plugins" "$_" }
if (Test-Path function:\deployOpenNI2) { deployOpenNI2 $targetBinaryDir "$g_install_root" "$_" }
if (Test-Path function:\deployPluginsIfMagnum) {
if ($g_is_debug) {
diff --git a/scripts/buildsystems/msbuild/vcpkg.targets b/scripts/buildsystems/msbuild/vcpkg.targets
index 499052e4d..8807befd8 100644
--- a/scripts/buildsystems/msbuild/vcpkg.targets
+++ b/scripts/buildsystems/msbuild/vcpkg.targets
@@ -47,13 +47,17 @@
<PropertyGroup Condition="'$(Platform)|$(ApplicationType)|$(ApplicationTypeRevision)' == 'arm64|Windows Store|10.0'">
<VcpkgEnabled Condition="'$(VcpkgEnabled)' == ''">true</VcpkgEnabled>
<VcpkgTriplet Condition="'$(VcpkgTriplet)' == ''">arm64-uwp</VcpkgTriplet>
- </PropertyGroup>
+ </PropertyGroup>
<PropertyGroup Condition="'$(VcpkgEnabled)' == 'true'">
<VcpkgConfiguration Condition="'$(VcpkgConfiguration)' == ''">$(Configuration)</VcpkgConfiguration>
<VcpkgNormalizedConfiguration Condition="$(VcpkgConfiguration.StartsWith('Debug'))">Debug</VcpkgNormalizedConfiguration>
<VcpkgNormalizedConfiguration Condition="$(VcpkgConfiguration.StartsWith('Release')) or '$(VcpkgConfiguration)' == 'RelWithDebInfo' or '$(VcpkgConfiguration)' == 'MinSizeRel'">Release</VcpkgNormalizedConfiguration>
<VcpkgRoot Condition="'$(VcpkgRoot)' == ''">$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), .vcpkg-root))\installed\$(VcpkgTriplet)\</VcpkgRoot>
+ <VcpkgApplocalDeps Condition="'$(VcpkgApplocalDeps)' == ''">true</VcpkgApplocalDeps>
+ <!-- Deactivate Autolinking if lld is used as a linker. (Until a better way to solve the problem is found!).
+ Tried to add /lib as a parameter to the linker call but was unable to find a way to pass it as the first parameter. -->
+ <VcpkgAutoLink Condition="'$(UseLldLink)' == 'true' and '$(VcpkgAutoLink)' == ''">false</VcpkgAutoLink>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(VcpkgEnabled)' == 'true'">
@@ -77,7 +81,7 @@
<Message Text="Vcpkg is unable to link because we cannot decide between Release and Debug libraries. Please define the property VcpkgConfiguration to be 'Release' or 'Debug' (currently '$(VcpkgConfiguration)')." Importance="High" Condition="'$(VcpkgEnabled)' == 'true' and '$(VcpkgNormalizedConfiguration)' == ''"/>
</Target>
- <Target Name="AppLocalFromInstalled" AfterTargets="CopyFilesToOutputDirectory" BeforeTargets="CopyLocalFilesOutputGroup;RegisterOutput" Condition="'$(VcpkgEnabled)' == 'true'">
+ <Target Name="AppLocalFromInstalled" AfterTargets="CopyFilesToOutputDirectory" BeforeTargets="CopyLocalFilesOutputGroup;RegisterOutput" Condition="'$(VcpkgEnabled)' == 'true' and '$(VcpkgApplocalDeps)' == 'true'">
<WriteLinesToFile
File="$(TLogLocation)$(ProjectName).write.1u.tlog"
Lines="^$(TargetPath);$([System.IO.Path]::Combine($(ProjectDir),$(IntDir)))vcpkg.applocal.log" Encoding="Unicode"/>
diff --git a/scripts/VcpkgPowershellUtils-ClearEnvironment.ps1 b/scripts/cleanEnvironmentHelper.ps1
index 0a133f5f8..a3792ecd3 100644
--- a/scripts/VcpkgPowershellUtils-ClearEnvironment.ps1
+++ b/scripts/cleanEnvironmentHelper.ps1
@@ -17,7 +17,7 @@ foreach ($name in $nameSet)
}
# PATH needs to be concatenated as it has values in both machine and user environment. Any other values should be set.
- if ($name -match 'path')
+ if ($name -eq 'path')
{
$pathValuePartial = @()
# Machine values before user values
diff --git a/scripts/cmake/vcpkg_acquire_msys.cmake b/scripts/cmake/vcpkg_acquire_msys.cmake
index eec08e3f1..ed4f7ac29 100644
--- a/scripts/cmake/vcpkg_acquire_msys.cmake
+++ b/scripts/cmake/vcpkg_acquire_msys.cmake
@@ -39,6 +39,10 @@ function(vcpkg_acquire_msys PATH_TO_ROOT_OUT)
set(TOOLPATH ${DOWNLOADS}/tools/msys2)
cmake_parse_arguments(_am "" "" "PACKAGES" ${ARGN})
+ if(NOT CMAKE_HOST_WIN32)
+ message(FATAL_ERROR "vcpkg_acquire_msys() can only be used on Windows hosts")
+ endif()
+
# detect host architecture
if(DEFINED ENV{PROCESSOR_ARCHITEW6432})
set(_vam_HOST_ARCHITECTURE $ENV{PROCESSOR_ARCHITEW6432})
diff --git a/scripts/cmake/vcpkg_add_to_path.cmake b/scripts/cmake/vcpkg_add_to_path.cmake
new file mode 100644
index 000000000..6890dfe31
--- /dev/null
+++ b/scripts/cmake/vcpkg_add_to_path.cmake
@@ -0,0 +1,41 @@
+## # vcpkg_add_to_path
+##
+## Add a directory to the PATH environment variable
+##
+## ## Usage
+## ```cmake
+## vcpkg_add_to_path([PREPEND] <${PYTHON3_DIR}>)
+## ```
+##
+## ## Parameters
+## ### <positional>
+## The directory to add
+##
+## ### PREPEND
+## Prepends the directory.
+##
+## The default is to append.
+function(vcpkg_add_to_path)
+ if(NOT "${ARGC}" STREQUAL "1" AND NOT "${ARGC}" STREQUAL "2")
+ message(FATAL_ERROR "vcpkg_add_to_path() only accepts 1 or 2 arguments.")
+ endif()
+ if("${ARGV0}" STREQUAL "PREPEND")
+ if(NOT "${ARGC}" STREQUAL "2")
+ message(FATAL_ERROR "Expected second argument.")
+ endif()
+ if(CMAKE_HOST_WIN32)
+ set(ENV{PATH} "${ARGV1};$ENV{PATH}")
+ else()
+ set(ENV{PATH} "${ARGV1}:$ENV{PATH}")
+ endif()
+ else()
+ if(NOT "${ARGC}" STREQUAL "1")
+ message(FATAL_ERROR "Unexpected second argument: ${ARGV1}")
+ endif()
+ if(CMAKE_HOST_WIN32)
+ set(ENV{PATH} "$ENV{PATH};${ARGV0}")
+ else()
+ set(ENV{PATH} "$ENV{PATH}:${ARGV0}")
+ endif()
+ endif()
+endfunction() \ No newline at end of file
diff --git a/scripts/cmake/vcpkg_apply_patches.cmake b/scripts/cmake/vcpkg_apply_patches.cmake
index 1894d6e9a..ac0b78e20 100644
--- a/scripts/cmake/vcpkg_apply_patches.cmake
+++ b/scripts/cmake/vcpkg_apply_patches.cmake
@@ -37,10 +37,11 @@ function(vcpkg_apply_patches)
find_program(GIT NAMES git git.cmd)
set(PATCHNUM 0)
foreach(PATCH ${_ap_PATCHES})
+ get_filename_component(ABSOLUTE_PATCH "${PATCH}" ABSOLUTE BASE_DIR "${CURRENT_PORT_DIR}")
message(STATUS "Applying patch ${PATCH}")
set(LOGNAME patch-${TARGET_TRIPLET}-${PATCHNUM})
execute_process(
- COMMAND ${GIT} --work-tree=. --git-dir=.git apply "${PATCH}" --ignore-whitespace --whitespace=nowarn --verbose
+ COMMAND ${GIT} --work-tree=. --git-dir=.git apply "${ABSOLUTE_PATCH}" --ignore-whitespace --whitespace=nowarn --verbose
OUTPUT_FILE ${CURRENT_BUILDTREES_DIR}/${LOGNAME}-out.log
ERROR_FILE ${CURRENT_BUILDTREES_DIR}/${LOGNAME}-err.log
WORKING_DIRECTORY ${_ap_SOURCE_PATH}
@@ -51,7 +52,6 @@ function(vcpkg_apply_patches)
message(STATUS "Applying patch failed. This is expected if this patch was previously applied.")
endif()
- message(STATUS "Applying patch ${PATCH} done")
math(EXPR PATCHNUM "${PATCHNUM}+1")
endforeach()
endfunction()
diff --git a/scripts/cmake/vcpkg_build_cmake.cmake b/scripts/cmake/vcpkg_build_cmake.cmake
index 983ac9221..2f0da07f9 100644
--- a/scripts/cmake/vcpkg_build_cmake.cmake
+++ b/scripts/cmake/vcpkg_build_cmake.cmake
@@ -74,16 +74,21 @@ function(vcpkg_build_cmake)
set(CONFIG "Release")
endif()
- message(STATUS "Build ${TARGET_TRIPLET}-${SHORT_BUILDTYPE}")
+ message(STATUS "Building ${TARGET_TRIPLET}-${SHORT_BUILDTYPE}")
set(LOGPREFIX "${CURRENT_BUILDTREES_DIR}/${_bc_LOGFILE_ROOT}-${TARGET_TRIPLET}-${SHORT_BUILDTYPE}")
set(LOGS)
if(_bc_ADD_BIN_TO_PATH)
set(_BACKUP_ENV_PATH "$ENV{PATH}")
+ if(CMAKE_HOST_WIN32)
+ set(_PATHSEP ";")
+ else()
+ set(_PATHSEP ":")
+ endif()
if(BUILDTYPE STREQUAL "debug")
- set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/bin;$ENV{PATH}")
+ set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/bin${_PATHSEP}$ENV{PATH}")
else()
- set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin;$ENV{PATH}")
+ set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin${_PATHSEP}$ENV{PATH}")
endif()
endif()
execute_process(
@@ -174,7 +179,6 @@ function(vcpkg_build_cmake)
${STRINGIFIED_LOGS})
endif()
endif()
- message(STATUS "Build ${TARGET_TRIPLET}-${SHORT_BUILDTYPE} done")
if(_bc_ADD_BIN_TO_PATH)
set(ENV{PATH} "${_BACKUP_ENV_PATH}")
endif()
diff --git a/scripts/cmake/vcpkg_build_msbuild.cmake b/scripts/cmake/vcpkg_build_msbuild.cmake
index db04530ef..7a65127f0 100644
--- a/scripts/cmake/vcpkg_build_msbuild.cmake
+++ b/scripts/cmake/vcpkg_build_msbuild.cmake
@@ -1,6 +1,6 @@
## # vcpkg_build_msbuild
##
-## Build an msbuild-based project.
+## Build an msbuild-based project. Deprecated in favor of `vcpkg_install_msbuild()`.
##
## ## Usage
## ```cmake
@@ -15,6 +15,7 @@
## [OPTIONS </p:ZLIB_INCLUDE_PATH=X>...]
## [OPTIONS_RELEASE </p:ZLIB_LIB=X>...]
## [OPTIONS_DEBUG </p:ZLIB_LIB=X>...]
+## [USE_VCPKG_INTEGRATION]
## )
## ```
##
@@ -105,7 +106,11 @@ function(vcpkg_build_msbuild)
endif()
if(_csc_USE_VCPKG_INTEGRATION)
- list(APPEND _csc_OPTIONS /p:ForceImportBeforeCppTargets=${VCPKG_ROOT_DIR}/scripts/buildsystems/msbuild/vcpkg.targets)
+ list(
+ APPEND _csc_OPTIONS
+ /p:ForceImportBeforeCppTargets=${VCPKG_ROOT_DIR}/scripts/buildsystems/msbuild/vcpkg.targets
+ "/p:VcpkgTriplet=${TARGET_TRIPLET}"
+ )
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
diff --git a/scripts/cmake/vcpkg_build_qmake.cmake b/scripts/cmake/vcpkg_build_qmake.cmake
index 194ab8206..189a1113b 100644
--- a/scripts/cmake/vcpkg_build_qmake.cmake
+++ b/scripts/cmake/vcpkg_build_qmake.cmake
@@ -33,7 +33,6 @@ function(vcpkg_build_qmake)
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${LOG_SUFFIX}
LOGNAME package-${LOG_PREFIX}-${TARGET_TRIPLET}-${LOG_SUFFIX}
)
- message(STATUS "Package ${LOG_PREFIX}-${TARGET_TRIPLET}-${LOG_SUFFIX} done")
endfunction()
# This fixes issues on machines with default codepages that are not ASCII compatible, such as some CJK encodings
@@ -53,6 +52,11 @@ function(vcpkg_build_qmake)
string(REPLACE "zlib.lib" "zlibd.lib" _contents "${_contents}")
string(REPLACE "installed\\${TARGET_TRIPLET}\\lib" "installed\\${TARGET_TRIPLET}\\debug\\lib" _contents "${_contents}")
string(REPLACE "/LIBPATH:${NATIVE_INSTALLED_DIR}\\debug\\lib qtmaind.lib" "shell32.lib /LIBPATH:${NATIVE_INSTALLED_DIR}\\debug\\lib\\manual-link qtmaind.lib /LIBPATH:${NATIVE_INSTALLED_DIR}\\debug\\lib" _contents "${_contents}")
+ string(REPLACE "tools\\qt5\\qmlcachegen.exe" "tools\\qt5-declarative\\qmlcachegen.exe" _contents "${_contents}")
+ string(REPLACE "tools/qt5/qmlcachegen" "tools/qt5-declarative/qmlcachegen" _contents "${_contents}")
+ string(REPLACE "debug\\lib\\Qt5Bootstrap.lib" "tools\\qt5\\Qt5Bootstrap.lib" _contents "${_contents}")
+ string(REPLACE "lib\\Qt5Bootstrap.lib" "tools\\qt5\\Qt5Bootstrap.lib" _contents "${_contents}")
+ string(REPLACE " Qt5Bootstrap.lib " " ${NATIVE_INSTALLED_DIR}\\tools\\qt5\\Qt5Bootstrap.lib Ole32.lib Netapi32.lib Advapi32.lib ${NATIVE_INSTALLED_DIR}\\lib\\zlib.lib Shell32.lib " _contents "${_contents}")
file(WRITE "${DEBUG_MAKEFILE}" "${_contents}")
endforeach()
endif()
@@ -69,6 +73,11 @@ function(vcpkg_build_qmake)
foreach(RELEASE_MAKEFILE ${RELEASE_MAKEFILES})
file(READ "${RELEASE_MAKEFILE}" _contents)
string(REPLACE "/LIBPATH:${NATIVE_INSTALLED_DIR}\\lib qtmain.lib" "shell32.lib /LIBPATH:${NATIVE_INSTALLED_DIR}\\lib\\manual-link qtmain.lib /LIBPATH:${NATIVE_INSTALLED_DIR}\\lib" _contents "${_contents}")
+ string(REPLACE "tools\\qt5\\qmlcachegen.exe" "tools\\qt5-declarative\\qmlcachegen.exe" _contents "${_contents}")
+ string(REPLACE "tools/qt5/qmlcachegen" "tools/qt5-declarative/qmlcachegen" _contents "${_contents}")
+ string(REPLACE "debug\\lib\\Qt5Bootstrap.lib" "tools\\qt5\\Qt5Bootstrap.lib" _contents "${_contents}")
+ string(REPLACE "lib\\Qt5Bootstrap.lib" "tools\\qt5\\Qt5Bootstrap.lib" _contents "${_contents}")
+ string(REPLACE " Qt5Bootstrap.lib " " ${NATIVE_INSTALLED_DIR}\\tools\\qt5\\Qt5Bootstrap.lib Ole32.lib Netapi32.lib Advapi32.lib ${NATIVE_INSTALLED_DIR}\\lib\\zlib.lib Shell32.lib " _contents "${_contents}")
file(WRITE "${RELEASE_MAKEFILE}" "${_contents}")
endforeach()
endif()
diff --git a/scripts/cmake/vcpkg_check_linkage.cmake b/scripts/cmake/vcpkg_check_linkage.cmake
new file mode 100644
index 000000000..101adc4fd
--- /dev/null
+++ b/scripts/cmake/vcpkg_check_linkage.cmake
@@ -0,0 +1,53 @@
+## # vcpkg_check_linkage
+##
+## Asserts the available library and CRT linkage options for the port.
+##
+## ## Usage
+## ```cmake
+## vcpkg_check_linkage(
+## [ONLY_STATIC_LIBRARY | ONLY_DYNAMIC_LIBRARY]
+## [ONLY_STATIC_CRT | ONLY_DYNAMIC_CRT]
+## )
+## ```
+##
+## ## Parameters
+## ### ONLY_STATIC_LIBRARY
+## Indicates that this port can only be built with static library linkage.
+##
+## ### ONLY_DYNAMIC_LIBRARY
+## Indicates that this port can only be built with dynamic/shared library linkage.
+##
+## ### ONLY_STATIC_CRT
+## Indicates that this port can only be built with static CRT linkage.
+##
+## ### ONLY_DYNAMIC_CRT
+## Indicates that this port can only be built with dynamic/shared CRT linkage.
+##
+## ## Notes
+## This command will either alter the settings for `VCPKG_LIBRARY_LINKAGE` or fail, depending on what was requested by the user versus what the library supports.
+##
+## ## Examples
+##
+## * [libimobiledevice](https://github.com/Microsoft/vcpkg/blob/master/ports/libimobiledevice/portfile.cmake)
+function(vcpkg_check_linkage)
+ cmake_parse_arguments(_csc "ONLY_STATIC_LIBRARY;ONLY_DYNAMIC_LIBRARY;ONLY_DYNAMIC_CRT;ONLY_STATIC_CRT" "" "" ${ARGN})
+
+ if(_csc_ONLY_STATIC_LIBRARY AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ message(STATUS "Note: ${PORT} only supports static library linkage. Building static library.")
+ set(VCPKG_LIBRARY_LINKAGE static PARENT_SCOPE)
+ endif()
+ if(_csc_ONLY_DYNAMIC_LIBRARY AND VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ message(STATUS "Note: ${PORT} only supports dynamic library linkage. Building dynamic library.")
+ if(VCPKG_CRT_LINKAGE STREQUAL "static")
+ message(FATAL_ERROR "Refusing to build unexpected dynamic library against the static CRT. If this is desired, please configure your triplet to directly request this configuration.")
+ endif()
+ set(VCPKG_LIBRARY_LINKAGE dynamic PARENT_SCOPE)
+ endif()
+
+ if(_csc_ONLY_DYNAMIC_CRT AND VCPKG_CRT_LINKAGE STREQUAL "static")
+ message(FATAL_ERROR "${PORT} only supports dynamic crt linkage")
+ endif()
+ if(_csc_ONLY_STATIC_CRT AND VCPKG_CRT_LINKAGE STREQUAL "dynamic")
+ message(FATAL_ERROR "${PORT} only supports static crt linkage")
+ endif()
+endfunction()
diff --git a/scripts/cmake/vcpkg_clean_msbuild.cmake b/scripts/cmake/vcpkg_clean_msbuild.cmake
new file mode 100644
index 000000000..b0d77dfd2
--- /dev/null
+++ b/scripts/cmake/vcpkg_clean_msbuild.cmake
@@ -0,0 +1,19 @@
+## # vcpkg_clean_msbuild
+##
+## Clean intermediate files generated by `vcpkg_install_msbuild()`.
+##
+## ## Usage
+## ```cmake
+## vcpkg_clean_msbuild()
+## ```
+##
+## ## Examples
+##
+## * [xalan-c](https://github.com/Microsoft/vcpkg/blob/master/ports/xalan-c/portfile.cmake)
+
+function(vcpkg_clean_msbuild)
+ file(REMOVE_RECURSE
+ ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
+ ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
+ )
+endfunction()
diff --git a/scripts/cmake/vcpkg_common_functions.cmake b/scripts/cmake/vcpkg_common_functions.cmake
index 27dd0732d..d66fc5eff 100644
--- a/scripts/cmake/vcpkg_common_functions.cmake
+++ b/scripts/cmake/vcpkg_common_functions.cmake
@@ -1,17 +1,23 @@
include(vcpkg_acquire_msys)
+include(vcpkg_add_to_path)
+include(vcpkg_check_linkage)
+include(vcpkg_clean_msbuild)
include(vcpkg_download_distfile)
include(vcpkg_extract_source_archive)
+include(vcpkg_extract_source_archive_ex)
include(vcpkg_execute_required_process)
include(vcpkg_execute_required_process_repeat)
include(vcpkg_find_acquire_program)
include(vcpkg_fixup_cmake_targets)
include(vcpkg_from_github)
+include(vcpkg_from_gitlab)
include(vcpkg_from_bitbucket)
include(vcpkg_build_cmake)
include(vcpkg_build_msbuild)
include(vcpkg_build_qmake)
include(vcpkg_install_cmake)
include(vcpkg_install_meson)
+include(vcpkg_install_msbuild)
include(vcpkg_configure_cmake)
include(vcpkg_configure_meson)
include(vcpkg_configure_qmake)
@@ -21,4 +27,6 @@ include(vcpkg_copy_tool_dependencies)
include(vcpkg_get_program_files_32_bit)
include(vcpkg_get_program_files_platform_bitness)
include(vcpkg_get_windows_sdk)
-include(vcpkg_replace_string) \ No newline at end of file
+include(vcpkg_replace_string)
+include(vcpkg_from_git)
+include(vcpkg_test_cmake)
diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake
index 3e0922428..617fe1a0f 100644
--- a/scripts/cmake/vcpkg_configure_cmake.cmake
+++ b/scripts/cmake/vcpkg_configure_cmake.cmake
@@ -62,6 +62,12 @@ function(vcpkg_configure_cmake)
set(_csc_HOST_ARCHITECTURE $ENV{PROCESSOR_ARCHITECTURE})
endif()
+ if(CMAKE_HOST_WIN32)
+ set(_PATHSEP ";")
+ else()
+ set(_PATHSEP ":")
+ endif()
+
set(NINJA_CAN_BE_USED ON) # Ninja as generator
set(NINJA_HOST ON) # Ninja as parallel configurator
if(_csc_HOST_ARCHITECTURE STREQUAL "x86")
@@ -114,7 +120,7 @@ function(vcpkg_configure_cmake)
if(GENERATOR STREQUAL "Ninja")
vcpkg_find_acquire_program(NINJA)
get_filename_component(NINJA_PATH ${NINJA} DIRECTORY)
- set(ENV{PATH} "$ENV{PATH};${NINJA_PATH}")
+ set(ENV{PATH} "$ENV{PATH}${_PATHSEP}${NINJA_PATH}")
list(APPEND _csc_OPTIONS "-DCMAKE_MAKE_PROGRAM=${NINJA}")
endif()
@@ -122,6 +128,9 @@ function(vcpkg_configure_cmake)
if(DEFINED VCPKG_CMAKE_SYSTEM_NAME)
list(APPEND _csc_OPTIONS "-DCMAKE_SYSTEM_NAME=${VCPKG_CMAKE_SYSTEM_NAME}")
+ if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND NOT DEFINED VCPKG_CMAKE_SYSTEM_VERSION)
+ set(VCPKG_CMAKE_SYSTEM_VERSION 10.0)
+ endif()
endif()
if(DEFINED VCPKG_CMAKE_SYSTEM_VERSION)
list(APPEND _csc_OPTIONS "-DCMAKE_SYSTEM_VERSION=${VCPKG_CMAKE_SYSTEM_VERSION}")
@@ -192,6 +201,17 @@ function(vcpkg_configure_cmake)
)
endif()
+ # Sets configuration variables for macOS builds
+ if(DEFINED VCPKG_INSTALL_NAME_DIR)
+ list(APPEND _csc_OPTIONS "-DCMAKE_INSTALL_NAME_DIR=${VCPKG_INSTALL_NAME_DIR}")
+ endif()
+ if(DEFINED VCPKG_OSX_DEPLOYMENT_TARGET)
+ list(APPEND _csc_OPTIONS "-DCMAKE_OSX_DEPLOYMENT_TARGET=${VCPKG_OSX_DEPLOYMENT_TARGET}")
+ endif()
+ if(DEFINED VCPKG_OSX_SYSROOT)
+ list(APPEND _csc_OPTIONS "-DCMAKE_OSX_SYSROOT=${VCPKG_OSX_SYSROOT}")
+ endif()
+
set(rel_command
${CMAKE_COMMAND} ${_csc_SOURCE_PATH} "${_csc_OPTIONS}" "${_csc_OPTIONS_RELEASE}"
-G ${GENERATOR}
@@ -207,7 +227,7 @@ function(vcpkg_configure_cmake)
vcpkg_find_acquire_program(NINJA)
get_filename_component(NINJA_PATH ${NINJA} DIRECTORY)
- set(ENV{PATH} "$ENV{PATH};${NINJA_PATH}")
+ set(ENV{PATH} "$ENV{PATH}${_PATHSEP}${NINJA_PATH}")
#parallelize the configure step
set(_contents
@@ -239,7 +259,6 @@ function(vcpkg_configure_cmake)
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vcpkg-parallel-configure
LOGNAME config-${TARGET_TRIPLET}
)
- message(STATUS "Configuring ${TARGET_TRIPLET} done")
else()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg")
@@ -249,7 +268,6 @@ function(vcpkg_configure_cmake)
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
LOGNAME config-${TARGET_TRIPLET}-dbg
)
- message(STATUS "Configuring ${TARGET_TRIPLET}-dbg done")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
@@ -260,7 +278,6 @@ function(vcpkg_configure_cmake)
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
LOGNAME config-${TARGET_TRIPLET}-rel
)
- message(STATUS "Configuring ${TARGET_TRIPLET}-rel done")
endif()
endif()
diff --git a/scripts/cmake/vcpkg_configure_meson.cmake b/scripts/cmake/vcpkg_configure_meson.cmake
index 9b87261d5..3c6903c9d 100644
--- a/scripts/cmake/vcpkg_configure_meson.cmake
+++ b/scripts/cmake/vcpkg_configure_meson.cmake
@@ -39,7 +39,12 @@ function(vcpkg_configure_meson)
vcpkg_find_acquire_program(MESON)
vcpkg_find_acquire_program(NINJA)
get_filename_component(NINJA_PATH ${NINJA} DIRECTORY)
- set(ENV{PATH} "$ENV{PATH};${NINJA_PATH}")
+ if(CMAKE_HOST_WIN32)
+ set(_PATHSEP ";")
+ else()
+ set(_PATHSEP ":")
+ endif()
+ set(ENV{PATH} "$ENV{PATH}${_PATHSEP}${NINJA_PATH}")
# configure release
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
diff --git a/scripts/cmake/vcpkg_copy_pdbs.cmake b/scripts/cmake/vcpkg_copy_pdbs.cmake
index ca55eb015..4e9f642b5 100644
--- a/scripts/cmake/vcpkg_copy_pdbs.cmake
+++ b/scripts/cmake/vcpkg_copy_pdbs.cmake
@@ -4,17 +4,32 @@
##
## ## Usage
## ```cmake
-## vcpkg_copy_pdbs()
+## vcpkg_copy_pdbs([BUILD_PATHS <${CURRENT_PACKAGES_DIR}/bin/*.dll> ...])
## ```
##
## ## Notes
## This command should always be called by portfiles after they have finished rearranging the binary output.
##
+## ## Parameters
+## ### BUILD_PATHS
+## Path patterns passed to `file(GLOB_RECURSE)` for locating dlls.
+##
+## Defaults to `${CURRENT_PACKAGES_DIR}/bin/*.dll` and `${CURRENT_PACKAGES_DIR}/debug/bin/*.dll`.
+##
## ## Examples
##
## * [zlib](https://github.com/Microsoft/vcpkg/blob/master/ports/zlib/portfile.cmake)
## * [cpprestsdk](https://github.com/Microsoft/vcpkg/blob/master/ports/cpprestsdk/portfile.cmake)
function(vcpkg_copy_pdbs)
+ cmake_parse_arguments(_vcp "" "" "BUILD_PATHS" ${ARGN})
+
+ if(NOT _vcp_BUILD_PATHS)
+ set(
+ _vcp_BUILD_PATHS
+ ${CURRENT_PACKAGES_DIR}/bin/*.dll
+ ${CURRENT_PACKAGES_DIR}/debug/bin/*.dll
+ )
+ endif()
function(merge_filelist OUTVAR INVAR)
set(MSG "")
@@ -25,7 +40,7 @@ function(vcpkg_copy_pdbs)
endfunction()
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
- file(GLOB_RECURSE DLLS ${CURRENT_PACKAGES_DIR}/bin/*.dll ${CURRENT_PACKAGES_DIR}/debug/bin/*.dll)
+ file(GLOB_RECURSE DLLS ${_vcp_BUILD_PATHS})
set(DLLS_WITHOUT_MATCHING_PDBS)
diff --git a/scripts/cmake/vcpkg_download_distfile.cmake b/scripts/cmake/vcpkg_download_distfile.cmake
index 9fc0a0c9a..949036c88 100644
--- a/scripts/cmake/vcpkg_download_distfile.cmake
+++ b/scripts/cmake/vcpkg_download_distfile.cmake
@@ -68,7 +68,12 @@ function(vcpkg_download_distfile VAR)
set(downloaded_file_path ${DOWNLOADS}/${vcpkg_download_distfile_FILENAME})
set(download_file_path_part "${DOWNLOADS}/temp/${vcpkg_download_distfile_FILENAME}")
- file(REMOVE_RECURSE "${DOWNLOADS}/temp")
+ # Works around issue #3399
+ if(IS_DIRECTORY "${DOWNLOADS}/temp")
+ file(REMOVE_RECURSE "${DOWNLOADS}/temp0")
+ file(RENAME "${DOWNLOADS}/temp" "${DOWNLOADS}/temp0")
+ file(REMOVE_RECURSE "${DOWNLOADS}/temp0")
+ endif()
file(MAKE_DIRECTORY "${DOWNLOADS}/temp")
function(test_hash FILE_PATH FILE_KIND CUSTOM_ERROR_ADVICE)
@@ -81,9 +86,8 @@ function(vcpkg_download_distfile VAR)
return()
endif()
- message(STATUS "Testing integrity of ${FILE_KIND}...")
file(SHA512 ${FILE_PATH} FILE_HASH)
- if(NOT "${FILE_HASH}" STREQUAL "${vcpkg_download_distfile_SHA512}")
+ if(NOT FILE_HASH STREQUAL vcpkg_download_distfile_SHA512)
message(FATAL_ERROR
"\nFile does not have expected hash:\n"
" File path: [ ${FILE_PATH} ]\n"
@@ -91,10 +95,9 @@ function(vcpkg_download_distfile VAR)
" Actual hash: [ ${FILE_HASH} ]\n"
"${CUSTOM_ERROR_ADVICE}\n")
endif()
- message(STATUS "Testing integrity of ${FILE_KIND}... OK")
endfunction()
- if(EXISTS ${downloaded_file_path})
+ if(EXISTS "${downloaded_file_path}")
message(STATUS "Using cached ${downloaded_file_path}")
test_hash("${downloaded_file_path}" "cached file" "Please delete the file and retry if this file should be downloaded again.")
else()
@@ -104,7 +107,7 @@ function(vcpkg_download_distfile VAR)
# Tries to download the file.
list(GET vcpkg_download_distfile_URLS 0 SAMPLE_URL)
- if(${_VCPKG_DOWNLOAD_TOOL} MATCHES "ARIA2" AND NOT ${SAMPLE_URL} MATCHES "aria2")
+ if(_VCPKG_DOWNLOAD_TOOL STREQUAL "ARIA2" AND NOT SAMPLE_URL MATCHES "aria2")
vcpkg_find_acquire_program("ARIA2")
message(STATUS "Downloading ${vcpkg_download_distfile_FILENAME}...")
execute_process(
@@ -127,7 +130,6 @@ function(vcpkg_download_distfile VAR)
)
set(download_success 0)
else()
- message(STATUS "Downloading ${vcpkg_download_distfile_FILENAME}... OK")
file(REMOVE
${DOWNLOADS}/download-${vcpkg_download_distfile_FILENAME}-out.log
${DOWNLOADS}/download-${vcpkg_download_distfile_FILENAME}-err.log
@@ -144,7 +146,6 @@ function(vcpkg_download_distfile VAR)
message(STATUS "Downloading ${url}... Failed. Status: ${download_status}")
set(download_success 0)
else()
- message(STATUS "Downloading ${url}... OK")
set(download_success 1)
break()
endif()
diff --git a/scripts/cmake/vcpkg_extract_source_archive.cmake b/scripts/cmake/vcpkg_extract_source_archive.cmake
index 5c16616c6..a55419b19 100644
--- a/scripts/cmake/vcpkg_extract_source_archive.cmake
+++ b/scripts/cmake/vcpkg_extract_source_archive.cmake
@@ -1,6 +1,6 @@
## # vcpkg_extract_source_archive
##
-## Extract an archive into the source directory.
+## Extract an archive into the source directory. Deprecated in favor of [`vcpkg_extract_source_archive_ex`](vcpkg_extract_source_archive_ex.md).
##
## ## Usage
## ```cmake
@@ -29,40 +29,22 @@
## * [msgpack](https://github.com/Microsoft/vcpkg/blob/master/ports/msgpack/portfile.cmake)
include(vcpkg_execute_required_process)
-function(vcpkg_extract_source_archive_ex)
- cmake_parse_arguments(_vesae "" "ARCHIVE;WORKING_DIRECTORY" "" ${ARGN})
-
- if(NOT _vesae_ARCHIVE)
- message(FATAL_ERROR "Must specify ARCHIVE parameter to vcpkg_extract_source_archive_ex()")
- endif()
-
- if(DEFINED _vesae_WORKING_DIRECTORY)
- set(WORKING_DIRECTORY ${_vesae_WORKING_DIRECTORY})
+function(vcpkg_extract_source_archive ARCHIVE)
+ if(NOT ARGC EQUAL 2)
+ set(WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/src")
else()
- set(WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/src)
+ set(WORKING_DIRECTORY ${ARGV1})
endif()
- get_filename_component(ARCHIVE_FILENAME ${_vesae_ARCHIVE} NAME)
+ get_filename_component(ARCHIVE_FILENAME "${ARCHIVE}" NAME)
if(NOT EXISTS ${WORKING_DIRECTORY}/${ARCHIVE_FILENAME}.extracted)
- message(STATUS "Extracting source ${_vesae_ARCHIVE}")
+ message(STATUS "Extracting source ${ARCHIVE}")
file(MAKE_DIRECTORY ${WORKING_DIRECTORY})
vcpkg_execute_required_process(
- COMMAND ${CMAKE_COMMAND} -E tar xjf ${_vesae_ARCHIVE}
+ COMMAND ${CMAKE_COMMAND} -E tar xjf ${ARCHIVE}
WORKING_DIRECTORY ${WORKING_DIRECTORY}
LOGNAME extract
)
file(WRITE ${WORKING_DIRECTORY}/${ARCHIVE_FILENAME}.extracted)
endif()
- message(STATUS "Extracting done")
endfunction()
-
-function(vcpkg_extract_source_archive ARCHIVE)
- if(NOT ARGC EQUAL 2)
- vcpkg_extract_source_archive_ex(ARCHIVE ${ARCHIVE})
- else()
- vcpkg_extract_source_archive_ex(
- ARCHIVE ${ARCHIVE}
- WORKING_DIRECTORY ${ARGV1}
- )
- endif()
-endfunction() \ No newline at end of file
diff --git a/scripts/cmake/vcpkg_extract_source_archive_ex.cmake b/scripts/cmake/vcpkg_extract_source_archive_ex.cmake
new file mode 100644
index 000000000..a70a5e4a3
--- /dev/null
+++ b/scripts/cmake/vcpkg_extract_source_archive_ex.cmake
@@ -0,0 +1,130 @@
+## # vcpkg_extract_source_archive_ex
+##
+## Extract an archive into the source directory. Replaces [`vcpkg_extract_source_archive`](vcpkg_extract_source_archive.md).
+##
+## ## Usage
+## ```cmake
+## vcpkg_extract_source_archive_ex(
+## OUT_SOURCE_PATH <SOURCE_PATH>
+## ARCHIVE <${ARCHIVE}>
+## [REF <1.0.0>]
+## [NO_REMOVE_ONE_LEVEL]
+## [WORKING_DIRECTORY <${CURRENT_BUILDTREES_DIR}/src>]
+## [PATCHES <a.patch>...]
+## )
+## ```
+## ## Parameters
+## ### OUT_SOURCE_PATH
+## Specifies the out-variable that will contain the extracted location.
+##
+## This should be set to `SOURCE_PATH` by convention.
+##
+## ### ARCHIVE
+## The full path to the archive to be extracted.
+##
+## This is usually obtained from calling [`vcpkg_download_distfile`](vcpkg_download_distfile.md).
+##
+## ### REF
+## A friendly name that will be used instead of the filename of the archive.
+##
+## By convention, this is set to the version number or tag fetched
+##
+## ### WORKING_DIRECTORY
+## If specified, the archive will be extracted into the working directory instead of `${CURRENT_BUILDTREES_DIR}/src/`.
+##
+## Note that the archive will still be extracted into a subfolder underneath that directory (`${WORKING_DIRECTORY}/${REF}-${HASH}/`).
+##
+## ### PATCHES
+## A list of patches to be applied to the extracted sources.
+##
+## Relative paths are based on the port directory.
+##
+## ### NO_REMOVE_ONE_LEVEL
+## Specifies that the default removal of the top level folder should not occur.
+##
+## ## Examples
+##
+## * [bzip2](https://github.com/Microsoft/vcpkg/blob/master/ports/bzip2/portfile.cmake)
+## * [sqlite3](https://github.com/Microsoft/vcpkg/blob/master/ports/sqlite3/portfile.cmake)
+## * [cairo](https://github.com/Microsoft/vcpkg/blob/master/ports/cairo/portfile.cmake)
+include(vcpkg_apply_patches)
+include(vcpkg_extract_source_archive)
+
+function(vcpkg_extract_source_archive_ex)
+ cmake_parse_arguments(_vesae "NO_REMOVE_ONE_LEVEL" "OUT_SOURCE_PATH;ARCHIVE;REF;WORKING_DIRECTORY" "PATCHES" ${ARGN})
+
+ if(NOT _vesae_ARCHIVE)
+ message(FATAL_ERROR "Must specify ARCHIVE parameter to vcpkg_extract_source_archive_ex()")
+ endif()
+
+ if(NOT DEFINED _vesae_OUT_SOURCE_PATH)
+ message(FATAL_ERROR "Must specify OUT_SOURCE_PATH parameter to vcpkg_extract_source_archive_ex()")
+ endif()
+
+ if(NOT DEFINED _vesae_WORKING_DIRECTORY)
+ set(_vesae_WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/src)
+ endif()
+
+ if(NOT DEFINED _vesae_REF)
+ get_filename_component(_vesae_REF ${_vesae_ARCHIVE} NAME_WE)
+ endif()
+
+ string(REPLACE "/" "-" SANITIZED_REF "${_vesae_REF}")
+
+ # Take the last 10 chars of the REF
+ set(REF_MAX_LENGTH 10)
+ string(LENGTH ${SANITIZED_REF} REF_LENGTH)
+ math(EXPR FROM_REF ${REF_LENGTH}-${REF_MAX_LENGTH})
+ if(FROM_REF LESS 0)
+ set(FROM_REF 0)
+ endif()
+ string(SUBSTRING ${SANITIZED_REF} ${FROM_REF} ${REF_LENGTH} SHORTENED_SANITIZED_REF)
+
+ # Hash the archive hash along with the patches. Take the first 10 chars of the hash
+ file(SHA512 ${_vesae_ARCHIVE} PATCHSET_HASH)
+ foreach(PATCH IN LISTS _vesae_PATCHES)
+ get_filename_component(ABSOLUTE_PATCH "${PATCH}" ABSOLUTE BASE_DIR "${CURRENT_PORT_DIR}")
+ file(SHA512 ${ABSOLUTE_PATCH} CURRENT_HASH)
+ string(APPEND PATCHSET_HASH ${CURRENT_HASH})
+ endforeach()
+
+ string(SHA512 PATCHSET_HASH ${PATCHSET_HASH})
+ string(SUBSTRING ${PATCHSET_HASH} 0 10 PATCHSET_HASH)
+ set(SOURCE_PATH "${_vesae_WORKING_DIRECTORY}/${SHORTENED_SANITIZED_REF}-${PATCHSET_HASH}")
+
+ if(NOT EXISTS ${SOURCE_PATH})
+ set(TEMP_DIR "${_vesae_WORKING_DIRECTORY}/TEMP")
+ file(REMOVE_RECURSE ${TEMP_DIR})
+ vcpkg_extract_source_archive("${_vesae_ARCHIVE}" "${TEMP_DIR}")
+
+ if(_vesae_NO_REMOVE_ONE_LEVEL)
+ set(TEMP_SOURCE_PATH ${TEMP_DIR})
+ else()
+ file(GLOB _ARCHIVE_FILES "${TEMP_DIR}/*")
+ list(LENGTH _ARCHIVE_FILES _NUM_ARCHIVE_FILES)
+ set(TEMP_SOURCE_PATH)
+ foreach(dir IN LISTS _ARCHIVE_FILES)
+ if (IS_DIRECTORY ${dir})
+ set(TEMP_SOURCE_PATH "${dir}")
+ break()
+ endif()
+ endforeach()
+
+ if(NOT _NUM_ARCHIVE_FILES EQUAL 2 OR NOT TEMP_SOURCE_PATH)
+ message(FATAL_ERROR "Could not unwrap top level directory from archive. Pass NO_REMOVE_ONE_LEVEL to disable this.")
+ endif()
+ endif()
+
+ vcpkg_apply_patches(
+ SOURCE_PATH ${TEMP_SOURCE_PATH}
+ PATCHES ${_vesae_PATCHES}
+ )
+
+ file(RENAME ${TEMP_SOURCE_PATH} ${SOURCE_PATH})
+ file(REMOVE_RECURSE ${TEMP_DIR})
+ endif()
+
+ set(${_vesae_OUT_SOURCE_PATH} "${SOURCE_PATH}" PARENT_SCOPE)
+ message(STATUS "Using source at ${SOURCE_PATH}")
+ return()
+endfunction()
diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake
index 39a722d93..ebe46b335 100644
--- a/scripts/cmake/vcpkg_find_acquire_program.cmake
+++ b/scripts/cmake/vcpkg_find_acquire_program.cmake
@@ -77,12 +77,18 @@ function(vcpkg_find_acquire_program VAR)
set(NOEXTRACT ON)
set(HASH c1945669d983b632a10c5ff31e86d6ecbff143c3d8b2c433c0d3d18f84356d2b351f71ac05fd44e5403651b00c31db0d14615d7f9a6ecce5750438d37105c55b)
elseif(VAR MATCHES "PYTHON3")
- set(PROGNAME python)
- set(SUBDIR "python3")
- set(PATHS ${DOWNLOADS}/tools/python/${SUBDIR})
- set(URL "https://www.python.org/ftp/python/3.5.4/python-3.5.4-embed-win32.zip")
- set(ARCHIVE "python-3.5.4-embed-win32.zip")
- set(HASH b5240fdc95088c2d7f65d2dd598650f8dd106b49589d94156bd4a078b108c6cabbe7a38ef73e2b2cf00e8312a93d2e587eac2c54ce85540d3c7a26cc60013156)
+ if(CMAKE_HOST_WIN32)
+ set(PROGNAME python)
+ set(SUBDIR "python3")
+ set(PATHS ${DOWNLOADS}/tools/python/${SUBDIR})
+ set(URL "https://www.python.org/ftp/python/3.5.4/python-3.5.4-embed-win32.zip")
+ set(ARCHIVE "python-3.5.4-embed-win32.zip")
+ set(HASH b5240fdc95088c2d7f65d2dd598650f8dd106b49589d94156bd4a078b108c6cabbe7a38ef73e2b2cf00e8312a93d2e587eac2c54ce85540d3c7a26cc60013156)
+ else()
+ set(PROGNAME python3)
+ set(BREW_PACKAGE_NAME "python")
+ set(APT_PACKAGE_NAME "python3")
+ endif()
elseif(VAR MATCHES "PYTHON2")
set(PROGNAME python)
set(SUBDIR "python2")
@@ -128,23 +134,43 @@ function(vcpkg_find_acquire_program VAR)
elseif(VAR MATCHES "MESON")
set(PROGNAME meson)
set(REQUIRED_INTERPRETER PYTHON3)
- set(SCRIPTNAME meson.py)
- set(PATHS ${DOWNLOADS}/tools/meson/meson-0.43.0)
- set(URL "https://github.com/mesonbuild/meson/archive/0.43.0.zip")
- set(ARCHIVE "meson-0.43.0.zip")
- set(HASH dde4de72eff37046731224f32aa5f4618d45bdf148cec2d1af6e25e7522ebc2b04aedc9eceed483dfa93823a0ea7ea472d0c0c9380061bf3ee2f16b87dd1425e)
+ set(BREW_PACKAGE_NAME "meson")
+ set(APT_PACKAGE_NAME "meson")
+ if(CMAKE_HOST_WIN32)
+ set(SCRIPTNAME meson.py)
+ else()
+ set(SCRIPTNAME meson)
+ endif()
+ set(PATHS ${DOWNLOADS}/tools/meson/meson-0.47.1)
+ set(URL "https://github.com/mesonbuild/meson/archive/0.47.1.zip")
+ set(ARCHIVE "meson-0.47.1.zip")
+ set(HASH 0f6462835583a51707bee82d852018cfcb7444c0dad95b2ba08814e500a5cfe3f731dc6c1fb73c765d1120ee2a2d6600e15d8d393bab1993e84bd4354b2e6855)
elseif(VAR MATCHES "FLEX")
- set(PROGNAME win_flex)
- set(PATHS ${DOWNLOADS}/tools/win_flex)
- set(URL "https://sourceforge.net/projects/winflexbison/files/win_flex_bison-2.5.9.zip/download")
- set(ARCHIVE "win_flex_bison-2.5.9.zip")
- set(HASH 9580f0e46893670a011645947c1becda69909a41a38bb4197fe33bd1ab7719da6b80e1be316f269e1a4759286870d49a9b07ef83afc4bac33232bd348e0bc814)
+ if(CMAKE_HOST_WIN32)
+ set(PROGNAME win_flex)
+ set(SUBDIR win_flex-2.5.16)
+ set(PATHS ${DOWNLOADS}/tools/win_flex/${SUBDIR})
+ set(URL "https://sourceforge.net/projects/winflexbison/files/winflexbison-2.5.16.zip/download")
+ set(ARCHIVE "win_flex_bison-2.5.16.zip")
+ set(HASH 0a14154bff5d998feb23903c46961528f8ccb4464375d5384db8c4a7d230c0c599da9b68e7a32f3217a0a0735742242eaf3769cb4f03e00931af8640250e9123)
+ else()
+ set(PROGNAME flex)
+ set(APT_PACKAGE_NAME flex)
+ set(BREW_PACKAGE_NAME flex)
+ endif()
elseif(VAR MATCHES "BISON")
- set(PROGNAME win_bison)
- set(PATHS ${DOWNLOADS}/tools/win_bison)
- set(URL "https://sourceforge.net/projects/winflexbison/files/win_flex_bison-2.5.9.zip/download")
- set(ARCHIVE "win_flex_bison-2.5.9.zip")
- set(HASH 9580f0e46893670a011645947c1becda69909a41a38bb4197fe33bd1ab7719da6b80e1be316f269e1a4759286870d49a9b07ef83afc4bac33232bd348e0bc814)
+ if(CMAKE_HOST_WIN32)
+ set(PROGNAME win_bison)
+ set(SUBDIR win_bison-2.5.16)
+ set(PATHS ${DOWNLOADS}/tools/win_bison/${SUBDIR})
+ set(URL "https://sourceforge.net/projects/winflexbison/files/winflexbison-2.5.16.zip/download")
+ set(ARCHIVE "win_flex_bison-2.5.16.zip")
+ set(HASH 0a14154bff5d998feb23903c46961528f8ccb4464375d5384db8c4a7d230c0c599da9b68e7a32f3217a0a0735742242eaf3769cb4f03e00931af8640250e9123)
+ else()
+ set(PROGNAME bison)
+ set(APT_PACKAGE_NAME bison)
+ set(BREW_PACKAGE_NAME bison)
+ endif()
elseif(VAR MATCHES "GPERF")
set(PROGNAME gperf)
set(PATHS ${DOWNLOADS}/tools/gperf/bin)
diff --git a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake
index 47c91f83c..ea9923df3 100644
--- a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake
+++ b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake
@@ -117,7 +117,7 @@ function(vcpkg_fixup_cmake_targets)
file(READ ${DEBUG_TARGET} _contents)
string(REPLACE "${CURRENT_INSTALLED_DIR}" "\${_IMPORT_PREFIX}" _contents "${_contents}")
- string(REGEX REPLACE "\\\${_IMPORT_PREFIX}/bin/([^ \"]+\\.exe)" "\${_IMPORT_PREFIX}/tools/${PORT}/\\1" _contents "${_contents}")
+ string(REGEX REPLACE "\\\${_IMPORT_PREFIX}/bin/([^ \";]+\\.exe)" "\${_IMPORT_PREFIX}/tools/${PORT}/\\1" _contents "${_contents}")
string(REPLACE "\${_IMPORT_PREFIX}/lib" "\${_IMPORT_PREFIX}/debug/lib" _contents "${_contents}")
string(REPLACE "\${_IMPORT_PREFIX}/bin" "\${_IMPORT_PREFIX}/debug/bin" _contents "${_contents}")
file(WRITE ${RELEASE_SHARE}/${DEBUG_TARGET_REL} "${_contents}")
@@ -134,9 +134,9 @@ function(vcpkg_fixup_cmake_targets)
"get_filename_component(_IMPORT_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)\nget_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)\nget_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)"
_contents "${_contents}")
string(REPLACE "${CURRENT_INSTALLED_DIR}" "_INVALID_ROOT_" _contents "${_contents}")
- string(REGEX REPLACE ";_INVALID_ROOT_/[^\";]*" "" _contents "${_contents}")
- string(REGEX REPLACE "_INVALID_ROOT_/[^\";]*;" "" _contents "${_contents}")
- string(REGEX REPLACE "\"_INVALID_ROOT_/[^\";]*\"" "\"\"" _contents "${_contents}")
+ string(REGEX REPLACE "_INVALID_ROOT_/[^\";>]*" "" _contents "${_contents}")
+ string(REGEX REPLACE ";;+" ";" _contents "${_contents}")
+ string(REGEX REPLACE "\";\"" "\"\"" _contents "${_contents}")
file(WRITE ${MAIN_TARGET} "${_contents}")
endforeach()
diff --git a/scripts/cmake/vcpkg_from_bitbucket.cmake b/scripts/cmake/vcpkg_from_bitbucket.cmake
index a12d86b43..5f23714ea 100644
--- a/scripts/cmake/vcpkg_from_bitbucket.cmake
+++ b/scripts/cmake/vcpkg_from_bitbucket.cmake
@@ -11,6 +11,7 @@
## [REF <v2.0.0>]
## [SHA512 <45d0d7f8cc350...>]
## [HEAD_REF <master>]
+## [PATCHES <patch1.patch> <patch2.patch>...]
## )
## ```
##
@@ -40,6 +41,11 @@
##
## For most projects, this should be `master`. The chosen branch should be one that is expected to be always buildable on all supported platforms.
##
+## ### PATCHES
+## A list of patches to be applied to the extracted sources.
+##
+## Relative paths are based on the port directory.
+##
## ## Notes:
## At least one of `REF` and `HEAD_REF` must be specified, however it is preferable for both to be present.
##
@@ -50,7 +56,7 @@
## * [blaze](https://github.com/Microsoft/vcpkg/blob/master/ports/blaze/portfile.cmake)
function(vcpkg_from_bitbucket)
set(oneValueArgs OUT_SOURCE_PATH REPO REF SHA512 HEAD_REF)
- set(multipleValuesArgs)
+ set(multipleValuesArgs PATCHES)
cmake_parse_arguments(_vdud "" "${oneValueArgs}" "${multipleValuesArgs}" ${ARGN})
if(NOT _vdud_OUT_SOURCE_PATH)
@@ -115,7 +121,7 @@ function(vcpkg_from_bitbucket)
string(REGEX REPLACE "\"hash\": \"([a-f0-9]+)\"" "\\1" _version ${x})
string(SUBSTRING ${_version} 0 12 _version) # Get the 12 first numbers from commit hash
else()
- set(_version ${_vdud_REF})
+ string(SUBSTRING ${_vdud_REF} 0 12 _version) # Get the 12 first numbers from commit hash
endif()
vcpkg_download_distfile(ARCHIVE
@@ -123,8 +129,14 @@ function(vcpkg_from_bitbucket)
SHA512 "${_vdud_SHA512}"
FILENAME "${ORG_NAME}-${REPO_NAME}-${_vdud_REF}.tar.gz"
)
- vcpkg_extract_source_archive_ex(ARCHIVE "${ARCHIVE}")
- set_SOURCE_PATH(${CURRENT_BUILDTREES_DIR}/src ${_version})
+
+ vcpkg_extract_source_archive_ex(
+ OUT_SOURCE_PATH SOURCE_PATH
+ ARCHIVE "${ARCHIVE}"
+ REF "${_vdud_REF}"
+ PATCHES ${_vdud_PATCHES}
+ )
+ set(${_vdud_OUT_SOURCE_PATH} "${SOURCE_PATH}" PARENT_SCOPE)
return()
endif()
@@ -164,11 +176,6 @@ function(vcpkg_from_bitbucket)
)
endif()
- vcpkg_extract_source_archive_ex(
- ARCHIVE "${ARCHIVE}"
- WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/src/head"
- )
-
# Parse the github refs response with regex.
# TODO: use some JSON swiss-army-knife utility instead.
file(READ "${ARCHIVE_VERSION}" _contents)
@@ -179,5 +186,12 @@ function(vcpkg_from_bitbucket)
# exports VCPKG_HEAD_VERSION to the caller. This will get picked up by ports.cmake after the build.
set(VCPKG_HEAD_VERSION ${_version} PARENT_SCOPE)
- set_SOURCE_PATH(${CURRENT_BUILDTREES_DIR}/src/head ${_vdud_HEAD_REF})
+ vcpkg_extract_source_archive_ex(
+ OUT_SOURCE_PATH SOURCE_PATH
+ ARCHIVE "${downloaded_file_path}"
+ REF "${_vdud_HEAD_REF}"
+ WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/src/head"
+ PATCHES ${_vdud_PATCHES}
+ )
+ set(${_vdud_OUT_SOURCE_PATH} "${SOURCE_PATH}" PARENT_SCOPE)
endfunction()
diff --git a/scripts/cmake/vcpkg_from_git.cmake b/scripts/cmake/vcpkg_from_git.cmake
new file mode 100644
index 000000000..2fc66b279
--- /dev/null
+++ b/scripts/cmake/vcpkg_from_git.cmake
@@ -0,0 +1,127 @@
+## # vcpkg_from_git
+##
+## Download and extract a project from git
+##
+## ## Usage:
+## ```cmake
+## vcpkg_from_git(
+## OUT_SOURCE_PATH <SOURCE_PATH>
+## URL <https://android.googlesource.com/platform/external/fdlibm>
+## REF <59f7335e4d...>
+## SHA512 <abcdef123...>
+## [PATCHES <patch1.patch> <patch2.patch>...]
+## )
+## ```
+##
+## ## Parameters:
+## ### OUT_SOURCE_PATH
+## Specifies the out-variable that will contain the extracted location.
+##
+## This should be set to `SOURCE_PATH` by convention.
+##
+## ### URL
+## The url of the git repository.
+##
+## ### SHA512
+## The SHA512 hash that should match the archive form of the commit.
+##
+## This is most easily determined by first setting it to `0`, then trying to build the port. The error message will contain the full hash, which can be copied back into the portfile.
+##
+## ### REF
+## A stable git commit-ish (ideally a tag or commit) that will not change contents. **This should not be a branch.**
+##
+## For repositories without official releases, this can be set to the full commit id of the current latest master.
+##
+## ### PATCHES
+## A list of patches to be applied to the extracted sources.
+##
+## Relative paths are based on the port directory.
+##
+## ## Notes:
+## `OUT_SOURCE_PATH`, `REF`, `SHA512`, and `URL` must be specified.
+##
+## ## Examples:
+##
+## * [fdlibm](https://github.com/Microsoft/vcpkg/blob/master/ports/fdlibm/portfile.cmake)
+
+function(vcpkg_from_git)
+ set(oneValueArgs OUT_SOURCE_PATH URL REF SHA512)
+ set(multipleValuesArgs PATCHES)
+ cmake_parse_arguments(_vdud "" "${oneValueArgs}" "${multipleValuesArgs}" ${ARGN})
+
+ if(NOT DEFINED _vdud_OUT_SOURCE_PATH)
+ message(FATAL_ERROR "OUT_SOURCE_PATH must be specified.")
+ endif()
+
+ if(NOT DEFINED _vdud_URL)
+ message(FATAL_ERROR "The git url must be specified")
+ endif()
+
+ if(NOT DEFINED _vdud_REF)
+ message(FATAL_ERROR "The git ref must be specified.")
+ endif()
+
+ if(NOT DEFINED _vdud_SHA512)
+ message(FATAL_ERROR "vcpkg_from_git requires a SHA512 argument. If you do not know the SHA512, add it as 'SHA512 0' and re-run this command.")
+ endif()
+
+ # using .tar.gz instead of .zip because the hash of the latter is affected by timezone.
+ string(REPLACE "/" "-" SANITIZED_REF "${_vdud_REF}")
+ set(TEMP_ARCHIVE "${DOWNLOADS}/temp/${PORT}-${SANITIZED_REF}.tar.gz")
+ set(ARCHIVE "${DOWNLOADS}/${PORT}-${SANITIZED_REF}.tar.gz")
+ set(TEMP_SOURCE_PATH "${CURRENT_BUILDTREES_DIR}/src/${SANITIZED_REF}")
+
+ function(test_hash FILE_PATH FILE_KIND CUSTOM_ERROR_ADVICE)
+ file(SHA512 ${FILE_PATH} FILE_HASH)
+ if(NOT FILE_HASH STREQUAL _vdud_SHA512)
+ message(FATAL_ERROR
+ "\nFile does not have expected hash:\n"
+ " File path: [ ${FILE_PATH} ]\n"
+ " Expected hash: [ ${_vdud_SHA512} ]\n"
+ " Actual hash: [ ${FILE_HASH} ]\n"
+ "${CUSTOM_ERROR_ADVICE}\n")
+ endif()
+ endfunction()
+
+ if(NOT EXISTS "${ARCHIVE}")
+ if(_VCPKG_NO_DOWNLOADS)
+ message(FATAL_ERROR "Downloads are disabled, but '${ARCHIVE}' does not exist.")
+ endif()
+ message(STATUS "Fetching ${_vdud_URL}...")
+ find_program(GIT NAMES git git.cmd)
+ # Note: git init is safe to run multiple times
+ vcpkg_execute_required_process(
+ COMMAND ${GIT} init git-tmp
+ WORKING_DIRECTORY ${DOWNLOADS}
+ LOGNAME git-init
+ )
+ vcpkg_execute_required_process(
+ COMMAND ${GIT} fetch ${_vdud_URL} ${_vdud_REF} --depth 1 -n
+ WORKING_DIRECTORY ${DOWNLOADS}/git-tmp
+ LOGNAME git-fetch
+ )
+ file(MAKE_DIRECTORY "${DOWNLOADS}/temp")
+ vcpkg_execute_required_process(
+ COMMAND ${GIT} archive FETCH_HEAD -o "${TEMP_ARCHIVE}"
+ WORKING_DIRECTORY ${DOWNLOADS}/git-tmp
+ LOGNAME git-archive
+ )
+ test_hash("${TEMP_ARCHIVE}" "downloaded repo" "")
+ get_filename_component(downloaded_file_dir "${ARCHIVE}" DIRECTORY)
+ file(MAKE_DIRECTORY "${downloaded_file_dir}")
+ file(RENAME "${TEMP_ARCHIVE}" "${ARCHIVE}")
+ else()
+ message(STATUS "Using cached ${ARCHIVE}")
+ test_hash("${ARCHIVE}" "cached file" "Please delete the file and retry if this file should be downloaded again.")
+ endif()
+
+ vcpkg_extract_source_archive_ex(
+ OUT_SOURCE_PATH SOURCE_PATH
+ ARCHIVE "${ARCHIVE}"
+ REF "${SANITIZED_REF}"
+ PATCHES ${_vdud_PATCHES}
+ NO_REMOVE_ONE_LEVEL
+ )
+
+ set(${_vdud_OUT_SOURCE_PATH} "${SOURCE_PATH}" PARENT_SCOPE)
+endfunction()
diff --git a/scripts/cmake/vcpkg_from_github.cmake b/scripts/cmake/vcpkg_from_github.cmake
index 28ada0631..48bfd828a 100644
--- a/scripts/cmake/vcpkg_from_github.cmake
+++ b/scripts/cmake/vcpkg_from_github.cmake
@@ -10,6 +10,7 @@
## [REF <v2.0.0>]
## [SHA512 <45d0d7f8cc350...>]
## [HEAD_REF <master>]
+## [PATCHES <patch1.patch> <patch2.patch>...]
## )
## ```
##
@@ -23,7 +24,7 @@
## The organization or user and repository on GitHub.
##
## ### REF
-## A stable git commit-ish (ideally a tag) that will not change contents. **This should not be a branch.**
+## A stable git commit-ish (ideally a tag or commit) that will not change contents. **This should not be a branch.**
##
## For repositories without official releases, this can be set to the full commit id of the current latest master.
##
@@ -39,6 +40,11 @@
##
## For most projects, this should be `master`. The chosen branch should be one that is expected to be always buildable on all supported platforms.
##
+## ### PATCHES
+## A list of patches to be applied to the extracted sources.
+##
+## Relative paths are based on the port directory.
+##
## ## Notes:
## At least one of `REF` and `HEAD_REF` must be specified, however it is preferable for both to be present.
##
@@ -74,16 +80,16 @@ function(vcpkg_from_github)
string(REGEX REPLACE "/.*" "" ORG_NAME ${_vdud_REPO})
macro(set_TEMP_SOURCE_PATH BASE BASEREF)
- set(TEMP_SOURCE_PATH "${BASE}/${REPO_NAME}-${BASEREF}")
- if(NOT EXISTS ${TEMP_SOURCE_PATH})
- # Sometimes GitHub strips a leading 'v' off the REF.
- string(REGEX REPLACE "^v" "" REF ${BASEREF})
- string(REPLACE "/" "-" REF ${REF})
- set(TEMP_SOURCE_PATH "${BASE}/${REPO_NAME}-${REF}")
+ set(TEMP_SOURCE_PATH "${BASE}/${REPO_NAME}-${BASEREF}")
if(NOT EXISTS ${TEMP_SOURCE_PATH})
- message(FATAL_ERROR "Could not determine source path: '${BASE}/${REPO_NAME}-${BASEREF}' does not exist")
+ # Sometimes GitHub strips a leading 'v' off the REF.
+ string(REGEX REPLACE "^v" "" REF ${BASEREF})
+ string(REPLACE "/" "-" REF ${REF})
+ set(TEMP_SOURCE_PATH "${BASE}/${REPO_NAME}-${REF}")
+ if(NOT EXISTS ${TEMP_SOURCE_PATH})
+ message(FATAL_ERROR "Could not determine source path: '${BASE}/${REPO_NAME}-${BASEREF}' does not exist")
+ endif()
endif()
- endif()
endmacro()
if(VCPKG_USE_HEAD_VERSION AND NOT DEFINED _vdud_HEAD_REF)
@@ -105,43 +111,14 @@ function(vcpkg_from_github)
FILENAME "${ORG_NAME}-${REPO_NAME}-${SANITIZED_REF}.tar.gz"
)
- # Take the last 10 chars of the REF
- set(REF_MAX_LENGTH 10)
- string(LENGTH ${SANITIZED_REF} REF_LENGTH)
- math(EXPR FROM_REF ${REF_LENGTH}-${REF_MAX_LENGTH})
- if(FROM_REF LESS 0)
- set(FROM_REF 0)
- endif()
- string(SUBSTRING ${SANITIZED_REF} ${FROM_REF} ${REF_LENGTH} SHORTENED_SANITIZED_REF)
-
- # Hash the archive hash along with the patches. Take the first 10 chars of the hash
- set(PATCHSET_HASH "${_vdud_SHA512}")
- foreach(PATCH IN LISTS _vdud_PATCHES)
- file(SHA512 ${PATCH} CURRENT_HASH)
- string(APPEND PATCHSET_HASH ${CURRENT_HASH})
- endforeach()
-
- string(SHA512 PATCHSET_HASH ${PATCHSET_HASH})
- string(SUBSTRING ${PATCHSET_HASH} 0 10 PATCHSET_HASH)
- set(SOURCE_PATH "${CURRENT_BUILDTREES_DIR}/src/${SHORTENED_SANITIZED_REF}-${PATCHSET_HASH}")
-
- if(NOT EXISTS ${SOURCE_PATH})
- set(TEMP_DIR "${CURRENT_BUILDTREES_DIR}/src/TEMP")
- file(REMOVE_RECURSE ${TEMP_DIR})
- vcpkg_extract_source_archive_ex(ARCHIVE "${ARCHIVE}" WORKING_DIRECTORY ${TEMP_DIR})
- set_TEMP_SOURCE_PATH(${CURRENT_BUILDTREES_DIR}/src/TEMP ${SANITIZED_REF})
-
- vcpkg_apply_patches(
- SOURCE_PATH ${TEMP_SOURCE_PATH}
- PATCHES ${_vdud_PATCHES}
- )
-
- file(RENAME ${TEMP_SOURCE_PATH} ${SOURCE_PATH})
- file(REMOVE_RECURSE ${TEMP_DIR})
- endif()
+ vcpkg_extract_source_archive_ex(
+ OUT_SOURCE_PATH SOURCE_PATH
+ ARCHIVE "${ARCHIVE}"
+ REF "${SANITIZED_REF}"
+ PATCHES ${_vdud_PATCHES}
+ )
set(${_vdud_OUT_SOURCE_PATH} "${SOURCE_PATH}" PARENT_SCOPE)
-
return()
endif()
@@ -182,11 +159,6 @@ function(vcpkg_from_github)
)
endif()
- vcpkg_extract_source_archive_ex(
- ARCHIVE "${ARCHIVE}"
- WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/src/head"
- )
-
# Parse the github refs response with regex.
# TODO: use some JSON swiss-army-knife utility instead.
file(READ "${ARCHIVE_VERSION}" _contents)
@@ -199,10 +171,12 @@ function(vcpkg_from_github)
set(VCPKG_HEAD_VERSION ${_version} PARENT_SCOPE)
endif()
- set_TEMP_SOURCE_PATH(${CURRENT_BUILDTREES_DIR}/src/head ${SANITIZED_HEAD_REF})
- vcpkg_apply_patches(
- SOURCE_PATH ${TEMP_SOURCE_PATH}
+ vcpkg_extract_source_archive_ex(
+ OUT_SOURCE_PATH SOURCE_PATH
+ ARCHIVE "${downloaded_file_path}"
+ REF "${SANITIZED_HEAD_REF}"
+ WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/src/head
PATCHES ${_vdud_PATCHES}
)
- set(${_vdud_OUT_SOURCE_PATH} "${TEMP_SOURCE_PATH}" PARENT_SCOPE)
+ set(${_vdud_OUT_SOURCE_PATH} "${SOURCE_PATH}" PARENT_SCOPE)
endfunction()
diff --git a/scripts/cmake/vcpkg_from_gitlab.cmake b/scripts/cmake/vcpkg_from_gitlab.cmake
new file mode 100644
index 000000000..f13bc054c
--- /dev/null
+++ b/scripts/cmake/vcpkg_from_gitlab.cmake
@@ -0,0 +1,169 @@
+## # vcpkg_from_gitlab
+##
+## Download and extract a project from Gitlab instances. Enables support for `install --head`.
+##
+## ## Usage:
+## ```cmake
+## vcpkg_from_gitlab(
+## GITLAB_URL <https://gitlab.com>
+## OUT_SOURCE_PATH <SOURCE_PATH>
+## REPO <gitlab-org/gitlab-ce>
+## [REF <v10.7.3>]
+## [SHA512 <45d0d7f8cc350...>]
+## [HEAD_REF <master>]
+## [PATCHES <patch1.patch> <patch2.patch>...]
+## )
+## ```
+##
+## ## Parameters:
+##
+## ### GITLAB_URL
+## The URL of the Gitlab instance to use.
+##
+## ### OUT_SOURCE_PATH
+## Specifies the out-variable that will contain the extracted location.
+##
+## This should be set to `SOURCE_PATH` by convention.
+##
+## ### REPO
+## The organization or user plus the repository name on the Gitlab instance.
+##
+## ### REF
+## A stable git commit-ish (ideally a tag) that will not change contents. **This should not be a branch.**
+##
+## For repositories without official releases, this can be set to the full commit id of the current latest master.
+##
+## If `REF` is specified, `SHA512` must also be specified.
+##
+## ### SHA512
+## The SHA512 hash that should match the archive (${GITLAB_URL}/${REPO}/-/archive/${REF}/${REPO_NAME}-${REF}.tar.gz).
+## The REPO_NAME variable is parsed from the value of REPO.
+##
+## This is most easily determined by first setting it to `1`, then trying to build the port. The error message will contain the full hash, which can be copied back into the portfile.
+##
+## ### HEAD_REF
+## The unstable git commit-ish (ideally a branch) to pull for `--head` builds.
+##
+## For most projects, this should be `master`. The chosen branch should be one that is expected to be always buildable on all supported platforms.
+##
+## ### PATCHES
+## A list of patches to be applied to the extracted sources.
+##
+## Relative paths are based on the port directory.
+##
+## ## Notes:
+## At least one of `REF` and `HEAD_REF` must be specified, however it is preferable for both to be present.
+##
+## This exports the `VCPKG_HEAD_VERSION` variable during head builds.
+##
+
+function(vcpkg_from_gitlab)
+ set(oneValueArgs OUT_SOURCE_PATH GITLAB_URL USER REPO REF SHA512 HEAD_REF)
+ set(multipleValuesArgs PATCHES)
+ cmake_parse_arguments(_vdud "" "${oneValueArgs}" "${multipleValuesArgs}" ${ARGN})
+
+ if(NOT DEFINED _vdud_GITLAB_URL)
+ message(FATAL_ERROR "GITLAB_URL must be specified.")
+ endif()
+
+ if(NOT DEFINED _vdud_OUT_SOURCE_PATH)
+ message(FATAL_ERROR "OUT_SOURCE_PATH must be specified.")
+ endif()
+
+ if((DEFINED _vdud_REF AND NOT DEFINED _vdud_SHA512) OR (NOT DEFINED _vdud_REF AND DEFINED _vdud_SHA512))
+ message(FATAL_ERROR "SHA512 must be specified if REF is specified.")
+ endif()
+
+ if(NOT DEFINED _vdud_REPO)
+ message(FATAL_ERROR "REPO must be specified.")
+ endif()
+
+ if(NOT DEFINED _vdud_REF AND NOT DEFINED _vdud_HEAD_REF)
+ message(FATAL_ERROR "At least one of REF and HEAD_REF must be specified.")
+ endif()
+
+ if(VCPKG_USE_HEAD_VERSION AND NOT DEFINED _vdud_HEAD_REF)
+ message(STATUS "Package does not specify HEAD_REF. Falling back to non-HEAD version.")
+ set(VCPKG_USE_HEAD_VERSION OFF)
+ endif()
+
+ string(REGEX REPLACE ".*/" "" REPO_NAME ${_vdud_REPO})
+ string(REGEX REPLACE "/.*" "" ORG_NAME ${_vdud_REPO})
+
+ # Handle --no-head scenarios
+ if(NOT VCPKG_USE_HEAD_VERSION)
+ if(NOT _vdud_REF)
+ message(FATAL_ERROR "Package does not specify REF. It must built using --head.")
+ endif()
+
+ string(REPLACE "/" "-" SANITIZED_REF "${_vdud_REF}")
+
+ vcpkg_download_distfile(ARCHIVE
+ URLS "${_vdud_GITLAB_URL}/${ORG_NAME}/${REPO_NAME}/-/archive/${_vdud_REF}/${REPO_NAME}-${_vdud_REF}.tar.gz"
+ SHA512 "${_vdud_SHA512}"
+ FILENAME "${ORG_NAME}-${REPO_NAME}-${SANITIZED_REF}.tar.gz"
+ )
+
+ vcpkg_extract_source_archive_ex(
+ OUT_SOURCE_PATH SOURCE_PATH
+ ARCHIVE "${ARCHIVE}"
+ REF "${SANITIZED_REF}"
+ PATCHES ${_vdud_PATCHES}
+ )
+
+ set(${_vdud_OUT_SOURCE_PATH} "${SOURCE_PATH}" PARENT_SCOPE)
+ return()
+ endif()
+
+ # The following is for --head scenarios
+ set(URL "${_vdud_GITLAB_URL}/${ORG_NAME}/${REPO_NAME}/-/archive/${_vdud_HEAD_REF}/${_vdud_HEAD_REF}.tar.gz")
+ string(REPLACE "/" "-" SANITIZED_HEAD_REF "${_vdud_HEAD_REF}")
+ set(downloaded_file_name "${ORG_NAME}-${REPO_NAME}-${SANITIZED_HEAD_REF}.tar.gz")
+ set(downloaded_file_path "${DOWNLOADS}/${downloaded_file_name}")
+
+ if(_VCPKG_NO_DOWNLOADS)
+ if(NOT EXISTS ${downloaded_file_path} OR NOT EXISTS ${downloaded_file_path}.version)
+ message(FATAL_ERROR "Downloads are disabled, but '${downloaded_file_path}' does not exist.")
+ endif()
+ message(STATUS "Using cached ${downloaded_file_path}")
+ else()
+ if(EXISTS ${downloaded_file_path})
+ message(STATUS "Purging cached ${downloaded_file_path} to fetch latest (use --no-downloads to suppress)")
+ file(REMOVE ${downloaded_file_path})
+ endif()
+ if(EXISTS ${downloaded_file_path}.version)
+ file(REMOVE ${downloaded_file_path}.version)
+ endif()
+ if(EXISTS ${CURRENT_BUILDTREES_DIR}/src/head)
+ file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/src/head)
+ endif()
+
+ vcpkg_download_distfile(ARCHIVE
+ URLS ${URL}
+ FILENAME ${downloaded_file_name}
+ SKIP_SHA512
+ )
+ endif()
+
+ # There are issues with the Gitlab API project paths being URL-escaped, so we use git here to get the head revision
+ execute_process(COMMAND ${GIT} ls-remote
+ "${_vdud_GITLAB_URL}/${ORG_NAME}/${REPO_NAME}.git" "${_vdud_HEAD_REF}"
+ RESULT_VARIABLE _git_result
+ OUTPUT_VARIABLE _git_output
+ )
+ string(REGEX MATCH "[a-f0-9]+" _version "${_git_output}")
+ # exports VCPKG_HEAD_VERSION to the caller. This will get picked up by ports.cmake after the build.
+ # When multiple vcpkg_from_gitlab's are used after each other, only use the version from the first (hopefully the primary one).
+ if(NOT DEFINED VCPKG_HEAD_VERSION)
+ set(VCPKG_HEAD_VERSION ${_version} PARENT_SCOPE)
+ endif()
+
+ vcpkg_extract_source_archive_ex(
+ OUT_SOURCE_PATH SOURCE_PATH
+ ARCHIVE "${downloaded_file_path}"
+ REF "${SANITIZED_HEAD_REF}"
+ WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/src/head
+ PATCHES ${_vdud_PATCHES}
+ )
+ set(${_vdud_OUT_SOURCE_PATH} "${SOURCE_PATH}" PARENT_SCOPE)
+endfunction()
diff --git a/scripts/cmake/vcpkg_get_windows_sdk.cmake b/scripts/cmake/vcpkg_get_windows_sdk.cmake
index a8aad64a9..e7d72a125 100644
--- a/scripts/cmake/vcpkg_get_windows_sdk.cmake
+++ b/scripts/cmake/vcpkg_get_windows_sdk.cmake
@@ -1,16 +1,6 @@
# Returns Windows SDK number via out variable "ret"
function(vcpkg_get_windows_sdk ret)
- execute_process(
- COMMAND powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& {& '${VCPKG_ROOT_DIR}/scripts/getWindowsSDK.ps1'}" 2>&1
- INPUT_FILE NUL
- OUTPUT_VARIABLE WINDOWS_SDK
- RESULT_VARIABLE error_code)
-
- if (error_code)
- message(FATAL_ERROR "Could not find Windows SDK")
- endif()
-
- # Remove trailing newline and non-numeric characters
- string(REGEX REPLACE "[^0-9.]" "" WINDOWS_SDK "${WINDOWS_SDK}")
+ set(WINDOWS_SDK $ENV{WindowsSDKVersion})
+ string(REPLACE "\\" "" WINDOWS_SDK "${WINDOWS_SDK}")
set(${ret} ${WINDOWS_SDK} PARENT_SCOPE)
endfunction() \ No newline at end of file
diff --git a/scripts/cmake/vcpkg_install_meson.cmake b/scripts/cmake/vcpkg_install_meson.cmake
index f6d49288c..7ab9d55b3 100644
--- a/scripts/cmake/vcpkg_install_meson.cmake
+++ b/scripts/cmake/vcpkg_install_meson.cmake
@@ -10,7 +10,6 @@ function(vcpkg_install_meson)
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
LOGNAME package-${TARGET_TRIPLET}-rel
)
- message(STATUS "Package ${TARGET_TRIPLET}-rel done")
message(STATUS "Package ${TARGET_TRIPLET}-dbg")
vcpkg_execute_required_process(
@@ -18,6 +17,5 @@ function(vcpkg_install_meson)
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
LOGNAME package-${TARGET_TRIPLET}-dbg
)
- message(STATUS "Package ${TARGET_TRIPLET}-dbg done")
endfunction()
diff --git a/scripts/cmake/vcpkg_install_msbuild.cmake b/scripts/cmake/vcpkg_install_msbuild.cmake
new file mode 100644
index 000000000..11bcdf189
--- /dev/null
+++ b/scripts/cmake/vcpkg_install_msbuild.cmake
@@ -0,0 +1,226 @@
+## # vcpkg_install_msbuild
+##
+## Build and install an msbuild-based project. This replaces `vcpkg_build_msbuild()`.
+##
+## ## Usage
+## ```cmake
+## vcpkg_install_msbuild(
+## SOURCE_PATH <${SOURCE_PATH}>
+## PROJECT_SUBPATH <port.sln>
+## [INCLUDES_SUBPATH <include>]
+## [LICENSE_SUBPATH <LICENSE>]
+## [RELEASE_CONFIGURATION <Release>]
+## [DEBUG_CONFIGURATION <Debug>]
+## [TARGET <Build>]
+## [TARGET_PLATFORM_VERSION <10.0.15063.0>]
+## [PLATFORM <${TRIPLET_SYSTEM_ARCH}>]
+## [PLATFORM_TOOLSET <${VCPKG_PLATFORM_TOOLSET}>]
+## [OPTIONS </p:ZLIB_INCLUDE_PATH=X>...]
+## [OPTIONS_RELEASE </p:ZLIB_LIB=X>...]
+## [OPTIONS_DEBUG </p:ZLIB_LIB=X>...]
+## [USE_VCPKG_INTEGRATION]
+## [ALLOW_ROOT_INCLUDES | REMOVE_ROOT_INCLUDES]
+## )
+## ```
+##
+## ## Parameters
+## ### SOURCE_PATH
+## The path to the root of the source tree.
+##
+## Because MSBuild uses in-source builds, the source tree will be copied into a temporary location for the build. This
+## parameter is the base for that copy and forms the base for all XYZ_SUBPATH options.
+##
+## ### USE_VCPKG_INTEGRATION
+## Apply the normal `integrate install` integration for building the project.
+##
+## By default, projects built with this command will not automatically link libraries or have header paths set.
+##
+## ### PROJECT_SUBPATH
+## The subpath to the solution (`.sln`) or project (`.vcxproj`) file relative to `SOURCE_PATH`.
+##
+## ### LICENSE_SUBPATH
+## The subpath to the license file relative to `SOURCE_PATH`.
+##
+## ### INCLUDES_SUBPATH
+## The subpath to the includes directory relative to `SOURCE_PATH`.
+##
+## This parameter should be a directory and should not end in a trailing slash.
+##
+## ### ALLOW_ROOT_INCLUDES
+## Indicates that top-level include files (e.g. `include/zlib.h`) should be allowed.
+##
+## ### REMOVE_ROOT_INCLUDES
+## Indicates that top-level include files (e.g. `include/Makefile.am`) should be removed.
+##
+## ### SKIP_CLEAN
+## Indicates that the intermediate files should not be removed.
+##
+## Ports using this option should later call [`vcpkg_clean_msbuild()`](vcpkg_clean_msbuild.md) to manually clean up.
+##
+## ### RELEASE_CONFIGURATION
+## The configuration (``/p:Configuration`` msbuild parameter) used for Release builds.
+##
+## ### DEBUG_CONFIGURATION
+## The configuration (``/p:Configuration`` msbuild parameter) used for Debug builds.
+##
+## ### TARGET_PLATFORM_VERSION
+## The WindowsTargetPlatformVersion (``/p:WindowsTargetPlatformVersion`` msbuild parameter)
+##
+## ### TARGET
+## The MSBuild target to build. (``/t:<TARGET>``)
+##
+## ### PLATFORM
+## The platform (``/p:Platform`` msbuild parameter) used for the build.
+##
+## ### PLATFORM_TOOLSET
+## The platform toolset (``/p:PlatformToolset`` msbuild parameter) used for the build.
+##
+## ### OPTIONS
+## Additional options passed to msbuild for all builds.
+##
+## ### OPTIONS_RELEASE
+## Additional options passed to msbuild for Release builds. These are in addition to `OPTIONS`.
+##
+## ### OPTIONS_DEBUG
+## Additional options passed to msbuild for Debug builds. These are in addition to `OPTIONS`.
+##
+## ## Examples
+##
+## * [xalan-c](https://github.com/Microsoft/vcpkg/blob/master/ports/xalan-c/portfile.cmake)
+## * [libimobiledevice](https://github.com/Microsoft/vcpkg/blob/master/ports/libimobiledevice/portfile.cmake)
+
+include(vcpkg_clean_msbuild)
+
+function(vcpkg_install_msbuild)
+ cmake_parse_arguments(
+ _csc
+ "USE_VCPKG_INTEGRATION;ALLOW_ROOT_INCLUDES;REMOVE_ROOT_INCLUDES;SKIP_CLEAN"
+ "SOURCE_PATH;PROJECT_SUBPATH;INCLUDES_SUBPATH;LICENSE_SUBPATH;RELEASE_CONFIGURATION;DEBUG_CONFIGURATION;PLATFORM;PLATFORM_TOOLSET;TARGET_PLATFORM_VERSION;TARGET"
+ "OPTIONS;OPTIONS_RELEASE;OPTIONS_DEBUG"
+ ${ARGN}
+ )
+
+ if(NOT DEFINED _csc_RELEASE_CONFIGURATION)
+ set(_csc_RELEASE_CONFIGURATION Release)
+ endif()
+ if(NOT DEFINED _csc_DEBUG_CONFIGURATION)
+ set(_csc_DEBUG_CONFIGURATION Debug)
+ endif()
+ if(NOT DEFINED _csc_PLATFORM)
+ if(VCPKG_TARGET_ARCHITECTURE STREQUAL x64)
+ set(_csc_PLATFORM x64)
+ elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL x86)
+ set(_csc_PLATFORM Win32)
+ elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL ARM)
+ set(_csc_PLATFORM ARM)
+ else()
+ message(FATAL_ERROR "Unsupported target architecture")
+ endif()
+ endif()
+ if(NOT DEFINED _csc_PLATFORM_TOOLSET)
+ set(_csc_PLATFORM_TOOLSET ${VCPKG_PLATFORM_TOOLSET})
+ endif()
+ if(NOT DEFINED _csc_TARGET_PLATFORM_VERSION)
+ vcpkg_get_windows_sdk(_csc_TARGET_PLATFORM_VERSION)
+ endif()
+ if(NOT DEFINED _csc_TARGET)
+ set(_csc_TARGET Rebuild)
+ endif()
+
+ list(APPEND _csc_OPTIONS
+ /t:${_csc_TARGET}
+ /p:Platform=${_csc_PLATFORM}
+ /p:PlatformToolset=${_csc_PLATFORM_TOOLSET}
+ /p:VCPkgLocalAppDataDisabled=true
+ /p:UseIntelMKL=No
+ /p:WindowsTargetPlatformVersion=${_csc_TARGET_PLATFORM_VERSION}
+ /m
+ )
+
+ if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ # Disable LTCG for static libraries because this setting introduces ABI incompatibility between minor compiler versions
+ # TODO: Add a way for the user to override this if they want to opt-in to incompatibility
+ list(APPEND _csc_OPTIONS /p:WholeProgramOptimization=false)
+ endif()
+
+ if(_csc_USE_VCPKG_INTEGRATION)
+ list(APPEND _csc_OPTIONS /p:ForceImportBeforeCppTargets=${VCPKG_ROOT_DIR}/scripts/buildsystems/msbuild/vcpkg.targets /p:VcpkgApplocalDeps=false)
+ endif()
+
+ get_filename_component(SOURCE_PATH_SUFFIX "${_csc_SOURCE_PATH}" NAME)
+ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
+ message(STATUS "Building ${_csc_PROJECT_SUBPATH} for Release")
+ file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
+ file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
+ file(COPY ${_csc_SOURCE_PATH} DESTINATION ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
+ set(SOURCE_COPY_PATH ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/${SOURCE_PATH_SUFFIX})
+ vcpkg_execute_required_process(
+ COMMAND msbuild ${SOURCE_COPY_PATH}/${_csc_PROJECT_SUBPATH}
+ /p:Configuration=${_csc_RELEASE_CONFIGURATION}
+ ${_csc_OPTIONS}
+ ${_csc_OPTIONS_RELEASE}
+ WORKING_DIRECTORY ${SOURCE_COPY_PATH}
+ LOGNAME build-${TARGET_TRIPLET}-rel
+ )
+ file(GLOB_RECURSE LIBS ${SOURCE_COPY_PATH}/*.lib)
+ file(GLOB_RECURSE DLLS ${SOURCE_COPY_PATH}/*.dll)
+ file(GLOB_RECURSE EXES ${SOURCE_COPY_PATH}/*.exe)
+ if(LIBS)
+ file(COPY ${LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
+ endif()
+ if(DLLS)
+ file(COPY ${DLLS} DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
+ endif()
+ if(EXES)
+ file(COPY ${EXES} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT})
+ vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT})
+ endif()
+ endif()
+
+ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
+ message(STATUS "Building ${_csc_PROJECT_SUBPATH} for Debug")
+ file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
+ file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
+ file(COPY ${_csc_SOURCE_PATH} DESTINATION ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
+ set(SOURCE_COPY_PATH ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/${SOURCE_PATH_SUFFIX})
+ vcpkg_execute_required_process(
+ COMMAND msbuild ${SOURCE_COPY_PATH}/${_csc_PROJECT_SUBPATH}
+ /p:Configuration=${_csc_DEBUG_CONFIGURATION}
+ ${_csc_OPTIONS}
+ ${_csc_OPTIONS_DEBUG}
+ WORKING_DIRECTORY ${SOURCE_COPY_PATH}
+ LOGNAME build-${TARGET_TRIPLET}-dbg
+ )
+ file(GLOB_RECURSE LIBS ${SOURCE_COPY_PATH}/*.lib)
+ file(GLOB_RECURSE DLLS ${SOURCE_COPY_PATH}/*.dll)
+ if(LIBS)
+ file(COPY ${LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
+ endif()
+ if(DLLS)
+ file(COPY ${DLLS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
+ endif()
+ endif()
+
+ vcpkg_copy_pdbs()
+
+ if(NOT _csc_SKIP_CLEAN)
+ vcpkg_clean_msbuild()
+ endif()
+
+ if(DEFINED _csc_INCLUDES_SUBPATH)
+ file(COPY ${_csc_SOURCE_PATH}/${_csc_INCLUDES_SUBPATH}/ DESTINATION ${CURRENT_PACKAGES_DIR}/include/)
+ file(GLOB ROOT_INCLUDES LIST_DIRECTORIES false ${CURRENT_PACKAGES_DIR}/include/*)
+ if(ROOT_INCLUDES)
+ if(_csc_REMOVE_ROOT_INCLUDES)
+ file(REMOVE ${ROOT_INCLUDES})
+ elseif(_csc_ALLOW_ROOT_INCLUDES)
+ else()
+ message(FATAL_ERROR "Top-level files were found in ${CURRENT_PACKAGES_DIR}/include; this may indicate a problem with the call to `vcpkg_install_msbuild()`.\nTo avoid conflicts with other libraries, it is recommended to not put includes into the root `include/` directory.\nPass either ALLOW_ROOT_INCLUDES or REMOVE_ROOT_INCLUDES to handle these files.\n")
+ endif()
+ endif()
+ endif()
+
+ if(DEFINED _csc_LICENSE_SUBPATH)
+ file(INSTALL ${_csc_SOURCE_PATH}/${_csc_LICENSE_SUBPATH} DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
+ endif()
+endfunction()
diff --git a/scripts/cmake/vcpkg_test_cmake.cmake b/scripts/cmake/vcpkg_test_cmake.cmake
new file mode 100644
index 000000000..718b2f69c
--- /dev/null
+++ b/scripts/cmake/vcpkg_test_cmake.cmake
@@ -0,0 +1,53 @@
+## # vcpkg_test_cmake
+##
+## Tests a built package for CMake `find_package()` integration.
+##
+## ## Usage:
+## ```cmake
+## vcpkg_test_cmake(PACKAGE_NAME <name> [MODULE])
+## ```
+##
+## ## Parameters:
+##
+## ### PACKAGE_NAME
+## The expected name to find with `find_package()`.
+##
+## ### MODULE
+## Indicates that the library expects to be found via built-in CMake targets.
+##
+function(vcpkg_test_cmake)
+ cmake_parse_arguments(_tc "MODULE" "PACKAGE_NAME" "" ${ARGN})
+
+ if(NOT DEFINED _tc_PACKAGE_NAME)
+ message(FATAL_ERROR "PACKAGE_NAME must be specified")
+ endif()
+ if(_tc_MODULE)
+ set(PACKAGE_TYPE MODULE)
+ else()
+ set(PACKAGE_TYPE CONFIG)
+ endif()
+
+ message(STATUS "Performing CMake integration test")
+ file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-test)
+ file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-test)
+
+ # Generate test source CMakeLists.txt
+ set(VCPKG_TEST_CMAKELIST ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-test/CMakeLists.txt)
+ file(WRITE ${VCPKG_TEST_CMAKELIST} "cmake_minimum_required(VERSION 3.10)\n")
+ file(APPEND ${VCPKG_TEST_CMAKELIST} "set(CMAKE_PREFIX_PATH \"${CURRENT_PACKAGES_DIR};${CURRENT_INSTALLED_DIR}\")\n")
+ file(APPEND ${VCPKG_TEST_CMAKELIST} "\n")
+ file(APPEND ${VCPKG_TEST_CMAKELIST} "find_package(${_tc_PACKAGE_NAME} ${PACKAGE_TYPE} REQUIRED)\n")
+
+ # Run cmake config with a generated CMakeLists.txt
+ set(LOGPREFIX "${CURRENT_BUILDTREES_DIR}/test-cmake-${TARGET_TRIPLET}")
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} .
+ OUTPUT_FILE "${LOGPREFIX}-out.log"
+ ERROR_FILE "${LOGPREFIX}-err.log"
+ RESULT_VARIABLE error_code
+ WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-test
+ )
+ if(error_code)
+ message(FATAL_ERROR "CMake integration test failed; unable to find_package(${_tc_PACKAGE_NAME} ${PACKAGE_TYPE} REQUIRED)")
+ endif()
+endfunction()
diff --git a/scripts/fetchTool.ps1 b/scripts/fetchTool.ps1
deleted file mode 100644
index dd3f0f9f4..000000000
--- a/scripts/fetchTool.ps1
+++ /dev/null
@@ -1,107 +0,0 @@
-[CmdletBinding()]
-param(
- [Parameter(Mandatory=$true)][string]$tool
-)
-
-Set-StrictMode -Version Latest
-$scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition
-. "$scriptsDir\VcpkgPowershellUtils.ps1"
-
-Write-Verbose "Fetching tool: $tool"
-$vcpkgRootDir = vcpkgFindFileRecursivelyUp $scriptsDir .vcpkg-root
-
-$downloadsDir = "$vcpkgRootDir\downloads"
-vcpkgCreateDirectoryIfNotExists $downloadsDir
-
-function fetchToolInternal([Parameter(Mandatory=$true)][string]$tool)
-{
- $tool = $tool.toLower()
-
- [xml]$asXml = Get-Content "$scriptsDir\vcpkgTools.xml"
- $toolData = $asXml.SelectSingleNode("//tools/tool[@name=`"$tool`"]") # Case-sensitive!
-
- if ($toolData -eq $null)
- {
- throw "Unknown tool $tool"
- }
-
- $toolPath="$downloadsDir\tools\$tool-$($toolData.version)-windows"
- $exePath = "$toolPath\$($toolData.exeRelativePath)"
-
- if (Test-Path $exePath)
- {
- return $exePath
- }
-
- $isArchive = vcpkgHasProperty -object $toolData -propertyName "archiveName"
- if ($isArchive)
- {
- $downloadPath = "$downloadsDir\$($toolData.archiveName)"
- }
- else
- {
- $downloadPath = "$toolPath\$($toolData.exeRelativePath)"
- }
-
- [String]$url = $toolData.url
- if (!(Test-Path $downloadPath))
- {
- Write-Host "Downloading $tool..."
-
- # Download aria2 with .NET. aria2 will be used to download everything else.
- if ($tool -eq "aria2")
- {
- vcpkgDownloadFile $url $downloadPath $toolData.sha512
- }
- else
- {
- $aria2exe = fetchToolInternal "aria2"
- vcpkgDownloadFileWithAria2 $aria2exe $url $downloadPath $toolData.sha512
- }
-
- Write-Host "Downloading $tool... done."
- }
- else
- {
- vcpkgCheckEqualFileHash -url $url -filePath $downloadPath -expectedHash $toolData.sha512
- }
-
- if ($isArchive)
- {
- Write-Host "Extracting $tool..."
- # Extract 7zip920 with shell because we need it to extract 7zip
- # Extract aria2 with shell because we need it to download 7zip
- if ($tool -eq "7zip920" -or $tool -eq "aria2")
- {
- vcpkgExtractZipFile -ArchivePath $downloadPath -DestinationDir $toolPath
- }
- elseif ($tool -eq "7zip")
- {
- $sevenZip920 = fetchToolInternal "7zip920"
- $ec = vcpkgInvokeCommand "$sevenZip920" "x `"$downloadPath`" -o`"$toolPath`" -y"
- if ($ec -ne 0)
- {
- Write-Host "Could not extract $downloadPath"
- throw
- }
- }
- else
- {
- $sevenZipExe = fetchToolInternal "7zip"
- vcpkgExtractFileWith7z -sevenZipExe "$sevenZipExe" -ArchivePath $downloadPath -DestinationDir $toolPath
- }
- Write-Host "Extracting $tool... done."
- }
-
- if (-not (Test-Path $exePath))
- {
- Write-Error "Could not detect or download $tool"
- throw
- }
-
- return $exePath
-}
-
-$path = fetchToolInternal $tool
-Write-Verbose "Fetching tool: $tool. Done."
-return "<sol>::$path::<eol>"
diff --git a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1
deleted file mode 100644
index d7fd24e24..000000000
--- a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1
+++ /dev/null
@@ -1,58 +0,0 @@
-[CmdletBinding()]
-param(
- [Parameter(Mandatory=$False)]
- [string]$withVSPath = ""
-)
-
-Set-StrictMode -Version Latest
-$scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition
-
-$withVSPath = $withVSPath -replace "\\$" # Remove potential trailing backslash
-
-$VisualStudioInstallationInstances = & $scriptsDir\findVisualStudioInstallationInstances.ps1
-if ($VisualStudioInstallationInstances -eq $null)
-{
- throw "Could not find Visual Studio. VS2015 or VS2017 (with C++) needs to be installed."
-}
-
-Write-Verbose "VS Candidates:`n`r$([system.String]::Join([Environment]::NewLine, $VisualStudioInstallationInstances))"
-foreach ($instanceCandidateWithEOL in $VisualStudioInstallationInstances)
-{
- $instanceCandidate = $instanceCandidateWithEOL -replace "<sol>::" -replace "::<eol>"
- Write-Verbose "Inspecting: $instanceCandidate"
- $split = $instanceCandidate -split "::"
- # $preferenceWeight = $split[0]
- # $releaseType = $split[1]
- $version = $split[2]
- $path = $split[3]
-
- if ($withVSPath -ne "" -and $withVSPath -ne $path)
- {
- Write-Verbose "Skipping: $instanceCandidate"
- continue
- }
-
- $majorVersion = $version.Substring(0,2);
- if ($majorVersion -eq "15")
- {
- $VCFolder= "$path\VC\Tools\MSVC\"
- if (Test-Path $VCFolder)
- {
- Write-Verbose "Picking: $instanceCandidate"
- return "$path\MSBuild\15.0\Bin\MSBuild.exe", "v141"
- }
- }
-
- if ($majorVersion -eq "14")
- {
- $clExe= "$path\VC\bin\cl.exe"
- if (Test-Path $clExe)
- {
- Write-Verbose "Picking: $instanceCandidate"
- $programFilesPath = & $scriptsDir\getProgramFiles32bit.ps1
- return "$programFilesPath\MSBuild\14.0\Bin\MSBuild.exe", "v140"
- }
- }
-}
-
-throw "Could not find MSBuild version with C++ support. VS2015 or VS2017 (with C++) needs to be installed." \ No newline at end of file
diff --git a/scripts/findVisualStudioInstallationInstances.ps1 b/scripts/findVisualStudioInstallationInstances.ps1
deleted file mode 100644
index cb51c345d..000000000
--- a/scripts/findVisualStudioInstallationInstances.ps1
+++ /dev/null
@@ -1,61 +0,0 @@
-[CmdletBinding()]
-param(
-
-)
-Set-StrictMode -Version Latest
-$scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition
-. "$scriptsDir\VcpkgPowershellUtils.ps1"
-
-$vswhereExe = (& $scriptsDir\fetchTool.ps1 "vswhere") -replace "<sol>::" -replace "::<eol>"
-
-$output = & $vswhereExe -prerelease -legacy -products * -format xml
-[xml]$asXml = $output
-
-$results = New-Object System.Collections.ArrayList
-foreach ($instance in $asXml.instances.instance)
-{
- $installationPath = $instance.InstallationPath -replace "\\$" # Remove potential trailing backslash
- $installationVersion = $instance.InstallationVersion
-
- $isPrerelease = -7
- if (vcpkgHasProperty -object $instance -propertyName "isPrerelease")
- {
- $isPrerelease = $instance.isPrerelease
- }
-
- if ($isPrerelease -eq 0)
- {
- $releaseType = "PreferenceWeight3::StableRelease"
- }
- elseif ($isPrerelease -eq 1)
- {
- $releaseType = "PreferenceWeight2::PreRelease"
- }
- else
- {
- $releaseType = "PreferenceWeight1::Legacy"
- }
-
- # Placed like that for easy sorting according to preference
- $results.Add("<sol>::${releaseType}::${installationVersion}::${installationPath}::<eol>") > $null
-}
-
-# If nothing is found, attempt to find VS2015 Build Tools (not detected by vswhere.exe)
-if ($results.Count -eq 0)
-{
- $programFiles = & $scriptsDir\getProgramFiles32bit.ps1
- $installationPath = "$programFiles\Microsoft Visual Studio 14.0"
- $clExe = "$installationPath\VC\bin\cl.exe"
- $vcvarsallbat = "$installationPath\VC\vcvarsall.bat"
-
- if ((Test-Path $clExe) -And (Test-Path $vcvarsallbat))
- {
- return "<sol>::PreferenceWeight1::Legacy::14.0::$installationPath::<eol>"
- }
-}
-
-
-$results.Sort()
-$results.Reverse()
-
-return $results \ No newline at end of file
diff --git a/scripts/getProgramFiles32bit.ps1 b/scripts/getProgramFiles32bit.ps1
deleted file mode 100644
index 6b71915b1..000000000
--- a/scripts/getProgramFiles32bit.ps1
+++ /dev/null
@@ -1,17 +0,0 @@
-[CmdletBinding()]
-param(
-
-)
-
-$out = ${env:PROGRAMFILES(X86)}
-if ($out -eq $null)
-{
- $out = ${env:PROGRAMFILES}
-}
-
-if ($out -eq $null)
-{
- throw "Could not find [Program Files 32-bit]"
-}
-
-return $out \ No newline at end of file
diff --git a/scripts/getProgramFilesPlatformBitness.ps1 b/scripts/getProgramFilesPlatformBitness.ps1
deleted file mode 100644
index 2be4c1137..000000000
--- a/scripts/getProgramFilesPlatformBitness.ps1
+++ /dev/null
@@ -1,17 +0,0 @@
-[CmdletBinding()]
-param(
-
-)
-
-$out = ${env:ProgramW6432}
-if ($out -eq $null)
-{
- $out = ${env:PROGRAMFILES}
-}
-
-if ($out -eq $null)
-{
- throw "Could not find [Program Files Platform Bitness]"
-}
-
-return $out \ No newline at end of file
diff --git a/scripts/getWindowsSDK.ps1 b/scripts/getWindowsSDK.ps1
deleted file mode 100644
index d5e2f59a2..000000000
--- a/scripts/getWindowsSDK.ps1
+++ /dev/null
@@ -1,126 +0,0 @@
-[CmdletBinding()]
-param(
- [Parameter(Mandatory=$False)]
- [switch]$DisableWin10SDK = $False,
-
- [Parameter(Mandatory=$False)]
- [switch]$DisableWin81SDK = $False
-)
-
-Set-StrictMode -Version Latest
-$scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition
-. "$scriptsDir\VcpkgPowershellUtils.ps1"
-
-if ($DisableWin10SDK -and $DisableWin81SDK)
-{
- throw "Both Win10SDK and Win81SDK were disabled."
-}
-
-Write-Verbose "Executing $($MyInvocation.MyCommand.Name)"
-
-$validInstances = New-Object System.Collections.ArrayList
-
-# Windows 10 SDK
-function CheckWindows10SDK($path)
-{
- if ($path -eq $null)
- {
- return
- }
-
- $folder = (Join-Path $path "Include")
- if (!(Test-Path $folder))
- {
- Write-Verbose "$folder - Not Found"
- return
- }
-
- Write-Verbose "$folder - Found"
- $win10sdkVersions = @(Get-ChildItem $folder | Where-Object {$_.Name -match "^10"} | Sort-Object)
- [array]::Reverse($win10sdkVersions) # Newest SDK first
-
- foreach ($win10sdkV in $win10sdkVersions)
- {
- $windowsheader = "$folder\$win10sdkV\um\windows.h"
- if (!(Test-Path $windowsheader))
- {
- Write-Verbose "$windowsheader - Not Found"
- continue
- }
- Write-Verbose "$windowsheader - Found"
-
- $ddkheader = "$folder\$win10sdkV\shared\sdkddkver.h"
- if (!(Test-Path $ddkheader))
- {
- Write-Verbose "$ddkheader - Not Found"
- continue
- }
-
- Write-Verbose "$ddkheader - Found"
- $win10sdkVersionString = $win10sdkV.ToString()
- Write-Verbose "Found $win10sdkVersionString"
- $validInstances.Add($win10sdkVersionString) > $null
- }
-}
-
-Write-Verbose "`n"
-Write-Verbose "Looking for Windows 10 SDK"
-$regkey10 = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots\' -Name 'KitsRoot10' -ErrorAction SilentlyContinue
-$regkey10Wow6432 = Get-ItemProperty -Path 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows Kits\Installed Roots\' -Name 'KitsRoot10' -ErrorAction SilentlyContinue
-if (vcpkgHasProperty -object $regkey10 "KitsRoot10") { CheckWindows10SDK($regkey10.KitsRoot10) }
-if (vcpkgHasProperty -object $regkey10Wow6432 "KitsRoot10") { CheckWindows10SDK($regkey10Wow6432.KitsRoot10) }
-CheckWindows10SDK("$env:ProgramFiles\Windows Kits\10")
-CheckWindows10SDK("${env:ProgramFiles(x86)}\Windows Kits\10")
-
-# Windows 8.1 SDK
-function CheckWindows81SDK($path)
-{
- if ($path -eq $null)
- {
- return
- }
-
- $folder = "$path\Include"
- if (!(Test-Path $folder))
- {
- Write-Verbose "$folder - Not Found"
- return
- }
-
- Write-Verbose "$folder - Found"
- $win81sdkVersionString = "8.1"
- Write-Verbose "Found $win81sdkVersionString"
- $validInstances.Add($win81sdkVersionString) > $null
-}
-
-Write-Verbose "`n"
-Write-Verbose "Looking for Windows 8.1 SDK"
-$regkey81 = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots\' -Name 'KitsRoot81' -ErrorAction SilentlyContinue
-$regkey81Wow6432 = Get-ItemProperty -Path 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows Kits\Installed Roots\' -Name 'KitsRoot81' -ErrorAction SilentlyContinue
-if (vcpkgHasProperty -object $regkey81 "KitsRoot81") { CheckWindows81SDK($regkey81.KitsRoot81) }
-if (vcpkgHasProperty -object $regkey81Wow6432 "KitsRoot81") { CheckWindows81SDK($regkey81Wow6432.KitsRoot81) }
-CheckWindows81SDK("$env:ProgramFiles\Windows Kits\8.1")
-CheckWindows81SDK("${env:ProgramFiles(x86)}\Windows Kits\8.1")
-
-Write-Verbose "`n`n`n"
-Write-Verbose "The following Windows SDKs were found:"
-foreach ($instance in $validInstances)
-{
- Write-Verbose $instance
-}
-
-# Selecting
-foreach ($instance in $validInstances)
-{
- if (!$DisableWin10SDK -and $instance -match "10.")
- {
- return $instance
- }
-
- if (!$DisableWin81SDK -and $instance -match "8.1")
- {
- return $instance
- }
-}
-
-throw "Could not detect a Windows SDK / TargetPlatformVersion"
diff --git a/scripts/internalCI.ps1 b/scripts/internalCI.ps1
deleted file mode 100644
index 9529c3766..000000000
--- a/scripts/internalCI.ps1
+++ /dev/null
@@ -1,22 +0,0 @@
-$ErrorActionPreference = "Stop"
-
-rm TEST-internal-ci.xml -errorAction SilentlyContinue
-
-New-Item -type directory downloads -errorAction SilentlyContinue | Out-Null
-./scripts/bootstrap.ps1
-if (-not $?) { throw $? }
-
-# Clear out any intermediate files from the previous build
-if (Test-Path buildtrees)
-{
- Get-ChildItem buildtrees/*/* | ? { $_.Name -ne "src" } | Remove-Item -Recurse -Force
-}
-
-# Purge any outdated packages
-./vcpkg remove --outdated --recurse
-if (-not $?) { throw $? }
-
-./vcpkg.exe install azure-storage-cpp cpprestsdk:x64-windows-static cpprestsdk:x86-uwp `
-bond cryptopp zlib expat sdl2 curl sqlite3 libuv protobuf:x64-windows sfml opencv:x64-windows uwebsockets uwebsockets:x64-windows-static `
-opencv:x86-uwp boost:x86-uwp --keep-going "--x-xunit=TEST-internal-ci.xml" --recurse
-if (-not $?) { throw $? }
diff --git a/scripts/ports.cmake b/scripts/ports.cmake
index ef06a4d65..7a5f2749f 100644
--- a/scripts/ports.cmake
+++ b/scripts/ports.cmake
@@ -37,7 +37,7 @@ if(CMD MATCHES "^BUILD$")
message(FATAL_ERROR "Unsupported target triplet. Triplet file does not exist: ${CMAKE_TRIPLET_FILE}")
endif()
- if(NOT DEFINED CURRENT_PORT_DIR)
+ if(NOT DEFINED CURRENT_PORT_DIR)
message(FATAL_ERROR "CURRENT_PORT_DIR was not defined")
endif()
set(TO_CMAKE_PATH "${CURRENT_PORT_DIR}" CURRENT_PORT_DIR)
@@ -51,19 +51,18 @@ if(CMD MATCHES "^BUILD$")
message(FATAL_ERROR "Port is missing control file: ${CURRENT_PORT_DIR}/CONTROL")
endif()
- message(STATUS "CURRENT_INSTALLED_DIR=${CURRENT_INSTALLED_DIR}")
- message(STATUS "DOWNLOADS=${DOWNLOADS}")
-
- message(STATUS "CURRENT_PACKAGES_DIR=${CURRENT_PACKAGES_DIR}")
- message(STATUS "CURRENT_BUILDTREES_DIR=${CURRENT_BUILDTREES_DIR}")
- message(STATUS "CURRENT_PORT_DIR=${CURRENT_PORT_DIR}")
-
unset(PACKAGES_DIR)
unset(BUILDTREES_DIR)
- file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR})
if(EXISTS ${CURRENT_PACKAGES_DIR})
- message(FATAL_ERROR "Unable to remove directory: ${CURRENT_PACKAGES_DIR}\n Files are likely in use.")
+ file(GLOB FILES_IN_CURRENT_PACKAGES_DIR "${CURRENT_PACKAGES_DIR}/*")
+ if(FILES_IN_CURRENT_PACKAGES_DIR)
+ file(REMOVE_RECURSE ${FILES_IN_CURRENT_PACKAGES_DIR})
+ file(GLOB FILES_IN_CURRENT_PACKAGES_DIR "${CURRENT_PACKAGES_DIR}/*")
+ if(FILES_IN_CURRENT_PACKAGES_DIR)
+ message(FATAL_ERROR "Unable to empty directory: ${CURRENT_PACKAGES_DIR}\n Files are likely in use.")
+ endif()
+ endif()
endif()
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR} ${CURRENT_PACKAGES_DIR})
diff --git a/scripts/templates/portfile.in.cmake b/scripts/templates/portfile.in.cmake
index e89ad4640..e44f53aa8 100644
--- a/scripts/templates/portfile.in.cmake
+++ b/scripts/templates/portfile.in.cmake
@@ -31,3 +31,6 @@ vcpkg_install_cmake()
# Handle copyright
# file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/@PORT@ RENAME copyright)
+
+# Post-build test for cmake libraries
+# vcpkg_test_cmake(PACKAGE_NAME @PORT@)
diff --git a/scripts/toolchains/android.cmake b/scripts/toolchains/android.cmake
index 2a37e4c39..893463056 100644
--- a/scripts/toolchains/android.cmake
+++ b/scripts/toolchains/android.cmake
@@ -6,8 +6,30 @@ set(ANDROID_TOOLCHAIN clang CACHE STRING "")
set(ANDROID_NATIVE_API_LEVEL 21 CACHE STRING "")
set(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION clang CACHE STRING "")
-if(NOT EXISTS "$ENV{ProgramData}/Microsoft/AndroidNDK64/android-ndk-r13b/build/cmake/android.toolchain.cmake")
- message(FATAL_ERROR "Could not find android ndk. Searched at $ENV{ProgramData}/Microsoft/AndroidNDK64/android-ndk-r13b")
+if(DEFINED ENV{ANDROID_NDK_HOME})
+ set(ANDROID_NDK_HOME $ENV{ANDROID_NDK_HOME})
+else()
+ set(ANDROID_NDK_HOME "$ENV{ProgramData}/Microsoft/AndroidNDK64/android-ndk-r13b/")
endif()
-include("$ENV{ProgramData}/Microsoft/AndroidNDK64/android-ndk-r13b/build/cmake/android.toolchain.cmake")
+if(NOT EXISTS "${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake")
+ message(FATAL_ERROR "Could not find android ndk. Searched at ${ANDROID_NDK_HOME}")
+endif()
+
+include("${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake")
+
+if(NOT _VCPKG_ANDROID_TOOLCHAIN)
+set(_VCPKG_ANDROID_TOOLCHAIN 1)
+get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
+if(NOT _CMAKE_IN_TRY_COMPILE)
+ string(APPEND CMAKE_C_FLAGS_INIT " -fPIC ${VCPKG_C_FLAGS} ")
+ string(APPEND CMAKE_CXX_FLAGS_INIT " -fPIC ${VCPKG_CXX_FLAGS} ")
+ string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " ${VCPKG_C_FLAGS_DEBUG} ")
+ string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT " ${VCPKG_CXX_FLAGS_DEBUG} ")
+ string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " ${VCPKG_C_FLAGS_RELEASE} ")
+ string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " ${VCPKG_CXX_FLAGS_RELEASE} ")
+
+ string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ")
+ string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ")
+endif()
+endif()
diff --git a/scripts/toolchains/freebsd.cmake b/scripts/toolchains/freebsd.cmake
index bfeabe18b..b6bf5a479 100644
--- a/scripts/toolchains/freebsd.cmake
+++ b/scripts/toolchains/freebsd.cmake
@@ -1,4 +1,20 @@
+if(NOT _VCPKG_FREEBSD_TOOLCHAIN)
+set(_VCPKG_FREEBSD_TOOLCHAIN 1)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "FreeBSD")
set(CMAKE_CROSSCOMPILING OFF CACHE BOOL "")
endif()
set(CMAKE_SYSTEM_NAME FreeBSD CACHE STRING "")
+
+get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
+if(NOT _CMAKE_IN_TRY_COMPILE)
+ string(APPEND CMAKE_C_FLAGS_INIT " -fPIC ${VCPKG_C_FLAGS} ")
+ string(APPEND CMAKE_CXX_FLAGS_INIT " -fPIC ${VCPKG_CXX_FLAGS} ")
+ string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " ${VCPKG_C_FLAGS_DEBUG} ")
+ string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT " ${VCPKG_CXX_FLAGS_DEBUG} ")
+ string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " ${VCPKG_C_FLAGS_RELEASE} ")
+ string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " ${VCPKG_CXX_FLAGS_RELEASE} ")
+
+ string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ")
+ string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ")
+endif()
+endif()
diff --git a/scripts/toolchains/linux.cmake b/scripts/toolchains/linux.cmake
index ea4f15d60..6bfb57621 100644
--- a/scripts/toolchains/linux.cmake
+++ b/scripts/toolchains/linux.cmake
@@ -1,4 +1,20 @@
+if(NOT _VCPKG_LINUX_TOOLCHAIN)
+set(_VCPKG_LINUX_TOOLCHAIN 1)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
set(CMAKE_CROSSCOMPILING OFF CACHE BOOL "")
endif()
set(CMAKE_SYSTEM_NAME Linux CACHE STRING "")
+
+get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
+if(NOT _CMAKE_IN_TRY_COMPILE)
+ string(APPEND CMAKE_C_FLAGS_INIT " -fPIC ${VCPKG_C_FLAGS} ")
+ string(APPEND CMAKE_CXX_FLAGS_INIT " -fPIC ${VCPKG_CXX_FLAGS} ")
+ string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " ${VCPKG_C_FLAGS_DEBUG} ")
+ string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT " ${VCPKG_CXX_FLAGS_DEBUG} ")
+ string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " ${VCPKG_C_FLAGS_RELEASE} ")
+ string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " ${VCPKG_CXX_FLAGS_RELEASE} ")
+
+ string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ")
+ string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ")
+endif()
+endif()
diff --git a/scripts/toolchains/osx.cmake b/scripts/toolchains/osx.cmake
index dd21f5264..7f6487c40 100644
--- a/scripts/toolchains/osx.cmake
+++ b/scripts/toolchains/osx.cmake
@@ -1,4 +1,28 @@
+if(NOT _VCPKG_OSX_TOOLCHAIN)
+set(_VCPKG_OSX_TOOLCHAIN 1)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
set(CMAKE_CROSSCOMPILING OFF CACHE BOOL "")
+
+ set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}" CACHE STRING "")
+ set(CMAKE_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}" CACHE STRING "")
+else()
+ set(CMAKE_SYSTEM_VERSION "17.0.0" CACHE STRING "")
+ set(CMAKE_SYSTEM_PROCESSOR "x86_64" CACHE STRING "")
endif()
set(CMAKE_SYSTEM_NAME Darwin CACHE STRING "")
+
+set(CMAKE_MACOSX_RPATH ON CACHE BOOL "")
+
+get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
+if(NOT _CMAKE_IN_TRY_COMPILE)
+ string(APPEND CMAKE_C_FLAGS_INIT " -fPIC ${VCPKG_C_FLAGS} ")
+ string(APPEND CMAKE_CXX_FLAGS_INIT " -fPIC ${VCPKG_CXX_FLAGS} ")
+ string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " ${VCPKG_C_FLAGS_DEBUG} ")
+ string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT " ${VCPKG_CXX_FLAGS_DEBUG} ")
+ string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " ${VCPKG_C_FLAGS_RELEASE} ")
+ string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " ${VCPKG_CXX_FLAGS_RELEASE} ")
+
+ string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ")
+ string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ")
+endif()
+endif()
diff --git a/scripts/vcpkgTools.xml b/scripts/vcpkgTools.xml
index 1a2abae81..650e46b03 100644
--- a/scripts/vcpkgTools.xml
+++ b/scripts/vcpkgTools.xml
@@ -1,32 +1,44 @@
<?xml version="1.0"?>
<tools version="2">
<tool name="cmake" os="windows">
- <version>3.10.2</version>
- <exeRelativePath>cmake-3.10.2-win32-x86\bin\cmake.exe</exeRelativePath>
- <url>https://cmake.org/files/v3.10/cmake-3.10.2-win32-x86.zip</url>
- <sha512>9c16861a2ac09c7011b84f38459ecfec2829a9f825b254acbbde46d98f12f8ca0d4db3a6764758cb671507ee7c0327576d87658b81d7ddf1e8280b37569eb16d</sha512>
- <archiveName>cmake-3.10.2-win32-x86.zip</archiveName>
+ <version>3.12.4</version>
+ <exeRelativePath>cmake-3.12.4-win32-x86\bin\cmake.exe</exeRelativePath>
+ <url>https://github.com/Kitware/CMake/releases/download/v3.12.4/cmake-3.12.4-win32-x86.zip</url>
+ <sha512>ca7097c5917101c39d5fa5325cd256ad3aa616a7e5811915cb2869c24961dc133726015b3576908fbd0666f89c8e31886bed9cf6b532a3fe44681d5245bc25c7</sha512>
+ <archiveName>cmake-3.12.4-win32-x86.zip</archiveName>
</tool>
<tool name="cmake" os="osx">
- <version>3.10.2</version>
- <exeRelativePath>cmake-3.10.2-Darwin-x86_64/CMake.app/Contents/bin/cmake</exeRelativePath>
- <url>https://cmake.org/files/v3.10/cmake-3.10.2-Darwin-x86_64.tar.gz</url>
- <sha512>cb7d76e11c892eb786da5804282c4141564390c3552e08c506c7abb93015eb5f619c55255459872b219399ce8114ac321fe92df7f82a7e42bbc874eec240571e</sha512>
- <archiveName>cmake-3.10.2-Darwin-x86_64.tar.gz</archiveName>
+ <version>3.12.4</version>
+ <exeRelativePath>cmake-3.12.4-Darwin-x86_64/CMake.app/Contents/bin/cmake</exeRelativePath>
+ <url>https://github.com/Kitware/CMake/releases/download/v3.12.4/cmake-3.12.4-Darwin-x86_64.tar.gz</url>
+ <sha512>67ce23394d9679818ab0f2792f5d585c8c6f385e18584d488a47d48b768d1ee20b58247d22945aeff1ff9f84b7e843457dac98a50801ac3068ab1fbcbe0b0f45</sha512>
+ <archiveName>cmake-3.12.4-Darwin-x86_64.tar.gz</archiveName>
</tool>
<tool name="cmake" os="linux">
- <version>3.10.2</version>
- <exeRelativePath>cmake-3.10.2-Linux-x86_64/bin/cmake</exeRelativePath>
- <url>https://cmake.org/files/v3.10/cmake-3.10.2-Linux-x86_64.tar.gz</url>
- <sha512>54389b5cb3f3cb9d182d35e0b1eaf7b301695899930da0d26e9df1dc25056213a077646d23ea609a93daa81d30687757d9cf0dc263339fa3d73dbeb1284bc1a9</sha512>
- <archiveName>cmake-3.10.2-Linux-x86_64.tar.gz</archiveName>
+ <version>3.12.4</version>
+ <exeRelativePath>cmake-3.12.4-Linux-x86_64/bin/cmake</exeRelativePath>
+ <url>https://github.com/Kitware/CMake/releases/download/v3.12.4/cmake-3.12.4-Linux-x86_64.tar.gz</url>
+ <sha512>ee9eded0c72e06ef99554f09553d40842478700ca6f07319c28247f1d45301708c703c65ad617cf618833257bacc3b9f63a54b32288bfb619d38758669dcd20f</sha512>
+ <archiveName>cmake-3.12.4-Linux-x86_64.tar.gz</archiveName>
</tool>
<tool name="git" os="windows">
- <version>2.17.0</version>
+ <version>2.19.1</version>
<exeRelativePath>cmd\git.exe</exeRelativePath>
- <url>https://github.com/git-for-windows/git/releases/download/v2.17.0.windows.1/MinGit-2.17.0-32-bit.zip</url>
- <sha512>a34575ab1b4f553e62535e38492904b512df4d6a837cf4abf205dbcdd05edf1eef450cc5b15a4f63f901424d5f3cd1f78b6b22437d0d4f8cd9ce4e42e82617b9</sha512>
- <archiveName>MinGit-2.17.0-32-bit.zip</archiveName>
+ <url>https://github.com/git-for-windows/git/releases/download/v2.19.1.windows.1/MinGit-2.19.1-32-bit.zip</url>
+ <sha512>8a6d2caae2cbaacee073a641cda21465a749325c0af620dabd0e5521c84c92c8d747caa468b111d2ec52b99aee2ee3e6ec41a0a07a8fff582f4c8da568ea329e</sha512>
+ <archiveName>MinGit-2.19.1-32-bit.zip</archiveName>
+ </tool>
+ <tool name="git" os="linux">
+ <version>2.7.4</version>
+ <exeRelativePath></exeRelativePath>
+ <url></url>
+ <sha512></sha512>
+ </tool>
+ <tool name="git" os="osx">
+ <version>2.7.4</version>
+ <exeRelativePath></exeRelativePath>
+ <url></url>
+ <sha512></sha512>
</tool>
<tool name="vswhere" os="windows">
<version>2.4.1</version>
@@ -48,18 +60,11 @@
<archiveName>QtInstallerFramework-win-x86.zip</archiveName>
</tool>
<tool name="7zip" os="windows">
- <version>18.01.0</version>
- <exeRelativePath>7za.exe</exeRelativePath>
- <url>https://www.7-zip.org/a/7z1801-extra.7z</url>
- <sha512>9133fc551d76515e37fdd4dd8c1e28d464aea493548246b44565a42bba46715764f41f9cfa14d470d298c3a6e9829d200f8be5168cb67cf8f23d8042fca833bc</sha512>
- <archiveName>7z1801-extra.7z</archiveName>
- </tool>
- <tool name="7zip920" os="windows">
- <version>9.20.0</version>
- <exeRelativePath>7za.exe</exeRelativePath>
- <url>https://www.7-zip.org/a/7za920.zip</url>
- <sha512>84e830c91a0e8ae499cc4814080da6569d8a6acbddc585c8b62abc86c809793aeb669b0a741063a379fd281ade85f120bc27efeb67d63bf961be893eec8bc3b3</sha512>
- <archiveName>7za920.zip</archiveName>
+ <version>18.1.0</version>
+ <exeRelativePath>7-Zip.CommandLine.18.1.0\tools\7za.exe</exeRelativePath>
+ <url>https://www.nuget.org/api/v2/package/7-Zip.CommandLine/18.1.0</url>
+ <sha512>8c75314102e68d2b2347d592f8e3eb05812e1ebb525decbac472231633753f1d4ca31c8e6881a36144a8da26b2571305b3ae3f4e2b85fc4a290aeda63d1a13b8</sha512>
+ <archiveName>7-zip.commandline.18.1.0.nupkg</archiveName>
</tool>
<tool name="aria2" os="windows">
<version>18.01.0</version>
@@ -68,18 +73,25 @@
<sha512>2456176ba3d506a07cf0cc4f61f080e1ff8cb4106426d66f354c5bb67a9a8720b5ddb26904275e61b1f623c932355f7dcde4cd17556cc895f11293c23c3a9bf3</sha512>
<archiveName>aria2-1.33.1-win-32bit-build1.zip</archiveName>
</tool>
+ <tool name="ninja" os="windows">
+ <version>1.8.2</version>
+ <exeRelativePath>ninja.exe</exeRelativePath>
+ <url>https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-win.zip</url>
+ <sha512>9b9ce248240665fcd6404b989f3b3c27ed9682838225e6dc9b67b551774f251e4ff8a207504f941e7c811e7a8be1945e7bcb94472a335ef15e23a0200a32e6d5</sha512>
+ <archiveName>ninja-win-1.8.2.zip</archiveName>
+ </tool>
<tool name="ninja" os="linux">
<version>1.8.2</version>
<exeRelativePath>ninja</exeRelativePath>
<url>https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip</url>
<sha512>38fcb68e745c1f15b4b50f20069ffe686b1ef5baf93b74958e132ea5d30d155cf6970d6dc1b095aafd421ebd8bcc63acf4f64e305c496266b5182f99b815cca5</sha512>
- <archiveName>ninja-linux.zip</archiveName>
+ <archiveName>ninja-linux-1.8.2.zip</archiveName>
</tool>
<tool name="ninja" os="osx">
<version>1.8.2</version>
<exeRelativePath>ninja</exeRelativePath>
<url>https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-mac.zip</url>
<sha512>acadfb286eb7d93676629701917fa0c3c39f36daa068c169e4a098c29f97380d1ea95abfd42b04798ff118fd9dc93fdb250fcda36086bac20bc5506354214fc3</sha512>
- <archiveName>ninja-mac.zip</archiveName>
+ <archiveName>ninja-mac-1.8.2.zip</archiveName>
</tool>
</tools>