fix source (???)

This commit is contained in:
mgthepro
2022-11-05 13:54:24 +01:00
parent 35a892ee6b
commit 4a9f2bbf2a
22349 changed files with 0 additions and 4715055 deletions

View File

@@ -1,498 +0,0 @@
#Requires -Version 5.0
# We are not using Powershell >= 6.0, as the only supported debugger (vscode powershell extension) breaks on complex code. See: https://github.com/PowerShell/PowerShellEditorServices/issues/1295
# This code can be run on PowerShell Core on any platform, but it is recommend to debug this code in Windows PowerShell ISE unless debugging happens to "just work" on your machine.
# Expect the fix to be out at around the end of 2020/beginning of 2021, at which point consider upgrading this script to PowerShell 7 the next time maintenance is necessary.
# -- Griffin Downs 2020-12-15 (@grdowns)
using namespace System.Management.Automation
using namespace System.Collections.Generic
<#
.SYNOPSIS
Changelog generator for vcpkg.
.DESCRIPTION
The changelog generator uses GitHub's Pull Request and Files API to get
pull requests and their associated file changes over the provided date range.
Then, the data is processed into buckets which are presented to the user
as a markdown file.
.EXAMPLE
Get-Changelog
.EXAMPLE
Get-Changelog -StartDate 11/1/20 -EndDate 12/1/20
.EXAMPLE
$cred = Get-Credential
Get-Changelog -Credentials $cred
.OUTPUTS
A "CHANGELOG.md" file in the working directory. If the file already exists,
suffix is added to the filename and a new file is created to prevent overwriting.
#>
[CmdletBinding(PositionalBinding=$True)]
Param (
# The begin date range (inclusive)
[Parameter(Mandatory=$True, Position=0)]
[ValidateScript({$_ -le (Get-Date)})]
[DateTime]$StartDate,
# The end date range (exclusive)
[Parameter(Mandatory, Position=1)]
[ValidateScript({$_ -le (Get-Date)})]
[DateTime]$EndDate,
[Parameter(Mandatory=$True)]
[String]$OutFile,
# GitHub credentials (username and PAT)
[Parameter()]
[Credential()]
[PSCredential]$Credentials
)
Set-StrictMode -Version 2
if (-not $Credentials) {
$Credentials = Get-Credential -Message 'Enter GitHub Credentials (username and PAT)'
if (-not $Credentials) {
throw [System.ArgumentException]::new(
'Cannot process command because of the missing mandatory parameter: Credentials.'
)
}
}
function Get-AuthHeader() {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True)]
[Credential()]
[PSCredential]$Credentials
)
@{ Authorization = 'Basic ' + [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(
"$($Credentials.UserName):$($Credentials.GetNetworkCredential().Password)")) }
}
$response = Invoke-WebRequest -uri 'https://api.github.com' -Headers (Get-AuthHeader $Credentials)
if ('X-OAuth-Scopes' -notin $response.Headers.Keys) {
throw [System.ArgumentException]::new(
"Cannot validate argument on parameter 'Credentials'. Incorrect GitHub credentials"
)
}
function Get-MergedPullRequests {
[CmdletBinding()]
[OutputType([Object[]])]
Param(
[Parameter(Mandatory=$True, Position=0)]
[ValidateScript({$_ -le (Get-Date)})]
[DateTime]$StartDate,
# The end date range (exclusive)
[Parameter(Mandatory, Position=1)]
[ValidateScript({$_ -le (Get-Date)})]
[DateTime]$EndDate,
[Parameter(Mandatory=$True)]
[Credential()]
[PSCredential]$Credentials
)
Begin {
$RequestSplat = @{
Uri = 'https://api.github.com/repos/Microsoft/vcpkg/pulls'
Body = @{
state = 'closed'
sort = 'updated'
base = 'master'
per_page = 100
direction = 'desc'
page = 1
}
}
$Epoch = Get-Date -AsUTC
$DeltaEpochStart = ($Epoch - $StartDate).Ticks
$ProgressSplat = @{
Activity = "Searching for merged Pull Requests in date range: $($StartDate.ToString('yyyy-MM-dd')) - $($EndDate.ToString('yyyy-MM-dd'))"
PercentComplete = 0
}
Write-Progress @ProgressSplat
$writeProgress = {
$ProgressSplat.PercentComplete = 100 * ($Epoch - $_.updated_at).Ticks / $DeltaEpochStart
Write-Progress @ProgressSplat -Status "Current item date: $($_.updated_at.ToString('yyyy-MM-dd'))"
}
}
Process {
while ($True) {
$response = Invoke-WebRequest -Headers (Get-AuthHeader $Credentials) @RequestSplat | ConvertFrom-Json
foreach ($_ in $response) {
foreach ($x in 'created_at', 'merged_at', 'updated_at', 'closed_at') {
if ($_.$x) { $_.$x = [DateTime]::Parse($_.$x,
[System.Globalization.CultureInfo]::InvariantCulture,
[System.Globalization.DateTimeStyles]::AdjustToUniversal -bor [System.Globalization.DateTimeStyles]::AssumeUniversal) }
}
if (-not $_.merged_at) { continue }
if ($_.updated_at -lt $StartDate) { return }
&$WriteProgress
if ($_.merged_at -ge $EndDate -or $_.merged_at -lt $StartDate) { continue }
$_
}
$RequestSplat.Body.page++
}
}
}
class PRFileMap {
[Object]$Pull
[Object[]]$Files
}
function Get-PullRequestFileMap {
[CmdletBinding()]
[OutputType([PRFileMap[]])]
Param (
[Parameter(Mandatory=$True,ValueFromPipeline=$True)]
[Object]$Pull,
[Parameter(Mandatory=$True)]
[Credential()]
[PSCredential]$Credentials
)
Begin {
$Pulls = [List[Object]]::new()
$ProgressSplat = @{
Activity = 'Getting Pull Request files'
PercentComplete = 0
}
$Count = 0
$WriteProgress = {
$ProgressSplat.Status = 'Getting files for: #{0} ({1}/{2})' -f $_.number, $Count, $Pulls.Length
$ProgressSplat.PercentComplete = 100 * $Count / $Pulls.Length
Write-Progress @ProgressSplat
}
}
Process {
$Pulls += $Pull
}
End {
Write-Progress @ProgressSplat
$ProgressSplat += @{ Status = '' }
$Pulls | ForEach-Object {
$Count++
[PRFileMap]@{
Pull = $_
Files = $(
$requestSplat = @{
Uri = 'https://api.github.com/repos/Microsoft/vcpkg/pulls/{0}/files' -f $_.number
Body = @{ page = 0; per_page = 100 }
}
do {
$requestSplat.Body.page++
$response = Invoke-WebRequest -Headers (Get-AuthHeader $Credentials) @requestSplat | ConvertFrom-Json
$response
} until ($response.Length -lt $requestSplat.Body.per_page)
)
}
&$WriteProgress
}
}
}
class DocumentationUpdate {
[String]$Path
[Boolean]$New
[List[Object]]$Pulls
}
function Select-Documentation {
[CmdletBinding()]
[OutputType([DocumentationUpdate])]
Param (
[Parameter(Mandatory=$True,ValueFromPipeline=$True)]
[PRFileMap]$PRFileMap
)
Begin {
$UpdatedDocumentation = @{}
}
Process {
$PRFileMap.Files | ForEach-Object {
if ($_.filename -notlike 'docs/*') { return }
$new = $_.status -eq 'added'
if ($entry = $UpdatedDocumentation[$_.filename]) {
$entry.Pulls += $PRFileMap.Pull
$entry.New = $entry.New -or $new
} else {
$UpdatedDocumentation[$_.filename] = @{
Pulls = [List[Object]]::new(@($PRFileMap.Pull))
New = $new
}
}
}
}
End {
$UpdatedDocumentation.GetEnumerator() | ForEach-Object {
[DocumentationUpdate]@{
Path = $_.Key
Pulls = $_.Value.Pulls
New = $_.Value.New
}
}
}
}
function Select-InfrastructurePullRequests {
[CmdletBinding()]
[OutputType([Object])]
Param (
[Parameter(Mandatory=$True,ValueFromPipeline=$True)]
[PRFileMap]$PRFileMap
)
Process {
switch -Wildcard ($PRFileMap.Files | Foreach-Object {$_.filename}) {
"docs/*" { continue }
"ports/*" { continue }
"versions/*" { continue }
"scripts/ci.baseline.txt" { continue }
Default { return $PRFileMap.Pull }
}
}
}
class Version {
[String]$Begin
[String]$End
[String]$BeginPort
[String]$EndPort
}
function Select-Version {
[CmdletBinding()]
[OutputType([Version])]
Param (
[Parameter(Mandatory=$True,ValueFromPipeline=$True)]
[Object]$VersionFile
)
Begin {
$V = [Version]@{}
}
Process {
$regex = switch ($VersionFile.filename | Split-Path -Leaf) {
'CONTROL' {
'(?<operation>^[\+|\-]|)(?<field>Version|[\+|\-]Port-Version):\s(?<version>\S+)'
}
'vcpkg.json' {
'(?<operation>^[\+|\-]|)\s*(\"(?<field>version|version-date|version-string|version-semver)\":\s\"(?<version>.+)\"|\"(?<field>port-version)\":\s(?<version>.+))'
}
Default { return }
}
$VersionFile.Patch -split '\n' | ForEach-Object {
if ($_ -notmatch $regex) { return }
$m = $Matches
switch -Wildcard ($m.operation + $m.field) {
'Version*' { $V.Begin = $V.End = $m.version }
'-Version*' { $V.Begin = ($V.Begin, $m.version | Measure-Object -Minimum).Minimum }
'+Version*' { $V.End = ($V.End, $m.version | Measure-Object -Minimum).Minimum }
'Port-Version' { $V.BeginPort = $V.EndPort = $m.version }
'-Port-Version' { $V.BeginPort = ($V.BeginPort, $m.version | Measure-Object -Minimum).Minimum }
'+Port-Version' { $V.EndPort = ($V.EndPort, $m.version | Measure-Object -Maximum).Maximum }
}
}
}
End {
if (-not $V.Begin) { $V.Begin = $V.End }
elseif (-not $V.End) { $V.End = $V.Begin }
if (-not $V.BeginPort) { $V.BeginPort = '0' }
if (-not $V.EndPort) { $V.EndPort = '0' }
$V
}
}
class PortUpdate {
[String]$Port
[Object[]]$Pulls
[Version]$Version
[Boolean]$New
}
function Select-UpdatedPorts {
[CmdletBinding()]
[OutputType([PortUpdate])]
Param (
[Parameter(Mandatory=$True,ValueFromPipeline=$True)]
[PRFileMap]$PRFileMap
)
Begin {
$ModifiedPorts = @{}
}
Process {
$PRFileMap.Files | Where-Object {
$_.filename -like 'ports/*/CONTROL' -or
$_.filename -like 'ports/*/vcpkg.json'
} | ForEach-Object {
$port = $_.filename.split('/')[1]
if ($entry = $ModifiedPorts[$port]) {
$entry.VersionFiles += $_
if (-not $entry.Pulls.Contains($PRFileMap.Pull)) { $entry.Pulls += $PRFileMap.Pull }
} else {
$ModifiedPorts[$port] = @{
VersionFiles = [List[Object]]::new(@($_))
Pulls = [List[Object]]::new(@($PRFileMap.Pull))
}
}
}
}
End {
$ModifiedPorts.GetEnumerator() | ForEach-Object {
$versionFiles = $_.Value.VersionFiles
if (-not ($versionChange = $versionFiles | Select-Version)) { return }
function Find-File($x) { [bool]($versionFiles | Where-Object { $_.filename -like "*$x" }) }
function Find-NewFile($x)
{ [bool]($versionFiles | Where-Object { $_.filename -like "*$x" -and $_.status -eq 'added' }) }
[PortUpdate]@{
Port = $_.Key
Pulls = $_.Value.Pulls
Version = $versionChange
New = (Find-NewFile 'CONTROL') -or (-not (Find-File 'CONTROL') -and (Find-NewFile 'vcpkg.json'))
}
}
}
}
$MergedPRs = Get-MergedPullRequests -StartDate $StartDate -EndDate $EndDate -Credentials $Credentials
$MergedPRsSorted = $MergedPRs | Sort-Object -Property 'number'
$PRFileMaps = $MergedPRsSorted | Get-PullRequestFileMap -Credentials $Credentials
$sortSplat = @{ Property =
@{ Expression = 'New'; Descending = $True }, @{ Expression = 'Path'; Descending = $False } }
$UpdatedDocumentation = $PRFileMaps | Select-Documentation | Sort-Object @sortSplat
$UpdatedInfrastructure = $PRFileMaps | Select-InfrastructurePullRequests
$UpdatedPorts = $PRFileMaps | Select-UpdatedPorts
$NewPorts = $UpdatedPorts | Where-Object { $_.New }
$ChangedPorts = $UpdatedPorts | Where-Object { -not $_.New }
Write-Progress -Activity 'Selecting updates from pull request files' -Completed
Write-Progress -Activity 'Writing changelog file' -PercentComplete -1
$output = @"
vcpkg ($($StartDate.ToString('yyyy.MM.dd')) - $((($EndDate).AddSeconds(-1)).ToString('yyyy.MM.dd')))
---
#### Total port count:
#### Total port count per triplet (tested) (tentative): LINK TO BUILD
|triplet|ports available|
|---|---|
|x86-windows|NUM|
|**x64-windows**|NUM|
|x64-windows-static|NUM|
|x64-windows-static-md|NUM|
|x64-uwp|NUM|
|arm64-windows|NUM|
|arm-uwp|NUM|
|**x64-osx**|NUM|
|**x64-linux**|NUM|
"@
if ($UpdatedDocumentation) {
$output += @"
#### The following documentation has been updated:
$(-join ($UpdatedDocumentation | Sort-Object -Property 'Path' | ForEach-Object {
$PathWithoutDocs = ([string]$_.Path).Remove(0, 5) # 'docs/'
"- [{0}](https://github.com/microsoft/vcpkg/blob/master/docs/{0}){1}`n" -f $PathWithoutDocs, ($(if ($_.New) { ' ***[NEW]***' } else { '' }))
$_.Pulls | ForEach-Object {
" - {0} (by @{1}, in #{2})`n" -f $_.title, $_.user.login, $_.number
}
}))
"@
}
if ($NewPorts) {
$output += @"
<details>
<summary><b>The following $($NewPorts.Length) ports have been added:</b></summary>
|port|version|
|---|---|
$(-join ($NewPorts | Sort-Object -Property 'Port' | ForEach-Object {
"|[{0}]({1})" -f $_.Port, $_.Pulls[0].html_url
if ($_.Pulls.Length -gt 1 ) {
'<sup>'
$_.Pulls[1..($_.Pulls.Length - 1)] | ForEach-Object {
" #{0}" -f $_.number
}
'</sup>'
}
"|{0}`n" -f $_.Version.End
}))
</details>
"@
}
if ($ChangedPorts) {
$output += @"
<details>
<summary><b>The following $($ChangedPorts.Length) ports have been updated:</b></summary>
$(-join ($ChangedPorts | Sort-Object -Property 'Port' | ForEach-Object {
"- {0} ``{1}#{2}``" -f $_.Port, $_.Version.Begin, $_.Version.BeginPort
' -> '
"``{0}#{1}```n" -f $_.Version.End, $_.Version.EndPort
$_.Pulls | ForEach-Object {
" - {0} (by @{1}, in #{2})`n" -f $_.title, $_.user.login, $_.number
}
}))
</details>
"@
}
if ($UpdatedInfrastructure) {
$output += @"
<details>
<summary>The following additional changes have been made to vcpkg's infrastructure:</summary>
$(-join ($UpdatedInfrastructure | ForEach-Object {
"- {0} (by @{1}, in #{2})`n" -f $_.title, $_.user.login, $_.number
}))
</details>
"@
}
Set-Content -Value $Output -Path $OutFile
Write-Progress -Activity 'Writing changelog file' -Completed

View File

@@ -1,271 +0,0 @@
[CmdletBinding()]
param()
function findExistingImportModuleDirectives([Parameter(Mandatory=$true)][string]$path)
{
if (!(Test-Path $path))
{
return
}
$fileContents = Get-Content $path
$fileContents -match 'Import-Module.+?(?=posh-vcpkg)'
return
}
$scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition
$profileEntry = "Import-Module '$scriptsDir\posh-vcpkg'"
$profilePath = $PROFILE # Implicit PowerShell variable
$profileDir = Split-Path $profilePath -Parent
if (!(Test-Path $profileDir))
{
New-Item -ItemType Directory -Path $profileDir | Out-Null
}
Write-Host "`nAdding the following line to ${profilePath}:"
Write-Host " $profileEntry"
# @() Needed to force Array in PowerShell 2.0
[Array]$existingImports = @(findExistingImportModuleDirectives $profilePath)
if ($existingImports.Count -gt 0)
{
$existingImportsOut = $existingImports -join "`n "
Write-Host "`nposh-vcpkg is already imported to your PowerShell profile. The following entries were found:"
Write-Host " $existingImportsOut"
Write-Host "`nPlease make sure you have started a new PowerShell window for the changes to take effect."
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
if (Test-Path $profilePath)
{
$sig = Get-AuthenticodeSignature $profilePath
if ($null -ne $sig.SignerCertificate)
{
Write-Warning "Skipping add of posh-vcpkg import to profile; '$profilePath' appears to be signed."
Write-Warning "Please manually add the line '$profileEntry' to your profile and resign it."
return
}
}
Add-Content $profilePath -Value "`n$profileEntry" -Encoding UTF8
Write-Host "`nSuccessfully added posh-vcpkg to your PowerShell profile. Please start a new PowerShell window for the changes to take effect."
# SIG # Begin signature block
# MIIntwYJKoZIhvcNAQcCoIInqDCCJ6QCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCAQI5pjINs39W5V
# cJzzNG3YZ5LACp5BEUv+jJq20JhbqKCCDYEwggX/MIID56ADAgECAhMzAAACUosz
# qviV8znbAAAAAAJSMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMRMwEQYD
# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy
# b3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMTH01pY3Jvc29mdCBDb2RlIFNpZ25p
# bmcgUENBIDIwMTEwHhcNMjEwOTAyMTgzMjU5WhcNMjIwOTAxMTgzMjU5WjB0MQsw
# CQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9u
# ZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMR4wHAYDVQQDExVNaWNy
# b3NvZnQgQ29ycG9yYXRpb24wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
# AQDQ5M+Ps/X7BNuv5B/0I6uoDwj0NJOo1KrVQqO7ggRXccklyTrWL4x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sLlA0FjQn3ZSNyjPqHr3/1Uf2S6VYKipYvdvLezbJ8X
# 9SE5QUJPc+WWHDMd7LW+EEak/CF/N+I77bHuMN1iyiG7DRGIbOge3jKtD9XgBb25
# N2+4ilsoN3GYe63bMGsL+525ApITbcnhxbpd35UiZP6Nw9ab9WKYIUILI4vdjSyx
# LX+HZZV1cpqU4d5HjPS9exHgDS6RwJvYtvx9N0moBJYz8X+C4HDJKO6EAFY1i8tT
# HKu3TGsqofehtTtlc9QCEimSTBSmeGxEiPmSDjwfaO2erTzwnJcZL5UqDNHoEouN
# Z5+u1f2LfIidCBznb4tRlG9GNe1JKF3bp16tsNwD6GFuKfcDaP8/+ee14qzHPUJm
# niaVz5RlKUh2M0Uphl+hmnHzIWHOjhUQsUSaoyXy0n+Wz01P1TJ+CBiA1w==
# SIG # End signature block

View File

@@ -1,20 +0,0 @@
[CmdletBinding(PositionalBinding=$False)]
Param(
[Parameter(Mandatory=$True)]
[String]$DiffFile
)
Start-Process -FilePath 'git' -ArgumentList 'diff' `
-NoNewWindow -Wait `
-RedirectStandardOutput $DiffFile
if (0 -ne (Get-Item -LiteralPath $DiffFile).Length)
{
$msg = @(
'The formatting of the files in the repo were not what we expected,',
'or the documentation was not regenerated.',
'Please access the diff from format.diff in the build artifacts,'
'and apply the patch with `git apply`'
)
Write-Error ($msg -join "`n")
throw
}

View File

@@ -1,73 +0,0 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
#
variables:
windows-pool: 'PrWin-2022-05-19'
linux-pool: 'PrLin-2022-05-19'
osx-pool: 'PrOsx-2022-02-04'
parameters:
- name: vcpkgToolSha
displayName: 'Custom SHA of vcpkg-tool to use rather than bootstrap'
type: string
default: 'use default'
jobs:
- template: windows/azure-pipelines.yml
parameters:
triplet: x86-windows
jobName: x86_windows
poolName: $(windows-pool)
vcpkgToolSha: ${{ parameters.vcpkgToolSha }}
- template: windows/azure-pipelines.yml
parameters:
triplet: x64-windows
jobName: x64_windows
poolName: $(windows-pool)
vcpkgToolSha: ${{ parameters.vcpkgToolSha }}
- template: windows/azure-pipelines.yml
parameters:
triplet: x64-windows-static
jobName: x64_windows_static
poolName: $(windows-pool)
vcpkgToolSha: ${{ parameters.vcpkgToolSha }}
- template: windows/azure-pipelines.yml
parameters:
triplet: x64-windows-static-md
jobName: x64_windows_static_md
poolName: $(windows-pool)
vcpkgToolSha: ${{ parameters.vcpkgToolSha }}
- template: windows/azure-pipelines.yml
parameters:
triplet: x64-uwp
jobName: x64_uwp
poolName: $(windows-pool)
vcpkgToolSha: ${{ parameters.vcpkgToolSha }}
- template: windows/azure-pipelines.yml
parameters:
triplet: arm64-windows
jobName: arm64_windows
poolName: $(windows-pool)
vcpkgToolSha: ${{ parameters.vcpkgToolSha }}
- template: windows/azure-pipelines.yml
parameters:
triplet: arm-uwp
jobName: arm_uwp
poolName: $(windows-pool)
vcpkgToolSha: ${{ parameters.vcpkgToolSha }}
- template: osx/azure-pipelines.yml
parameters:
poolName: $(osx-pool)
vcpkgToolSha: ${{ parameters.vcpkgToolSha }}
- template: linux/azure-pipelines.yml
parameters:
poolName: $(linux-pool)
vcpkgToolSha: ${{ parameters.vcpkgToolSha }}

View File

@@ -1,9 +0,0 @@
#!/bin/sh
set -e
git clone https://github.com/microsoft/vcpkg-tool vcpkg-tool
git -C vcpkg-tool switch -d $1
rm -rf build.x64.release
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DVCPKG_DEVELOPMENT_WARNINGS=OFF -DVCPKG_WARNINGS_AS_ERRORS=OFF -DVCPKG_BUILD_FUZZING=OFF -DVCPKG_BUILD_TLS12_DOWNLOADER=OFF -B build.x64.release -S vcpkg-tool
ninja -C build.x64.release
mv build.x64.release/vcpkg vcpkg

View File

@@ -1,352 +0,0 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
<#
.SYNOPSIS
Returns whether there's a name collision in the resource group.
.DESCRIPTION
Find-ResourceGroupNameCollision takes a list of resources, and checks if $Test
collides names with any of the resources.
.PARAMETER Test
The name to test.
.PARAMETER Resources
The list of resources.
#>
function Find-ResourceGroupNameCollision {
[CmdletBinding()]
Param([string]$Test, $Resources)
foreach ($resource in $Resources) {
if ($resource.ResourceGroupName -eq $Test) {
return $true
}
}
return $false
}
<#
.SYNOPSIS
Attempts to find a name that does not collide with any resources in the resource group.
.DESCRIPTION
Find-ResourceGroupName takes a set of resources from Get-AzResourceGroup, and finds the
first name in {$Prefix, $Prefix-1, $Prefix-2, ...} such that the name doesn't collide with
any of the resources in the resource group.
.PARAMETER Prefix
The prefix of the final name; the returned name will be of the form "$Prefix(-[1-9][0-9]*)?"
#>
function Find-ResourceGroupName {
[CmdletBinding()]
Param([string] $Prefix)
$resources = Get-AzResourceGroup
$result = $Prefix
$suffix = 0
while (Find-ResourceGroupNameCollision -Test $result -Resources $resources) {
$suffix++
$result = "$Prefix-$suffix"
}
return $result
}
<#
.SYNOPSIS
Returns whether there's a name collision for an image in the resource group.
.DESCRIPTION
Find-ImageNameCollision takes a list of images, and checks if $Test
collides names with any of the image names.
.PARAMETER Test
The name to test.
.PARAMETER Images
The list of images.
#>
function Find-ImageNameCollision {
[CmdletBinding()]
Param([string]$Test, $Images)
foreach ($resource in $Images) {
if ($resource.Name -eq $Test) {
return $true
}
}
return $false
}
<#
.SYNOPSIS
Attempts to find a name that does not collide with any images in the resource group.
.DESCRIPTION
Find-ResourceGroupName takes a set of resources from Get-AzResourceGroup, and finds the
first name in {$Prefix, $Prefix-1, $Prefix-2, ...} such that the name doesn't collide with
any of the resources in the resource group.
.PARAMETER Prefix
The prefix of the final name; the returned name will be of the form "$Prefix(-[1-9][0-9]*)?"
#>
function Find-ImageName {
[CmdLetBinding()]
Param([string]$ResourceGroupName, [string]$Prefix)
$images = Get-AzImage -ResourceGroupName $ResourceGroupName
$result = $Prefix
$suffix = 0
while (Find-ImageNameCollision -Test $result -Images $images) {
$suffix++
$result = "$Prefix-$suffix"
}
return $result
}
<#
.SYNOPSIS
Generates a random password.
.DESCRIPTION
New-Password generates a password, randomly, of length $Length, containing
only alphanumeric characters, underscore, and dash.
.PARAMETER Length
The length of the returned password.
#>
function New-Password {
Param ([int] $Length = 32)
# This 64-character alphabet generates 6 bits of entropy per character.
# The power-of-2 alphabet size allows us to select a character by masking a random Byte with bitwise-AND.
$alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-"
$mask = 63
if ($alphabet.Length -ne 64) {
throw 'Bad alphabet length'
}
[Byte[]]$randomData = [Byte[]]::new($Length)
$rng = $null
try {
$rng = [System.Security.Cryptography.RandomNumberGenerator]::Create()
$rng.GetBytes($randomData)
}
finally {
if ($null -ne $rng) {
$rng.Dispose()
}
}
$result = ''
for ($idx = 0; $idx -lt $Length; $idx++) {
$result += $alphabet[$randomData[$idx] -band $mask]
}
return $result
}
<#
.SYNOPSIS
Waits for the shutdown of the specified resource.
.DESCRIPTION
Wait-Shutdown takes a VM, and checks if there's a 'PowerState/stopped'
code; if there is, it returns. If there isn't, it waits ten seconds and
tries again.
.PARAMETER ResourceGroupName
The name of the resource group to look up the VM in.
.PARAMETER Name
The name of the virtual machine to wait on.
#>
function Wait-Shutdown {
[CmdletBinding()]
Param([string]$ResourceGroupName, [string]$Name)
Write-Host "Waiting for $Name to stop..."
while ($true) {
$Vm = Get-AzVM -ResourceGroupName $ResourceGroupName -Name $Name -Status
$highestStatus = $Vm.Statuses.Count
for ($idx = 0; $idx -lt $highestStatus; $idx++) {
if ($Vm.Statuses[$idx].Code -eq 'PowerState/stopped') {
return
}
}
Write-Host "... not stopped yet, sleeping for 10 seconds"
Start-Sleep -Seconds 10
}
}
<#
.SYNOPSIS
Sanitizes a name to be used in a storage account.
.DESCRIPTION
Sanitize-Name takes a string, and removes all of the '-'s and
lowercases the string, since storage account names must have no
'-'s and must be completely lowercase alphanumeric. It then makes
certain that the length of the string is not greater than 24,
since that is invalid.
.PARAMETER RawName
The name to sanitize.
#>
function Sanitize-Name {
[CmdletBinding()]
Param(
[string]$RawName
)
$result = $RawName.Replace('-', '').ToLowerInvariant()
if ($result.Length -gt 24) {
Write-Error 'Sanitized name for storage account $result was too long.'
throw
}
return $result
}
<#
.SYNOPSIS
Creates a new Azure virtual network with locked down firewall rules.
.PARAMETER ResourceGroupName
The name of the resource group in which the virtual network should be created.
.PARAMETER Location
The location (region) where the network is to be created.
#>
function Create-LockedDownNetwork {
[CmdletBinding()]
Param(
[parameter(Mandatory=$true)]
[string]$ResourceGroupName,
[parameter(Mandatory=$true)]
[string]$Location
)
$allFirewallRules = @()
$allFirewallRules += New-AzNetworkSecurityRuleConfig `
-Name AllowHTTP `
-Description 'Allow HTTP(S)' `
-Access Allow `
-Protocol Tcp `
-Direction Outbound `
-Priority 1008 `
-SourceAddressPrefix * `
-SourcePortRange * `
-DestinationAddressPrefix * `
-DestinationPortRange @(80, 443)
$allFirewallRules += New-AzNetworkSecurityRuleConfig `
-Name AllowSFTP `
-Description 'Allow (S)FTP' `
-Access Allow `
-Protocol Tcp `
-Direction Outbound `
-Priority 1009 `
-SourceAddressPrefix * `
-SourcePortRange * `
-DestinationAddressPrefix * `
-DestinationPortRange @(21, 22)
$allFirewallRules += New-AzNetworkSecurityRuleConfig `
-Name AllowDNS `
-Description 'Allow DNS' `
-Access Allow `
-Protocol * `
-Direction Outbound `
-Priority 1010 `
-SourceAddressPrefix * `
-SourcePortRange * `
-DestinationAddressPrefix * `
-DestinationPortRange 53
$allFirewallRules += New-AzNetworkSecurityRuleConfig `
-Name AllowGit `
-Description 'Allow git' `
-Access Allow `
-Protocol Tcp `
-Direction Outbound `
-Priority 1011 `
-SourceAddressPrefix * `
-SourcePortRange * `
-DestinationAddressPrefix * `
-DestinationPortRange 9418
$allFirewallRules += New-AzNetworkSecurityRuleConfig `
-Name DenyElse `
-Description 'Deny everything else' `
-Access Deny `
-Protocol * `
-Direction Outbound `
-Priority 1013 `
-SourceAddressPrefix * `
-SourcePortRange * `
-DestinationAddressPrefix * `
-DestinationPortRange *
$NetworkSecurityGroupName = $ResourceGroupName + 'NetworkSecurity'
$NetworkSecurityGroup = New-AzNetworkSecurityGroup `
-Name $NetworkSecurityGroupName `
-ResourceGroupName $ResourceGroupName `
-Location $Location `
-SecurityRules $allFirewallRules
$SubnetName = $ResourceGroupName + 'Subnet'
$Subnet = New-AzVirtualNetworkSubnetConfig `
-Name $SubnetName `
-AddressPrefix "10.0.0.0/16" `
-NetworkSecurityGroup $NetworkSecurityGroup `
-ServiceEndpoint "Microsoft.Storage"
$VirtualNetworkName = $ResourceGroupName + 'Network'
$VirtualNetwork = New-AzVirtualNetwork `
-Name $VirtualNetworkName `
-ResourceGroupName $ResourceGroupName `
-Location $Location `
-AddressPrefix "10.0.0.0/16" `
-Subnet $Subnet
return $VirtualNetwork
}
function Invoke-AzVMRunCommandWithRetries {
$result = $null
$success = $false
$attempt = 0
while ($success -eq $false) {
try {
++$attempt
Write-Host "Command attempt $attempt..."
$result = Invoke-AzVMRunCommand @args
$success = $true
} catch {
Write-Host "Running command failed. $_ Retrying after 10 seconds..."
Start-Sleep -Seconds 10
if ($attempt -eq 5) {
Write-Error "Running command failed too many times. Giving up!"
throw $_
}
}
}
return $result
}
Export-ModuleMember -Function Find-ResourceGroupName
Export-ModuleMember -Function Find-ImageName
Export-ModuleMember -Function New-Password
Export-ModuleMember -Function Wait-Shutdown
Export-ModuleMember -Function Sanitize-Name
Export-ModuleMember -Function Create-LockedDownNetwork
Export-ModuleMember -Function Invoke-AzVMRunCommandWithRetries

View File

@@ -1,78 +0,0 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
#
parameters:
- name: vcpkgToolSha
displayName: 'Custom SHA of vcpkg-tool to use rather than bootstrap'
type: string
default: 'use default'
- name: poolName
type: string
jobs:
- job: x64_linux
pool:
name: ${{ parameters.poolName }}
workspace:
clean: resources
timeoutInMinutes: 1440 # 1 day
variables:
- name: WORKING_ROOT
value: /mnt/vcpkg-ci
- name: VCPKG_DOWNLOADS
value: /mnt/vcpkg-ci/downloads
- group: vcpkg-asset-caching-credentials
- name: X_VCPKG_ASSET_SOURCES
value: "x-azurl,$(root-url-ea),$(sas-ea),readwrite"
- group: vcpkg-binary-caching-credentials
- name: X_VCPKG_BINARY_SOURCE_STUB
value: "x-azblob,$(root-bin-url-ea),$(sas-bin-ea)"
steps:
# Note: /mnt is the Azure machines' temporary disk.
- bash: |
sudo mkdir /home/agent -m=777
sudo chown `id -u` /home/agent
sudo mkdir ${{ variables.WORKING_ROOT }} -m=777
sudo mkdir ${{ variables.VCPKG_DOWNLOADS }} -m=777
exit 0
displayName: 'Create working directories'
- bash: ./bootstrap-vcpkg.sh
displayName: 'Bootstrap vcpkg'
condition: eq('use default', '${{ parameters.vcpkgToolSha }}')
- bash: ./scripts/azure-pipelines/bootstrap-from-source.sh ${{ parameters.vcpkgToolSha }}
displayName: "Build vcpkg with CMake"
condition: ne('use default', '${{ parameters.vcpkgToolSha }}')
- task: PowerShell@2
displayName: '*** Test Modified Ports'
inputs:
failOnStderr: true
filePath: 'scripts/azure-pipelines/test-modified-ports.ps1'
arguments: '-Triplet x64-linux -BuildReason $(Build.Reason) -BinarySourceStub "$(X_VCPKG_BINARY_SOURCE_STUB)" -WorkingRoot ${{ variables.WORKING_ROOT }} -ArtifactStagingDirectory $(Build.ArtifactStagingDirectory)'
pwsh: true
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: failure logs for x64-linux'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/failure-logs'
ArtifactName: 'failure logs for x64-linux'
condition: ne(variables['FAILURE_LOGS_EMPTY'], 'True')
- bash: |
python3 scripts/file_script.py /mnt/vcpkg-ci/installed/vcpkg/info/
displayName: 'Build a file list for all packages'
condition: always()
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: file lists for x64-linux'
condition: always()
inputs:
PathtoPublish: scripts/list_files
ArtifactName: 'file lists for x64-linux'
- task: PublishTestResults@2
displayName: 'Publish Test Results'
condition: ne(variables['XML_RESULTS_FILE'], '')
inputs:
testRunTitle: x64-linux
testResultsFormat: xUnit
testResultsFiles: $(XML_RESULTS_FILE)
platform: x64-linux
configuration: static

View File

@@ -1,177 +0,0 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
#
<#
.SYNOPSIS
Creates a Linux virtual machine image, set up for vcpkg's CI.
.DESCRIPTION
create-image.ps1 creates an Azure Linux VM image, set up for vcpkg's CI system.
This script assumes you have installed Azure tools into PowerShell by following the instructions
at https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-3.6.1
or are running from Azure Cloud Shell.
This script assumes you have installed the OpenSSH Client optional Windows component.
#>
$Location = 'eastasia'
$Prefix = 'Lin-'
$Prefix += (Get-Date -Format 'yyyy-MM-dd')
$VMSize = 'Standard_D8a_v4'
$ProtoVMName = 'PROTOTYPE'
$ErrorActionPreference = 'Stop'
$ProgressActivity = 'Creating Linux Image'
$TotalProgress = 11
$CurrentProgress = 1
Import-Module "$PSScriptRoot/../create-vmss-helpers.psm1" -DisableNameChecking
####################################################################################################
Write-Progress `
-Activity $ProgressActivity `
-Status 'Creating SSH key' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)
$sshDir = [System.IO.Path]::GetTempPath() + [System.IO.Path]::GetRandomFileName()
mkdir $sshDir
try {
ssh-keygen.exe -q -b 2048 -t rsa -f "$sshDir/key" -P [string]::Empty
$sshPublicKey = Get-Content "$sshDir/key.pub"
} finally {
Remove-Item $sshDir -Recurse -Force
}
####################################################################################################
Write-Progress `
-Activity $ProgressActivity `
-Status 'Creating resource group' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)
$ResourceGroupName = Find-ResourceGroupName $Prefix
$AdminPW = New-Password
New-AzResourceGroup -Name $ResourceGroupName -Location $Location
$AdminPWSecure = ConvertTo-SecureString $AdminPW -AsPlainText -Force
$Credential = New-Object System.Management.Automation.PSCredential ("AdminUser", $AdminPWSecure)
####################################################################################################
Write-Progress `
-Activity $ProgressActivity `
-Status 'Creating virtual network' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)
$VirtualNetwork = Create-LockedDownNetwork -ResourceGroupName $ResourceGroupName -Location $Location
####################################################################################################
Write-Progress `
-Activity $ProgressActivity `
-Status 'Creating prototype VM' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)
$NicName = $ResourceGroupName + 'NIC'
$Nic = New-AzNetworkInterface `
-Name $NicName `
-ResourceGroupName $ResourceGroupName `
-Location $Location `
-Subnet $VirtualNetwork.Subnets[0]
$VM = New-AzVMConfig -Name $ProtoVMName -VMSize $VMSize -Priority 'Spot' -MaxPrice -1
$VM = Set-AzVMOperatingSystem `
-VM $VM `
-Linux `
-ComputerName $ProtoVMName `
-Credential $Credential `
-DisablePasswordAuthentication
$VM = Add-AzVMNetworkInterface -VM $VM -Id $Nic.Id
$VM = Set-AzVMSourceImage `
-VM $VM `
-PublisherName 'Canonical' `
-Offer '0001-com-ubuntu-server-focal' `
-Skus '20_04-lts' `
-Version latest
$VM = Set-AzVMBootDiagnostic -VM $VM -Disable
$VM = Add-AzVMSshPublicKey `
-VM $VM `
-KeyData $sshPublicKey `
-Path "/home/AdminUser/.ssh/authorized_keys"
New-AzVm `
-ResourceGroupName $ResourceGroupName `
-Location $Location `
-VM $VM
####################################################################################################
Write-Progress `
-Activity $ProgressActivity `
-Status 'Waiting 1 minute to let Azure VM customizations be applied' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)
Start-Sleep -Seconds 60
####################################################################################################
Write-Progress `
-Activity $ProgressActivity `
-Status 'Restarting VM' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)
Restart-AzVm -ResourceGroupName $ResourceGroupName -Name $ProtoVMName
####################################################################################################
Write-Progress `
-Activity $ProgressActivity `
-Status 'Running provisioning script provision-image.sh in VM' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)
$ProvisionImageResult = Invoke-AzVMRunCommandWithRetries `
-ResourceGroupName $ResourceGroupName `
-VMName $ProtoVMName `
-CommandId 'RunShellScript' `
-ScriptPath "$PSScriptRoot\provision-image.sh"
Write-Host "provision-image.sh output: $($ProvisionImageResult.value.Message)"
####################################################################################################
Write-Progress `
-Activity $ProgressActivity `
-Status 'Restarting VM' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)
Restart-AzVM -ResourceGroupName $ResourceGroupName -Name $ProtoVMName
####################################################################################################
Write-Progress `
-Activity $ProgressActivity `
-Status 'Converting VM to Image' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)
Stop-AzVM `
-ResourceGroupName $ResourceGroupName `
-Name $ProtoVMName `
-Force
Set-AzVM `
-ResourceGroupName $ResourceGroupName `
-Name $ProtoVMName `
-Generalized
$VM = Get-AzVM -ResourceGroupName $ResourceGroupName -Name $ProtoVMName
$ImageConfig = New-AzImageConfig -Location $Location -SourceVirtualMachineId $VM.ID
$ImageName = Find-ImageName -ResourceGroupName 'vcpkg-image-minting' -Prefix $Prefix
New-AzImage -Image $ImageConfig -ImageName $ImageName -ResourceGroupName 'vcpkg-image-minting'
####################################################################################################
Write-Progress `
-Activity $ProgressActivity `
-Status 'Deleting unused temporary resources' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)
Remove-AzResourceGroup $ResourceGroupName -Force
####################################################################################################
Write-Progress -Activity $ProgressActivity -Completed
Write-Host "Generated Image: $ImageName"
Write-Host 'Finished!'

View File

@@ -1,108 +0,0 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
#
<#
.SYNOPSIS
Creates a Linux virtual machine scale set, set up for vcpkg's CI.
.DESCRIPTION
create-vmss.ps1 creates an Azure Linux VM scale set, set up for vcpkg's CI
system. See https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/overview
for more information.
This script assumes you have installed Azure tools into PowerShell by following the instructions
at https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-3.6.1
or are running from Azure Cloud Shell.
This script assumes you have installed the OpenSSH Client optional Windows component.
.PARAMETER ImageName
The name of the image to deploy into the scale set.
#>
[CmdLetBinding()]
Param(
[parameter(Mandatory=$true)]
[string]$ImageName
)
$Location = 'eastasia'
$Prefix = 'PrLin-'
$Prefix += (Get-Date -Format 'yyyy-MM-dd')
$VMSize = 'Standard_D32a_v4'
$LiveVMPrefix = 'BUILD'
$ErrorActionPreference = 'Stop'
Import-Module "$PSScriptRoot/../create-vmss-helpers.psm1" -DisableNameChecking
$sshDir = [System.IO.Path]::GetTempPath() + [System.IO.Path]::GetRandomFileName()
mkdir $sshDir
try {
ssh-keygen.exe -q -b 2048 -t rsa -f "$sshDir/key" -P [string]::Empty
$sshPublicKey = Get-Content "$sshDir/key.pub"
} finally {
Remove-Item $sshDir -Recurse -Force
}
$ResourceGroupName = Find-ResourceGroupName $Prefix
$AdminPW = New-Password
$Image = Get-AzImage -ResourceGroupName 'vcpkg-image-minting' -ImageName $ImageName
New-AzResourceGroup -Name $ResourceGroupName -Location $Location
$VirtualNetwork = Create-LockedDownNetwork -ResourceGroupName $ResourceGroupName -Location $Location
$VmssIpConfigName = $ResourceGroupName + 'VmssIpConfig'
$VmssIpConfig = New-AzVmssIpConfig -SubnetId $VirtualNetwork.Subnets[0].Id -Primary -Name $VmssIpConfigName
$VmssName = $ResourceGroupName + 'Vmss'
$Vmss = New-AzVmssConfig `
-Location $Location `
-SkuCapacity 0 `
-SkuName $VMSize `
-SkuTier 'Standard' `
-Overprovision $false `
-UpgradePolicyMode Manual `
-EvictionPolicy Delete `
-Priority Spot `
-MaxPrice -1
$NicName = $ResourceGroupName + 'NIC'
New-AzNetworkInterface `
-Name $NicName `
-ResourceGroupName $ResourceGroupName `
-Location $Location `
-Subnet $VirtualNetwork.Subnets[0]
$Vmss = Add-AzVmssNetworkInterfaceConfiguration `
-VirtualMachineScaleSet $Vmss `
-Primary $true `
-IpConfiguration $VmssIpConfig `
-NetworkSecurityGroupId $VirtualNetwork.Subnets[0].NetworkSecurityGroup.Id `
-Name $NicName
$VmssPublicKey = New-Object -TypeName 'Microsoft.Azure.Management.Compute.Models.SshPublicKey' `
-ArgumentList @('/home/AdminUser/.ssh/authorized_keys', $sshPublicKey)
$Vmss = Set-AzVmssOsProfile `
-VirtualMachineScaleSet $Vmss `
-ComputerNamePrefix $LiveVMPrefix `
-AdminUsername AdminUser `
-AdminPassword $AdminPW `
-LinuxConfigurationDisablePasswordAuthentication $true `
-PublicKey @($VmssPublicKey)
$Vmss = Set-AzVmssStorageProfile `
-VirtualMachineScaleSet $Vmss `
-OsDiskCreateOption 'FromImage' `
-OsDiskCaching ReadOnly `
-DiffDiskSetting Local `
-ImageReferenceId $Image.Id
New-AzVmss `
-ResourceGroupName $ResourceGroupName `
-Name $VmssName `
-VirtualMachineScaleSet $Vmss
Write-Host "Location: $Location"
Write-Host "Resource group name: $ResourceGroupName"
Write-Host 'Finished!'

View File

@@ -1,78 +0,0 @@
#!/bin/bash
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
#
export DEBIAN_FRONTEND=noninteractive
apt-get -y update
apt-get -y dist-upgrade
# Install common build dependencies
APT_PACKAGES="at curl unzip tar libxt-dev gperf libxaw7-dev cifs-utils \
build-essential g++ gfortran zip libx11-dev libxkbcommon-x11-dev libxi-dev \
libgl1-mesa-dev libglu1-mesa-dev mesa-common-dev libxinerama-dev libxxf86vm-dev \
libxcursor-dev yasm libnuma1 libnuma-dev python-six python3-six python-yaml \
flex libbison-dev autoconf libudev-dev libncurses5-dev libtool libxrandr-dev \
xutils-dev dh-autoreconf autoconf-archive libgles2-mesa-dev ruby-full \
pkg-config meson nasm cmake ninja-build"
# Additionally required by qt5-base
APT_PACKAGES="$APT_PACKAGES libxext-dev libxfixes-dev libxrender-dev \
libxcb1-dev libx11-xcb-dev libxcb-glx0-dev libxcb-util0-dev"
# Additionally required by qt5-base for qt5-x11extras
APT_PACKAGES="$APT_PACKAGES libxkbcommon-dev libxcb-keysyms1-dev \
libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync0-dev \
libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev \
libxcb-render-util0-dev libxcb-xinerama0-dev libxcb-xkb-dev libxcb-xinput-dev"
# Additionally required by libhdfs3
APT_PACKAGES="$APT_PACKAGES libkrb5-dev"
# Additionally required by kf5windowsystem
APT_PACKAGES="$APT_PACKAGES libxcb-res0-dev"
# Additionally required by mesa
APT_PACKAGES="$APT_PACKAGES python3-setuptools python3-mako"
# Additionally required by some packages to install additional python packages
APT_PACKAGES="$APT_PACKAGES python3-pip python3-venv"
# Additionally required by qtwebengine
APT_PACKAGES="$APT_PACKAGES nodejs"
# Additionally required by qtwayland
APT_PACKAGES="$APT_PACKAGES libwayland-dev"
# Additionally required by all GN projects
APT_PACKAGES="$APT_PACKAGES python2 python-is-python3"
# Additionally required by libctl
APT_PACKAGES="$APT_PACKAGES guile-2.2-dev"
# Additionally required by gtk
APT_PACKAGES="$APT_PACKAGES libxdamage-dev"
# Additionally required/installed by Azure DevOps Scale Set Agents
APT_PACKAGES="$APT_PACKAGES liblttng-ust0 libkrb5-3 zlib1g libicu66"
apt-get -y install $APT_PACKAGES
# Install the latest Haskell stack for bond
curl -sSL https://get.haskellstack.org/ | sh
# Install CUDA
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub
add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /"
apt-get -y update
apt-get install -y --no-install-recommends cuda-compiler-11-6 cuda-libraries-dev-11-6 cuda-driver-dev-11-6 \
cuda-cudart-dev-11-6 libcublas-11-6 libcurand-dev-11-6 cuda-nvml-dev-11-6 libcudnn8-dev libnccl2 libnccl-dev
# Install PowerShell
wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
dpkg -i packages-microsoft-prod.deb
apt-get update
add-apt-repository universe
apt-get install -y powershell

View File

@@ -1,128 +0,0 @@
#!pwsh
#Requires -Version 6.0
<#
.SYNOPSIS
Installs the set of prerequisites for the macOS CI hosts.
.DESCRIPTION
Install-Prerequisites.ps1 installs all of the necessary prerequisites
to run the vcpkg macOS CI in a vagrant virtual machine,
skipping all prerequisites that are already installed and of the right version.
.INPUTS
None
.OUTPUTS
None
#>
[CmdletBinding()]
Param()
Set-StrictMode -Version 2
if (-not $IsMacOS) {
Write-Error 'This script should only be run on a macOS host'
throw
}
Import-Module "$PSScriptRoot/Utilities.psm1"
$Installables = Get-Content "$PSScriptRoot/configuration/installables.json" | ConvertFrom-Json
$Installables.Applications | ForEach-Object {
$VersionCommand = $_.VersionCommand
$InstalledVersion = (& $VersionCommand[0] $VersionCommand[1..$VersionCommand.Length])
if (-not $?) {
Write-Host "$($_.Name) not installed; installing now"
} else {
$InstalledVersion = $InstalledVersion -join "`n"
if ($InstalledVersion -match $_.VersionRegex) {
if ($Matches.Count -ne 2) {
Write-Error "$($_.Name) has a malformed version regex ($($_.VersionRegex)); it should have a single capture group
(it has $($Matches.Count - 1))"
throw
}
if ($Matches[1] -eq $_.Version) {
Write-Host "$($_.Name) already installed and at the correct version ($($Matches[1]))"
return
} else {
Write-Host "$($_.Name) already installed but with the incorrect version
installed version: '$($Matches[1])'
required version : '$($_.Version)'
upgrading now."
}
} else {
Write-Warning "$($_.Name)'s version command ($($VersionCommand -join ' ')) returned a value we did not expect:
$InstalledVersion
expected a version matching the regex: $($_.VersionRegex)
Installing anyways."
}
}
if ($null -ne (Get-Member -InputObject $_ -Name 'DmgUrl')) {
$pathToDmg = "~/Downloads/$($_.Name).dmg"
Get-RemoteFile -OutFile $pathToDmg -Uri $_.DmgUrl -Sha256 $_.Sha256
hdiutil attach $pathToDmg -mountpoint /Volumes/setup-installer
if ($null -ne (Get-Member -InputObject $_ -Name 'InstallationCommands')) {
$_.InstallationCommands | % {
Write-Host "> $($_ -join ' ')"
& $_[0] $_[1..$_.Length] | Write-Host
}
} elseif ($null -ne (Get-Member -InputObject $_ -Name 'InstallerPath')) {
sudo installer -pkg "/Volumes/setup-installer/$($_.InstallerPath)" -target /
hdiutil detach /Volumes/setup-installer
} else {
Write-Error "$($_.Name) installer object has a DmgUrl, but neither an InstallerPath nor an InstallationCommands"
throw
}
} elseif ($null -ne (Get-Member -InputObject $_ -Name 'PkgUrl')) {
$pathToPkg = "~/Downloads/$($_.Name).pkg"
Get-RemoteFile -OutFile $pathToPkg -Uri $_.PkgUrl -Sha256 $_.Sha256
sudo installer -pkg $pathToPkg -target /
} else {
Write-Error "$($_.Name) does not have an installer in the configuration file."
throw
}
}
$installedVagrantPlugins = @{}
vagrant plugin list --machine-readable | ForEach-Object {
$timestamp, $target, $type, $data = $_ -split ','
switch ($type) {
# these are not important
'ui' { }
'plugin-version-constraint' { }
'plugin-name' {
$installedVagrantPlugins[$data] = $Null
}
'plugin-version' {
$version = $data -replace '%!\(VAGRANT_COMMA\)',','
if ($version -notmatch '^(.*), global') {
Write-Error "Invalid version string for plugin ${target}: $version"
throw
}
$installedVagrantPlugins[$target] = $Matches[1]
}
default {
Write-Warning "Unknown plugin list member type $type for plugin $target"
}
}
}
$Installables.VagrantPlugins | ForEach-Object {
if (-not $installedVagrantPlugins.Contains($_.Name)) {
Write-Host "$($_.Name) not installed; installing now"
} elseif ($installedVagrantPlugins[$_.Name] -ne $_.Version) {
Write-Host "$($_.Name) already installed but with the incorrect version
installed version: '$($installedVagrantPlugins[$_.Name])'
required version: '$($_.Version)'"
} else {
Write-Host "$($_.Name) already installed and at the correct version ($($_.Version))"
return
}
vagrant plugin install $_.Name --plugin-version $_.Version
}

View File

@@ -1,258 +0,0 @@
# `vcpkg-eg-mac` VMs
## Table of Contents
- [`vcpkg-eg-mac` VMs](#vcpkg-eg-mac-vms)
- [Table of Contents](#table-of-contents)
- [Basic Usage](#basic-usage)
- [Creating a new Vagrant box](#creating-a-new-vagrant-box)
- [VM Software Versions](#vm-software-versions)
- [Creating a New Azure Agent Pool](#creating-a-new-azure-agent-pool)
- [Running the VM](#running-the-vm)
- [Getting an Azure Pipelines PAT](#getting-an-azure-pipelines-pat)
- [Setting up a new macOS machine](#setting-up-a-new-macos-machine)
- [Troubleshooting](#troubleshooting)
- [(Internal) Accessing the macOS fileshare](#internal-accessing-the-macos-fileshare)
## Basic Usage
The most common operation here is to set up a new VM for Azure
pipelines; we try to make that operation as easy as possible.
It should take all of three steps, assuming the machine is
already set up (or read [these instructions] for how to set up a machine):
1. [Create a new vagrant box](#creating-a-new-vagrant-box)
2. [Create a new agent pool](#creating-a-new-azure-agent-pool)
3. [Setup and run the vagrant VM](#running-the-vm)
4. Update `azure-pipelines.yml` and `azure-pipelines-osx.yml` to point to the new macOS pool.
[these instructions]: #setting-up-a-new-macos-machine
### Creating a new Vagrant box
Whenever we want to install updated versions of the command line tools,
or of macOS, we need to create a new vagrant box.
This is pretty easy, but the results of the creation are not public,
since we're concerned about licensing.
However, if you're sure you're following Apple's licensing,
you can set up your own vagrant boxes that are the same as ours by doing the following:
You'll need some prerequisites:
- An Xcode installer - you can get this from Apple's developer website,
although you'll need to sign in first: <https://developer.apple.com/downloads>
- The software installed by `Install-Prerequisites.ps1`
If you're updating the CI pool, make sure you update macOS.
First, you'll need to create a base VM;
this is where you determine what version of macOS is installed.
Follow the Parallels process for creating a macOS VM; this involves
updating to whatever version, and then scrolling right until you find
"Install macOS from recovery partition".
Once you've done this, you can run through the installation of macOS onto a new VM.
You should set the username to `vagrant`.
Once it's finished installing, make sure to turn on the SSH server.
Open System Preferences, then go to Sharing > Remote Login,
and turn it on.
You'll then want to add the vagrant SSH keys to the VM's vagrant user.
Open the terminal application and run the following:
```sh
$ # basic stuff
$ date | sudo tee '/etc/vagrant_box_build_time'
$ printf 'vagrant\tALL=(ALL)\tNOPASSWD:\tALL\n' | sudo tee -a '/etc/sudoers.d/vagrant'
$ sudo chmod 0440 '/etc/sudoers.d/vagrant'
$ # then install vagrant keys
$ mkdir -p ~/.ssh
$ curl -fsSL 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' >~/.ssh/authorized_keys
$ chmod 0600 ~/.ssh/authorized_keys
```
Finally, you'll need to install the Parallel Tools.
From your host, in the top bar,
go to Actions > Install Parallels Tools...,
and then follow the instructions.
Now, let's package the VM into a base box.
(The following instructions are adapted from
[these official instructions][base-box-instructions]).
Run the following commands:
```sh
$ cd ~/Parallels
$ echo '{ "provider": "parallels" }' >metadata.json
$ tar zcvf <macos version>.box ./metadata.json ./<name of VM>.pvm
```
This will create a box file which contains all the necessary data.
You can delete the `metadata.json` file after.
Once you've done that, you can upload it to the fileshare,
under `share/boxes/macos-base`, add it to `share/boxes/macos-base.json`,
and finally add it to vagrant:
```sh
$ vagrant box add ~/vagrant/share/boxes/macos-base.json
```
Then, we'll create the final box,
which contains all the necessary programs for doing CI work.
Copy `configuration/Vagrantfile-box.rb` as `Vagrantfile`, and
`configuration/vagrant-box-configuration.json`
into a new directory; into that same directory,
download the Xcode command line tools dmg, and name it `clt.dmg`.
Then, run the following in that directory:
```sh
$ vagrant up
$ vagrant package
```
This will create a `package.box`, which is the box file for the base VM.
Once you've created this box, if you're making it the new box for the CI,
upload it to the fileshare, under `share/boxes/macos-ci`.
Then, add the metadata about the box (the name and version) to
`share/boxes/macos-ci.json`.
Once you've done that, add the software versions under [VM Software Versions](#vm-software-versions).
[base-box-instructions]: https://parallels.github.io/vagrant-parallels/docs/boxes/base.html
#### VM Software Versions
* 2022-02-04 (minor update to 2022-01-03)
* macOS: 12.1
* Xcode CLTs: 13.2
* 2022-01-03:
* macOS: 12.1
* Xcode CLTs: 13.2
* 2021-07-27:
* macOS: 11.5.1
* Xcode CLTs: 12.5.1
* 2021-04-16:
* macOS: 11.2.3
* Xcode CLTs: 12.4
* 2020-09-28:
* macOS: 10.15.6
* Xcode CLTs: 12
### Creating a New Azure Agent Pool
When updating the macOS machines to a new version, you'll need to create
a new agent pool for the machines to join. The standard for this is to
name it `PrOsx-YYYY-MM-DD`, with `YYYY-MM-DD` the day that the process
is started.
In order to create a new agent pool, go to the `vcpkg/public` project;
go to `Project settings`, then go to `Agent pools` under `Pipelines`.
Add a new self-hosted pool, name it as above, and make certain to check
the box for "Grant access permission to all pipelines".
Once you've done this, you are done; you can start adding new machines
to the pool!
### Running the VM
First, make sure that your software is up to date:
```sh
$ cd ~/vcpkg
$ git fetch
$ git switch -d origin/master
$ ./scripts/azure-pipelines/osx/Install-Prerequisites.ps1
```
as well as checking to make sure macOS is up to date.
Then, follow the instructions for [accessing ~/vagrant/share][access-fileshare].
And finally, [grab a PAT], update the vagrant box, set up the VM, and run it:
```sh
$ vagrant box remove -f vcpkg/macos-ci # This won't do anything if the machine never had a box before
$ vagrant box add ~/vagrant/share/boxes/macos-ci.json
$ ~/vcpkg/scripts/azure-pipelines/osx/Setup-VagrantMachines.ps1 -Date <box version YYYY-MM-DD> -DevopsPat <PAT>
$ cd ~/vagrant/vcpkg-eg-mac
$ vagrant up # if this fails, reboot through the kvm and/or log in interactively, then come back here
```
[grab a PAT]: #getting-an-azure-pipelines-pat
## Getting an Azure Pipelines PAT
Personal Access Tokens are an important part of this process,
and they are fairly easy to generate.
On ADO, under the correct project (in vcpkg's case, "vcpkg"),
click on the "User Settings" icon, then go to "Personal access tokens".
It is the icon to the left of your user icon, in the top right corner.
Then, create a new token, give it a name, make sure it expires quickly,
and give it a custom defined scope that includes the
"Agent pools: Read & manage" permission (you'll need to "Show all scopes"
to access this).
You can now copy this token and use it to allow machines to join.
## Setting up a new macOS machine
Before anything else, one must download `brew` and `powershell`.
```sh
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
$ brew cask install powershell
```
Then, we need to download the `vcpkg` repository:
```sh
$ git clone https://github.com/microsoft/vcpkg
```
Then, we need to mint an SSH key:
```sh
$ ssh-keygen
$ cat .ssh/id_rsa.pub
```
Add that SSH key to `authorized_keys` on the file share machine with the base box.
Next, install prerequisites:
```sh
$ cd vcpkg/scripts/azure-pipelines/osx
$ ./Install-Prerequisites.ps1 -Force
```
And finally, make sure you can [access ~/vagrant/share][access-fileshare].
## Troubleshooting
The following are issues that we've run into:
- (with a Parallels box) `vagrant up` doesn't work, and vagrant gives the error that the VM is `'stopped'`.
- Try logging into the GUI with the KVM, and retrying `vagrant up`.
- (when running a powershell script) The error `Failed to initialize CoreCLR, HRESULT: 0x8007001F` is printed.
- Reboot the machine; run
```sh
$ sudo shutdown -r now
```
and wait for the machine to start back up. Then, start again from where the error was emitted.
## (Internal) Accessing the macOS fileshare
The fileshare is located on `vcpkgmm-01`, under the `fileshare` user, in the `share` directory.
In order to get `sshfs` working on the physical machine,
You can run `Install-Prerequisites.ps1` to grab the right software, then either:
```sh
$ mkdir -p ~/vagrant/share
$ sshfs fileshare@vcpkgmm-01:share ~/vagrant/share
```
If you get an error, that means that gatekeeper has prevented the kernel extension from loading,
so you'll need to access the GUI of the machine, go to System Preferences,
Security & Privacy, General, unlock the settings,
and allow system extensions from the osxfuse developer to run.
Then, you'll be able to add ~/vagrant/share as an sshfs.
[access-fileshare]: #internal-accessing-the-macos-fileshare

View File

@@ -1,126 +0,0 @@
#!pwsh
#Requires -Version 6.0
<#
.SYNOPSIS
Sets up the configuration for the vagrant virtual machines.
.DESCRIPTION
Setup-VagrantMachines.ps1 sets up the virtual machines for
vcpkg's macOS CI. It puts the VagrantFile and necessary
configuration JSON file into ~/vagrant/vcpkg-eg-mac.
.PARAMETER MachineId
The number to give the machine; should match [0-9]{2}.
Defaults to the numbers at the end of the machine name,
assuming that that machine name matches `VCPKGMM-[0-9]{2}`.
.PARAMETER DevopsPat
The personal access token which has Read & Manage permissions on the ADO pool.
.PARAMETER Date
The date on which this pool is being created. Sets the default values for BoxVersion and AgentPool.
.PARAMETER BoxVersion
The version of the box to use. If -Date is passed, uses that as the version.
.PARAMETER AgentPool
The agent pool to add the machine to. If -Date is passed, uses "PrOsx-$Date" as the pool.
.PARAMETER DevopsUrl
The URL of the ADO instance; defaults to vcpkg's, which is https://dev.azure.com/vcpkg.
.PARAMETER BaseName
The base name for the vagrant VM; the machine name is $BaseName-$MachineId.
Defaults to 'vcpkg-eg-mac'.
.PARAMETER BoxName
The name of the box to use. Defaults to 'vcpkg/macos-ci',
which is only available internally.
.INPUTS
None
.OUTPUTS
None
#>
[CmdletBinding(PositionalBinding=$False, DefaultParameterSetName='DefineDate')]
Param(
[Parameter(Mandatory=$False)]
[String]$MachineId,
[Parameter(Mandatory=$True)]
[String]$DevopsPat,
[Parameter(Mandatory=$True, ParameterSetName='DefineDate')]
[String]$Date,
[Parameter(Mandatory=$True, ParameterSetName='DefineVersionAndAgentPool')]
[String]$BoxVersion,
[Parameter(Mandatory=$True, ParameterSetName='DefineVersionAndAgentPool')]
[String]$AgentPool,
[Parameter(Mandatory=$False)]
[String]$DevopsUrl = 'https://dev.azure.com/vcpkg',
[Parameter()]
[String]$BaseName = 'vcpkg-eg-mac',
[Parameter()]
[String]$BoxName = 'vcpkg/macos-ci'
)
Set-StrictMode -Version 2
if (-not $IsMacOS) {
throw 'This script should only be run on a macOS host'
}
if (-not [String]::IsNullOrEmpty($Date)) {
$BoxVersion = $Date
$AgentPool = "PrOsx-$Date"
}
if ([String]::IsNullOrEmpty($MachineId)) {
$hostname = hostname -s
if ($hostname -match '^VCPKGMM-([0-9]{2})$') {
$MachineId = $matches[1]
} else {
Write-Error "Hostname ($hostname) does not match the expected format (VCPKGMM-NN). Please pass -MachineId in order to give the VM a number."
}
}
if (Test-Path '~/vagrant/vcpkg-eg-mac') {
Write-Host 'Deleting existing directories'
Push-Location '~/vagrant/vcpkg-eg-mac'
vagrant destroy -f
if (-not $?) {
throw "Failed to destroy vagrant VM."
}
Pop-Location
Remove-Item -Recurse -Force -LiteralPath '~/vagrant/vcpkg-eg-mac' | Out-Null
}
Write-Host 'Creating new directories'
if (-not (Test-Path -Path '~/vagrant')) {
New-Item -ItemType 'Directory' -Path '~/vagrant' | Out-Null
}
New-Item -ItemType 'Directory' -Path '~/vagrant/vcpkg-eg-mac' | Out-Null
Copy-Item `
-Path "$PSScriptRoot/configuration/Vagrantfile-vm.rb" `
-Destination '~/vagrant/vcpkg-eg-mac/Vagrantfile'
$configuration = @{
pat = $DevopsPat
agent_pool = $AgentPool
devops_url = $DevopsUrl
machine_name = "${BaseName}-${MachineId}"
box_name = $BoxName
box_version = $BoxVersion
}
ConvertTo-Json -InputObject $configuration -Depth 5 `
| Set-Content -Path '~/vagrant/vcpkg-eg-mac/vagrant-configuration.json'

View File

@@ -1,90 +0,0 @@
#Requires -Version 6.0
Set-StrictMode -Version 2
<#
.SYNOPSIS
Returns whether the specified command exists in the current environment.
.DESCRIPTION
Get-CommandExists takes a string as a parameter,
and returns whether it exists in the current environment;
either a function, alias, or an executable in the path.
It's somewhat equivalent to `which`.
.PARAMETER Name
Specifies the name of the command which may or may not exist.
.INPUTS
System.String
The name of the command.
.OUTPUTS
System.Boolean
Whether the command exists.
#>
function Get-CommandExists
{
[CmdletBinding()]
[OutputType([Boolean])]
Param(
[Parameter(ValueFromPipeline)]
[String]$Name
)
$null -ne (Get-Command -Name $Name -ErrorAction SilentlyContinue)
}
<#
.SYNOPSIS
Downloads a file and checks its hash.
.DESCRIPTION
Get-RemoteFile takes a URI and a hash,
downloads the file at that URI to OutFile,
and checks that the hash of the downloaded file.
It then returns a FileInfo object corresponding to the downloaded file.
.PARAMETER OutFile
Specifies the file path to download to.
.PARAMETER Uri
The URI to download from.
.PARAMETER Sha256
The expected SHA256 of the downloaded file.
.INPUTS
None
.OUTPUTS
System.IO.FileInfo
The FileInfo for the downloaded file.
#>
function Get-RemoteFile
{
[CmdletBinding(PositionalBinding=$False)]
[OutputType([System.IO.FileInfo])]
Param(
[Parameter(Mandatory=$True)]
[String]$OutFile,
[Parameter(Mandatory=$True)]
[String]$Uri,
[Parameter(Mandatory=$True)]
[String]$Sha256
)
Invoke-WebRequest -OutFile $OutFile -Uri $Uri
$actualHash = Get-FileHash -Algorithm SHA256 -Path $OutFile
if ($actualHash.Hash -ne $Sha256) {
throw @"
Invalid hash for file $OutFile;
expected: $Sha256
found: $($actualHash.Hash)
Please make sure that the hash in the powershell file is correct.
"@
}
Get-Item $OutFile
}

View File

@@ -1,81 +0,0 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
#
parameters:
- name: vcpkgToolSha
displayName: 'Custom SHA of vcpkg-tool to use rather than bootstrap'
type: string
default: 'use default'
- name: poolName
type: string
jobs:
- job: x64_osx
pool:
name: ${{ parameters.poolName }}
workspace:
clean: resources
timeoutInMinutes: 2880 # 2 days
variables:
- name: WORKING_ROOT
value: /Users/vagrant/Data
- name: VCPKG_DOWNLOADS
value: /Users/vagrant/Data/downloads
- group: vcpkg-binary-caching-credentials
- name: X_VCPKG_BINARY_SOURCE_STUB
value: "x-azblob,$(root-bin-url),$(sas-bin)" # not in eastasia due to physical location
- group: vcpkg-asset-caching-credentials
- name: X_VCPKG_ASSET_SOURCES
value: "x-azurl,$(root-url-ea),$(sas-ea),readwrite"
steps:
- bash: |
sudo mkdir ${{ variables.VCPKG_DOWNLOADS }} || 0
sudo chmod 777 ${{ variables.VCPKG_DOWNLOADS }} || 0
exit 0
displayName: 'Create ${{ variables.VCPKG_DOWNLOADS }}'
- bash: ./bootstrap-vcpkg.sh
displayName: 'Bootstrap vcpkg'
condition: eq('use default', '${{ parameters.vcpkgToolSha }}')
- bash: |
brew install cmake
./scripts/azure-pipelines/bootstrap-from-source.sh ${{ parameters.vcpkgToolSha }}
displayName: "Build vcpkg with CMake"
condition: ne('use default', '${{ parameters.vcpkgToolSha }}')
- task: PowerShell@2
displayName: '*** Test Modified Ports'
inputs:
failOnStderr: true
filePath: 'scripts/azure-pipelines/test-modified-ports.ps1'
arguments: >
-Triplet "x64-osx"
-BuildReason "$(Build.Reason)"
-BinarySourceStub "${{ variables.X_VCPKG_BINARY_SOURCE_STUB }}"
-WorkingRoot "${{ variables.WORKING_ROOT }}"
-ArtifactStagingDirectory "$(Build.ArtifactStagingDirectory)"
pwsh: true
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: failure logs for x64-osx'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/failure-logs'
ArtifactName: 'failure logs for x64-osx${{ variables.Postfix }}'
condition: ne(variables['FAILURE_LOGS_EMPTY'], 'True')
- bash: python3 scripts/file_script.py /Users/vagrant/Data/installed/vcpkg/info/
displayName: 'Build a file list for all packages'
condition: always()
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: file lists for x64-osx${{ variables.Postfix }}'
condition: always()
inputs:
PathtoPublish: scripts/list_files
ArtifactName: 'file lists for x64-osx${{ variables.Postfix }}'
- task: PublishTestResults@2
displayName: 'Publish Test Results'
condition: ne(variables['XML_RESULTS_FILE'], '')
inputs:
testRunTitle: x64-osx
testResultsFormat: xUnit
testResultsFiles: $(XML_RESULTS_FILE)
platform: x64-osx
configuration: static

View File

@@ -1,35 +0,0 @@
require 'json'
configuration = JSON.parse(File.read("#{__dir__}/vagrant-box-configuration.json"))
Vagrant.configure('2') do |config|
config.vm.box = 'vcpkg/macos-base'
config.vm.synced_folder '.', '/Users/vagrant/shared'
config.vm.provision 'shell',
run: 'once',
name: 'Install Xcode Command Line Tools: attach dmg file',
inline: 'hdiutil attach shared/clt.dmg -mountpoint /Volumes/setup-installer',
privileged: false
config.vm.provision 'shell',
run: 'once',
name: 'Install Xcode Command Line Tools: run installer',
inline: 'installer -pkg "/Volumes/setup-installer/Command Line Tools.pkg" -target /',
privileged: true
config.vm.provision 'shell',
run: 'once',
name: 'Install XCode Command Line Tools: detach dmg file',
inline: 'hdiutil detach /Volumes/setup-installer',
privileged: false
config.vm.provision 'shell',
run: 'once',
name: 'Install brew',
inline: '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"',
privileged: false
config.vm.provision 'shell',
run: 'once',
name: 'Install brew applications',
inline: "brew install #{configuration['brew'].join(' ')} && brew install --cask #{configuration['brew-cask'].join(' ')}",
privileged: false
end

View File

@@ -1,67 +0,0 @@
require 'json'
configuration = JSON.parse(File.read("#{__dir__}/vagrant-configuration.json"))
server = {
:machine_name => configuration['machine_name'],
:box => configuration['box_name'],
:box_version => configuration['box_version'],
:ram => 24000,
:cpu => 11
}
azure_agent_url = 'https://vstsagentpackage.azureedge.net/agent/2.198.3/vsts-agent-osx-x64-2.198.3.tar.gz'
devops_url = configuration['devops_url']
agent_pool = configuration['agent_pool']
pat = configuration['pat']
Vagrant.configure('2') do |config|
config.vm.box = server[:box]
config.vm.box_version = server[:box_version]
config.vm.synced_folder '.', '/vagrant', disabled: true
config.vm.provider 'parallels' do |prl|
prl.memory = server[:ram]
prl.cpus = server[:cpu]
end
config.vm.provision 'shell',
run: 'once',
name: 'Create the data directory',
inline: "mkdir ~/Data",
privileged: false
config.vm.provision 'shell',
run: 'once',
name: 'Download azure agent',
inline: "curl -s -o ~/Downloads/azure-agent.tar.gz #{azure_agent_url}",
privileged: false
config.vm.provision 'shell',
run: 'once',
name: 'Unpack azure agent',
inline: 'mkdir myagent; cd myagent; tar xf ~/Downloads/azure-agent.tar.gz',
privileged: false
config.vm.provision 'shell',
run: 'once',
name: 'Add VM to azure agent pool',
inline: "cd ~/myagent;\
./config.sh --unattended \
--url #{devops_url} \
--work ~/Data/work \
--auth pat --token #{pat} \
--pool #{agent_pool} \
--agent #{server[:machine_name]} \
--replace \
--acceptTeeEula",
privileged: false
# Start listening for jobs
config.vm.provision 'shell',
run: 'always',
name: 'Start running azure pipelines',
inline: 'cd /Users/vagrant/myagent;\
nohup ./run.sh&',
privileged: false
end

View File

@@ -1,53 +0,0 @@
{
"$schema": "./installables.schema.json",
"Applications": [
{
"Name": "vagrant",
"VersionCommand": [ "vagrant", "-v" ],
"VersionRegex": "Vagrant (.*)",
"Version": "2.2.19",
"DmgUrl": "https://releases.hashicorp.com/vagrant/2.2.19/vagrant_2.2.19_x86_64.dmg",
"Sha256": "6307BE217813A11C9E106448BF232803031E434A08C8B2DF8C62FDC9E8543845",
"InstallerPath": "vagrant.pkg"
},
{
"Name": "Parallels",
"VersionCommand": [ "cat", "/Applications/Parallels Desktop.app/Contents/Info.plist" ],
"VersionRegex": "<key>CFBundleShortVersionString</key>[\\n\\t ]*<string>([0-9.]+)</string>",
"Version": "17.1.1",
"DmgUrl": "https://download.parallels.com/desktop/v17/17.1.1-51537/ParallelsDesktop-17.1.1-51537.dmg",
"Sha256": "BD7BE2DF4D1B3508C127CF1D9C1EF93CDDA63384BCF3893A77FBC9F1169765A9",
"InstallationCommands": [
[ "bash", "-c", "ps x | grep 'Parallels Desktop' | grep -v 'grep' | sed -E 's/^ *([0-9]+).*(\\/Applications.*)$/\\1: \\2/'" ],
[ "bash", "-c", "ps x | grep 'Parallels Desktop' | grep -v 'grep' | sed -E 's/^ *([0-9]+).*$/\\1/' | xargs -p kill" ],
[ "sudo", "rm", "-rf", "/Applications/Parallels Desktop.app" ],
[ "sudo", "cp", "-r", "/Volumes/setup-installer/Parallels Desktop.app", "/Applications" ],
[ "sudo", "/Applications/Parallels Desktop.app/Contents/MacOS/inittool2", "init", "-b", "/Applications/Parallels Desktop.app" ]
]
},
{
"Name": "osxfuse",
"VersionCommand": [ "cat", "/Library/Filesystems/macfuse.fs/Contents/version.plist" ],
"VersionRegex": "<key>CFBundleVersion</key>[\\n\\t ]*<string>([0-9.]+)</string>",
"Version": "4.2.4",
"DmgUrl": "https://github.com/osxfuse/osxfuse/releases/download/macfuse-4.2.4/macfuse-4.2.4.dmg",
"Sha256": "82A2C30B3A7BF56AA2755C0C192FB50D9EECC3FE42505AB4E8679B50306188BD",
"InstallerPath": "Install macFUSE.pkg"
},
{
"Name": "sshfs",
"VersionCommand": [ "sshfs", "--version" ],
"VersionRegex": "SSHFS version [0-9.]* \\(OSXFUSE SSHFS (.*)\\)",
"Version": "2.5.0",
"PkgUrl": "https://github.com/osxfuse/sshfs/releases/download/osxfuse-sshfs-2.5.0/sshfs-2.5.0.pkg",
"Sha256": "F8F4F71814273EA42DBE6CD92199F7CFF418571FFD1B10C0608878D3472D2162"
}
],
"VagrantPlugins": [
{
"Name": "vagrant-parallels",
"Version": "2.2.4"
}
]
}

View File

@@ -1,66 +0,0 @@
{
"$schema": "https://json-schema.org/draft-07/schema",
"type": "object",
"definitions": {
"sha256": {
"type": "string",
"pattern": "[A-Z0-9]{64}"
}
},
"required": [
"Applications",
"VagrantPlugins"
],
"properties": {
"Applications": {
"type": "array",
"items": {
"type": "object",
"properties": {
"Name": {
"type": "string"
},
"VersionCommand": {
"type": "array",
"items": {
"type": "string"
},
"minItems": 1
},
"VersionRegex": {
"type": "string",
"format": "regex"
},
"Version": {
"type": "string"
},
"DmgUrl": {
"type": "string",
"format": "uri"
},
"Sha256": {
"$ref": "#/definitions/sha256"
},
"InstallerPath": {
"type": "string"
}
}
}
},
"VagrantPlugins": {
"type": "array",
"items": {
"type": "object",
"required": [ "Name", "Version" ],
"properties": {
"Name": {
"type": "string"
},
"Version": {
"type": "string"
}
}
}
}
}
}

View File

@@ -1,25 +0,0 @@
{
"$schema": "./vagrant-box-configuration.schema.json",
"brew": [
"autoconf-archive",
"autoconf",
"automake",
"bison",
"cmake",
"gettext",
"gfortran",
"gperf",
"gtk-doc",
"libtool",
"meson",
"mono",
"nasm",
"ninja",
"pkg-config",
"texinfo",
"yasm"
],
"brew-cask": [
"powershell"
]
}

View File

@@ -1,18 +0,0 @@
{
"$schema": "https://json-schema.org/draft-07/schema",
"type": "object",
"required": [
"brew",
"brew-cask"
],
"properties": {
"brew": {
"type": "array",
"items": { "type": "string" }
},
"brew-cask": {
"type": "array",
"items": { "type": "string" }
}
}
}

View File

@@ -1,35 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2019-09/schema",
"type": "object",
"required": [
"pat",
"agent_pool",
"devops_url",
"machine_name",
"box_name",
"box_version"
],
"properties": {
"pat": {
"type": "string"
},
"agent_pool": {
"type": "string"
},
"devops_url": {
"type": "string"
},
"machine_name": {
"type": "string"
},
"box_name": {
"type": "string"
},
"box_version": {
"type": "string"
}
}
}

View File

@@ -1,176 +0,0 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
#
<#
.SYNOPSIS
Runs the 'Test Modified Ports' part of the vcpkg CI system for all platforms.
.PARAMETER Triplet
The triplet to test.
.PARAMETER WorkingRoot
The location used as scratch space for 'installed', 'packages', and 'buildtrees' vcpkg directories.
.PARAMETER ArtifactStagingDirectory
The Azure Pipelines artifacts directory. If not supplied, defaults to the current directory.
.PARAMETER ArchivesRoot
Equivalent to '-BinarySourceStub "files,$ArchivesRoot"'
.PARAMETER BinarySourceStub
The type and parameters of the binary source. Shared across runs of this script. If
this parameter is not set, binary caching will not be used. Example: "files,W:\"
.PARAMETER BuildReason
The reason Azure Pipelines is running this script. For invocations caused by `PullRequest`,
modified ports are identified by changed hashes with regard to git HEAD~1 (subject to NoParentHashes),
and ports marked as failing in the CI baseline (or which depend on such ports) are skipped.
If BinarySourceStub is set and this parameter is set to a non-empty value other than `PullRequest`,
binary caching will be in write-only mode.
.PARAMETER NoParentHashes
Indicates to not use parent hashes even for pull requests.
.PARAMETER PassingIsPassing
Indicates that 'Passing, remove from fail list' results should not be emitted as failures. (For example, this is used
when using vcpkg to test a prerelease MSVC++ compiler)
#>
[CmdletBinding(DefaultParameterSetName="ArchivesRoot")]
Param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]$Triplet,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
$WorkingRoot,
[ValidateNotNullOrEmpty()]
$ArtifactStagingDirectory = '.',
[Parameter(ParameterSetName='ArchivesRoot')]
$ArchivesRoot = $null,
[Parameter(ParameterSetName='BinarySourceStub')]
$BinarySourceStub = $null,
[String]$BuildReason = $null,
[switch]$NoParentHashes = $false,
[switch]$PassingIsPassing = $false
)
if (-Not ((Test-Path "triplets/$Triplet.cmake") -or (Test-Path "triplets/community/$Triplet.cmake"))) {
Write-Error "Incorrect triplet '$Triplet', please supply a valid triplet."
throw
}
if ((-Not [string]::IsNullOrWhiteSpace($ArchivesRoot))) {
if ((-Not [string]::IsNullOrWhiteSpace($BinarySourceStub))) {
Write-Error "Only one binary caching setting may be used."
throw
}
$BinarySourceStub = "files,$ArchivesRoot"
}
$env:VCPKG_DOWNLOADS = Join-Path $WorkingRoot 'downloads'
$buildtreesRoot = Join-Path $WorkingRoot 'buildtrees'
$installRoot = Join-Path $WorkingRoot 'installed'
$packagesRoot = Join-Path $WorkingRoot 'packages'
$commonArgs = @(
"--x-buildtrees-root=$buildtreesRoot",
"--x-install-root=$installRoot",
"--x-packages-root=$packagesRoot",
"--overlay-ports=scripts/test_ports"
)
$cachingArgs = @()
$skipFailuresArg = @()
if ([string]::IsNullOrWhiteSpace($BinarySourceStub)) {
$cachingArgs = @('--no-binarycaching')
} else {
$cachingArgs = @('--binarycaching')
$binaryCachingMode = 'readwrite'
if ([string]::IsNullOrWhiteSpace($BuildReason)) {
Write-Host 'Build reason not specified, defaulting to using binary caching in read write mode.'
}
elseif ($BuildReason -eq 'PullRequest') {
Write-Host 'Build reason was Pull Request, using binary caching in read write mode, skipping failures.'
$skipFailuresArg = @('--skip-failures')
}
else {
Write-Host "Build reason was $BuildReason, using binary caching in write only mode."
$binaryCachingMode = 'write'
}
$cachingArgs += @("--binarysource=clear;$BinarySourceStub,$binaryCachingMode")
}
if ($Triplet -eq 'x64-linux') {
$env:HOME = '/home/agent'
$executableExtension = [string]::Empty
}
elseif ($Triplet -eq 'x64-osx') {
$executableExtension = [string]::Empty
}
else {
$executableExtension = '.exe'
}
$failureLogs = Join-Path $ArtifactStagingDirectory 'failure-logs'
$xunitFile = Join-Path $ArtifactStagingDirectory "$Triplet-results.xml"
if ($IsWindows)
{
mkdir empty
cmd /c "robocopy.exe empty `"$buildtreesRoot`" /MIR /NFL /NDL /NC /NP > nul"
cmd /c "robocopy.exe empty `"$packagesRoot`" /MIR /NFL /NDL /NC /NP > nul"
cmd /c "robocopy.exe empty `"$installRoot`" /MIR /NFL /NDL /NC /NP > nul"
rmdir empty
}
& "./vcpkg$executableExtension" x-ci-clean @commonArgs
if ($LASTEXITCODE -ne 0)
{
throw "vcpkg clean failed"
}
$parentHashes = @()
if (($BuildReason -eq 'PullRequest') -and -not $NoParentHashes)
{
# Prefetch tools for better output
foreach ($tool in @('cmake', 'ninja', 'git')) {
& "./vcpkg$executableExtension" fetch $tool
if ($LASTEXITCODE -ne 0)
{
throw "Failed to fetch $tool"
}
}
Write-Host "Determining parent hashes using HEAD~1"
$parentHashesFile = Join-Path $ArtifactStagingDirectory 'parent-hashes.json'
$parentHashes = @("--parent-hashes=$parentHashesFile")
& git revert -n -m 1 HEAD | Out-Null
# The vcpkg.cmake toolchain file is not part of ABI hashing,
# but changes must trigger at least some testing.
Copy-Item "scripts/buildsystems/vcpkg.cmake" -Destination "scripts/test_ports/cmake"
Copy-Item "scripts/buildsystems/vcpkg.cmake" -Destination "scripts/test_ports/cmake-user"
& "./vcpkg$executableExtension" ci "--triplet=$Triplet" --dry-run "--ci-baseline=$PSScriptRoot/../ci.baseline.txt" @commonArgs --no-binarycaching "--output-hashes=$parentHashesFile"
Write-Host "Running CI using parent hashes"
& git reset --hard HEAD
}
# The vcpkg.cmake toolchain file is not part of ABI hashing,
# but changes must trigger at least some testing.
Copy-Item "scripts/buildsystems/vcpkg.cmake" -Destination "scripts/test_ports/cmake"
Copy-Item "scripts/buildsystems/vcpkg.cmake" -Destination "scripts/test_ports/cmake-user"
& "./vcpkg$executableExtension" ci "--triplet=$Triplet" --failure-logs=$failureLogs --x-xunit=$xunitFile "--ci-baseline=$PSScriptRoot/../ci.baseline.txt" @commonArgs @cachingArgs @parentHashes @skipFailuresArg
$failureLogsEmpty = (-Not (Test-Path $failureLogs) -Or ((Get-ChildItem $failureLogs).count -eq 0))
Write-Host "##vso[task.setvariable variable=FAILURE_LOGS_EMPTY]$failureLogsEmpty"
if ($LASTEXITCODE -ne 0)
{
throw "vcpkg ci failed"
}
Write-Host "##vso[task.setvariable variable=XML_RESULTS_FILE]$xunitFile"

View File

@@ -1,4 +0,0 @@
The "unstable" build is used internally by Microsoft to test prerelease versions
of our C++ compiler; not seeing results from these build definitions in the
GitHub portal is normal as these builds depend on acquisition of private
compiler bits that aren't yet shipping.

View File

@@ -1,11 +0,0 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
#
variables:
unstable-pool: 'VcpkgUnstable1ES'
jobs:
- template: job.yml
parameters:
triplet: x64-windows
jobName: x64_windows

View File

@@ -1,76 +0,0 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
#
jobs:
- job: ${{ parameters.jobName }}
pool:
name: $(unstable-pool)
workspace:
clean: resources
timeoutInMinutes: 2880 # 2 days
variables:
- name: WORKING_ROOT
value: D:\
- name: VCPKG_DOWNLOADS
value: D:\downloads
- group: vcpkg-asset-caching-credentials
- name: X_VCPKG_ASSET_SOURCES
value: "x-azurl,$(root-url),$(sas),readwrite"
steps:
- task: DownloadBuildArtifacts@0
displayName: 'Download DropBuildNumber if not specified'
inputs:
buildType: specific
project: '0bdbc590-a062-4c3f-b0f6-9383f67865ee'
pipeline: 16549
buildVersionToDownload: latestFromBranch
branchName: 'refs/heads/$(MSVCBranchName)'
artifactName: BuildNumber
downloadPath: 'D:\msvc-drops'
condition: eq(variables['DropBuildNumber'], '')
- task: PowerShell@2
displayName: 'Set DropBuildNumber if not specified'
inputs:
targetType: inline
script: |
$DropBuildNumber = Get-Content -Path D:\msvc-drops\BuildNumber\Build.BuildNumber.txt
Write-Host "##vso[task.setvariable variable=DropBuildNumber]$DropBuildNumber"
Write-Host "Build Number set to: $DropBuildNumber"
pwsh: true
condition: eq(variables['DropBuildNumber'], '')
- task: ms-vscs-artifact.build-tasks.artifactDropDownloadTask-1.artifactDropDownloadTask@0
displayName: 'Download msvc x86 ret'
inputs:
dropServiceURI: 'https://devdiv.artifacts.visualstudio.com/DefaultCollection'
buildNumber: 'msvc/builds/$(DropBuildNumber)/x86ret'
destinationPath: 'D:\msvc-drops\$(DropBuildNumber)\binaries.x86ret'
- task: ms-vscs-artifact.build-tasks.artifactDropDownloadTask-1.artifactDropDownloadTask@0
displayName: 'Download msvc amd64 ret'
inputs:
dropServiceURI: 'https://devdiv.artifacts.visualstudio.com/DefaultCollection'
buildNumber: 'msvc/builds/$(DropBuildNumber)/amd64ret'
destinationPath: 'D:\msvc-drops\$(DropBuildNumber)\binaries.amd64ret'
- task: PowerShell@2
displayName: 'Rearrange MSVC Drop Layout'
inputs:
targetType: filePath
filePath: 'scripts/azure-pipelines/windows-unstable/rearrange-msvc-drop-layout.ps1'
arguments: '-DropRoot "D:\msvc-drops\$(DropBuildNumber)" -BuildType ret'
pwsh: true
- script: .\bootstrap-vcpkg.bat
displayName: 'Bootstrap vcpkg'
- task: PowerShell@2
displayName: '*** Test Modified Ports'
inputs:
failOnStderr: true
filePath: 'scripts/azure-pipelines/test-modified-ports.ps1'
arguments: '-Triplet ${{ parameters.triplet }} -BuildReason $(Build.Reason) -WorkingRoot ${{ variables.WORKING_ROOT }} -ArtifactStagingDirectory $(Build.ArtifactStagingDirectory) -PassingIsPassing'
pwsh: true
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: failure logs for ${{ parameters.triplet }}'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)\failure-logs'
ArtifactName: 'failure logs for ${{ parameters.triplet }}'
condition: ne(variables['FAILURE_LOGS_EMPTY'], 'True')

View File

@@ -1,75 +0,0 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
#
<#
.SYNOPSIS
Moves files from an MSVC compiler drop to the locations where they are installed in a Visual Studio installation.
.PARAMETER DropRoot
The location where the MSVC compiler drop has been downloaded.
.PARAMETER BuildType
The MSVC drop build type set with /p:_BuildType when MSVC was built. Defaults to 'ret'.
#>
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)][string]$DropRoot,
[Parameter(Mandatory = $false)][ValidateSet('ret', 'chk')][string]$BuildType = 'ret'
)
Set-StrictMode -Version Latest
$MSVCRoot = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC"
$ErrorActionPreference = "Stop"
$tempRoot = "$DropRoot\readytodeploy"
New-Item -ItemType Directory -Path $tempRoot | Out-Null
Write-Host "Rearranging x86$BuildType"
New-Item -ItemType Directory -Path "$tempRoot\bin\HostX86" | Out-Null
Move-Item "$DropRoot\binaries.x86$BuildType\bin\i386" "$tempRoot\bin\HostX86\x86"
Move-Item "$DropRoot\binaries.x86$BuildType\bin\x86_amd64" "$tempRoot\bin\HostX86\x64"
Move-Item "$DropRoot\binaries.x86$BuildType\bin\x86_arm" "$tempRoot\bin\HostX86\arm"
Write-Host "Rearranging amd64$BuildType"
New-Item -ItemType Directory -Path "$tempRoot\bin\HostX64" | Out-Null
Move-Item "$DropRoot\binaries.amd64$BuildType\bin\amd64" "$tempRoot\bin\HostX64\x64"
Move-Item "$DropRoot\binaries.amd64$BuildType\bin\amd64_x86" "$tempRoot\bin\HostX64\x86"
Move-Item "$DropRoot\binaries.amd64$BuildType\bin\amd64_arm" "$tempRoot\bin\HostX64\arm"
# Only copy files and directories that already exist in the VS installation.
Write-Host "Rearranging inc, lib"
New-Item -ItemType Directory -Path "$tempRoot\lib" | Out-Null
Move-Item "$DropRoot\binaries.x86$BuildType\inc" "$tempRoot\include"
Move-Item "$DropRoot\binaries.x86$BuildType\lib\i386" "$tempRoot\lib\x86"
Move-Item "$DropRoot\binaries.amd64$BuildType\lib\amd64" "$tempRoot\lib\x64"
Write-Host "Rearranging atlmfc"
New-Item -ItemType Directory -Path "$tempRoot\atlmfc" | Out-Null
New-Item -ItemType Directory -Path "$tempRoot\atlmfc\lib" | Out-Null
Move-Item "$DropRoot\binaries.x86$BuildType\atlmfc\include" "$tempRoot\atlmfc\include"
Move-Item "$DropRoot\binaries.x86$BuildType\atlmfc\lib\i386" "$tempRoot\atlmfc\lib\x86"
Move-Item "$DropRoot\binaries.amd64$BuildType\atlmfc\lib\amd64" "$tempRoot\atlmfc\lib\x64"
[string[]]$toolsets = Get-ChildItem -Path $MSVCRoot -Directory | Sort-Object -Descending
if ($toolsets.Length -eq 0) {
throw "Could not find Visual Studio toolset!"
}
Write-Host "Found toolsets:`n$($toolsets -join `"`n`")`n"
$selectedToolset = $toolsets[0]
Write-Host "Using toolset: $selectedToolset"
for ($idx = 1; $idx -lt $toolsets.Length; $idx++) {
$badToolset = $toolsets[$idx]
Write-Host "Deleting toolset: $badToolset"
Remove-Item $badToolset -Recurse -Force
}
Write-Host "Deploying $tempRoot => $selectedToolset"
Copy-Item "$tempRoot\*" $selectedToolset -Recurse -Force
Write-Host "Deleting $DropRoot..."
Remove-Item $DropRoot -Recurse -Force
Write-Host "Done!"

View File

@@ -1,107 +0,0 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
#
parameters:
- name: vcpkgToolSha
displayName: 'Custom SHA of vcpkg-tool to use rather than bootstrap'
type: string
default: 'use default'
- name: triplet
type: string
default: 'x86-windows'
- name: jobName
type: string
default: 'x86_windows'
- name: poolName
type: string
jobs:
- job: ${{ parameters.jobName }}
pool:
name: ${{ parameters.poolName }}
workspace:
clean: resources
timeoutInMinutes: 2880 # 2 days
variables:
- name: WORKING_ROOT
value: D:\
- name: VCPKG_DOWNLOADS
value: D:\downloads
- name: DiffFile
value: $(Build.ArtifactStagingDirectory)\format.diff
- name: ExtraChecksTriplet
value: x86-windows
- group: vcpkg-asset-caching-credentials
- name: X_VCPKG_ASSET_SOURCES
value: "x-azurl,$(root-url-ea),$(sas-ea),readwrite"
- group: vcpkg-binary-caching-credentials
- name: X_VCPKG_BINARY_SOURCE_STUB
value: "x-azblob,$(root-bin-url-ea),$(sas-bin-ea)"
steps:
- script: .\bootstrap-vcpkg.bat
displayName: 'Bootstrap vcpkg'
condition: eq('use default', '${{ parameters.vcpkgToolSha }}')
- script: .\scripts\azure-pipelines\windows\bootstrap-from-source.cmd ${{ parameters.vcpkgToolSha }}
displayName: "Build vcpkg with CMake"
condition: ne('use default', '${{ parameters.vcpkgToolSha }}')
- script: '.\vcpkg.exe format-manifest --all'
displayName: 'Format Manifests'
condition: eq('${{ parameters.triplet }}', '${{ variables.ExtraChecksTriplet }}')
- task: Powershell@2
displayName: 'Create Diff'
condition: eq('${{ parameters.triplet }}', '${{ variables.ExtraChecksTriplet }}')
inputs:
filePath: scripts/azure-pipelines/Create-PRDiff.ps1
arguments: "-DiffFile '$(DiffFile)'"
pwsh: true
- task: PublishBuildArtifacts@1
displayName: 'Publish Format and Documentation Diff'
condition: and(eq('${{ parameters.triplet }}', '${{ variables.ExtraChecksTriplet }}'), failed())
inputs:
PathtoPublish: '$(DiffFile)'
ArtifactName: 'format.diff'
- task: PowerShell@2
displayName: '*** Test Modified Ports'
inputs:
failOnStderr: true
filePath: 'scripts/azure-pipelines/test-modified-ports.ps1'
arguments: '-Triplet ${{ parameters.triplet }} -BuildReason $(Build.Reason) -BinarySourceStub "$(X_VCPKG_BINARY_SOURCE_STUB)" -WorkingRoot ${{ variables.WORKING_ROOT }} -ArtifactStagingDirectory $(Build.ArtifactStagingDirectory)'
pwsh: true
- task: PowerShell@2
displayName: 'Validate version files'
condition: eq('${{ parameters.triplet }}', '${{ variables.ExtraChecksTriplet }}')
inputs:
filePath: 'scripts/azure-pipelines/windows/validate-version-files.ps1'
pwsh: true
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: failure logs for ${{ parameters.triplet }}'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)\failure-logs'
ArtifactName: 'failure logs for ${{ parameters.triplet }}'
condition: ne(variables['FAILURE_LOGS_EMPTY'], 'True')
- task: PowerShell@2
displayName: 'Build a file list for all packages'
condition: always()
inputs:
targetType: inline
script: |
./vcpkg.exe fetch python3
& $(.\vcpkg fetch python3) .\scripts\file_script.py D:\installed\vcpkg\info\
pwsh: true
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: file lists for ${{ parameters.triplet }}'
condition: always()
inputs:
PathtoPublish: scripts/list_files
ArtifactName: 'file lists for ${{ parameters.triplet }}'
- task: PublishTestResults@2
displayName: 'Publish Test Results'
condition: ne(variables['XML_RESULTS_FILE'], '')
inputs:
testRunTitle: ${{ parameters.triplet }}
testResultsFormat: xUnit
testResultsFiles: $(XML_RESULTS_FILE)
platform: ${{ parameters.triplet }}

View File

@@ -1,7 +0,0 @@
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=x86 -host_arch=x86
git clone https://github.com/microsoft/vcpkg-tool vcpkg-tool
git -C vcpkg-tool switch -d %1
rmdir /s /q build.x86.release > nul 2> nul
cmake.exe -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DVCPKG_DEVELOPMENT_WARNINGS=OFF -DVCPKG_WARNINGS_AS_ERRORS=OFF -DVCPKG_BUILD_FUZZING=OFF -DVCPKG_BUILD_TLS12_DOWNLOADER=OFF -B build.x86.release -S vcpkg-tool
ninja.exe -C build.x86.release
move build.x86.release\vcpkg.exe vcpkg.exe

View File

@@ -1,271 +0,0 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
#
<#
.SYNOPSIS
Creates a Windows virtual machine image, set up for vcpkg's CI.
.DESCRIPTION
create-image.ps1 creates an Azure Windows VM image, set up for vcpkg's CI system.
This script assumes you have installed Azure tools into PowerShell by following the instructions
at https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-3.6.1
or are running from Azure Cloud Shell.
#>
$Location = 'eastasia'
$Prefix = 'Win-'
$Prefix += (Get-Date -Format 'yyyy-MM-dd')
$VMSize = 'Standard_D8a_v4'
$ProtoVMName = 'PROTOTYPE'
$WindowsServerSku = '2022-datacenter'
$ErrorActionPreference = 'Stop'
$CudnnBaseUrl = 'https://vcpkgimageminting.blob.core.windows.net/assets/cudnn-windows-x86_64-8.3.2.44_cuda11.5-archive.zip'
$ProgressActivity = 'Creating Windows Image'
$TotalProgress = 18
$CurrentProgress = 1
Import-Module "$PSScriptRoot/../create-vmss-helpers.psm1" -DisableNameChecking
####################################################################################################
Write-Progress `
-Activity $ProgressActivity `
-Status 'Creating resource group' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)
$ResourceGroupName = Find-ResourceGroupName $Prefix
$AdminPW = New-Password
New-AzResourceGroup -Name $ResourceGroupName -Location $Location
$AdminPWSecure = ConvertTo-SecureString $AdminPW -AsPlainText -Force
$Credential = New-Object System.Management.Automation.PSCredential ("AdminUser", $AdminPWSecure)
####################################################################################################
Write-Progress `
-Activity $ProgressActivity `
-Status 'Creating virtual network' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)
$VirtualNetwork = Create-LockedDownNetwork -ResourceGroupName $ResourceGroupName -Location $Location
####################################################################################################
Write-Progress `
-Activity $ProgressActivity `
-Status 'Creating prototype VM' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)
$NicName = $ResourceGroupName + 'NIC'
$Nic = New-AzNetworkInterface `
-Name $NicName `
-ResourceGroupName $ResourceGroupName `
-Location $Location `
-Subnet $VirtualNetwork.Subnets[0]
$VM = New-AzVMConfig -Name $ProtoVMName -VMSize $VMSize -Priority 'Spot' -MaxPrice -1
$VM = Set-AzVMOperatingSystem `
-VM $VM `
-Windows `
-ComputerName $ProtoVMName `
-Credential $Credential `
-ProvisionVMAgent
$VM = Add-AzVMNetworkInterface -VM $VM -Id $Nic.Id
$VM = Set-AzVMSourceImage `
-VM $VM `
-PublisherName 'MicrosoftWindowsServer' `
-Offer 'WindowsServer' `
-Skus $WindowsServerSku `
-Version latest
$VM = Set-AzVMBootDiagnostic -VM $VM -Disable
New-AzVm `
-ResourceGroupName $ResourceGroupName `
-Location $Location `
-VM $VM
####################################################################################################
Write-Progress `
-Activity $ProgressActivity `
-Status 'Running provisioning script deploy-tlssettings.ps1 in VM' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)
$ProvisionImageResult = Invoke-AzVMRunCommandWithRetries `
-ResourceGroupName $ResourceGroupName `
-VMName $ProtoVMName `
-CommandId 'RunPowerShellScript' `
-ScriptPath "$PSScriptRoot\deploy-tlssettings.ps1"
Write-Host "deploy-tlssettings.ps1 output: $($ProvisionImageResult.value.Message)"
Write-Host 'Waiting 1 minute for VM to reboot...'
Start-Sleep -Seconds 60
####################################################################################################
Write-Progress `
-Activity $ProgressActivity `
-Status 'Running provisioning script deploy-psexec.ps1 in VM' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)
$DeployPsExecResult = Invoke-AzVMRunCommandWithRetries `
-ResourceGroupName $ResourceGroupName `
-VMName $ProtoVMName `
-CommandId 'RunPowerShellScript' `
-ScriptPath "$PSScriptRoot\deploy-psexec.ps1"
Write-Host "deploy-psexec.ps1 output: $($DeployPsExecResult.value.Message)"
####################################################################################################
function Invoke-ScriptWithPrefix {
param(
[string]$ScriptName,
[switch]$AddAdminPw,
[string]$CudnnUrl
)
Write-Progress `
-Activity $ProgressActivity `
-Status "Running provisioning script $ScriptName in VM" `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)
$DropToAdminUserPrefix = Get-Content "$PSScriptRoot\drop-to-admin-user-prefix.ps1" -Encoding utf8NoBOM -Raw
$UtilityPrefixContent = Get-Content "$PSScriptRoot\utility-prefix.ps1" -Encoding utf8NoBOM -Raw
$tempScriptFilename = [System.IO.Path]::GetTempPath() + [System.IO.Path]::GetRandomFileName() + ".txt"
try {
$script = Get-Content "$PSScriptRoot\$ScriptName" -Encoding utf8NoBOM -Raw
if ($AddAdminPw) {
$script = $script.Replace('# REPLACE WITH DROP-TO-ADMIN-USER-PREFIX.ps1', $DropToAdminUserPrefix)
}
if (-Not ([string]::IsNullOrWhiteSpace($CudnnUrl))) {
$script = $script.Replace('# REPLACE WITH $CudnnUrl', "`$CudnnUrl = '$CudnnUrl'")
}
$script = $script.Replace('# REPLACE WITH UTILITY-PREFIX.ps1', $UtilityPrefixContent);
Set-Content -Path $tempScriptFilename -Value $script -Encoding utf8NoBOM
$parameter = $null
if ($AddAdminPw) {
$parameter = @{AdminUserPassword = $AdminPW;}
}
$InvokeResult = Invoke-AzVMRunCommandWithRetries `
-ResourceGroupName $ResourceGroupName `
-VMName $ProtoVMName `
-CommandId 'RunPowerShellScript' `
-ScriptPath $tempScriptFilename `
-Parameter $parameter
Write-Host "$ScriptName output: $($InvokeResult.value.Message)"
} finally {
Remove-Item $tempScriptFilename -Force
}
}
Invoke-ScriptWithPrefix -ScriptName 'deploy-windows-sdks.ps1' -AddAdminPw
####################################################################################################
Invoke-ScriptWithPrefix -ScriptName 'deploy-visual-studio.ps1' -AddAdminPw
####################################################################################################
Invoke-ScriptWithPrefix -ScriptName 'deploy-mpi.ps1' -AddAdminPw
####################################################################################################
$StorageAccountKeys = Get-AzStorageAccountKey `
-ResourceGroupName 'vcpkg-image-minting' `
-Name 'vcpkgimageminting'
$StorageContext = New-AzStorageContext `
-StorageAccountName 'vcpkgimageminting' `
-StorageAccountKey $StorageAccountKeys[0].Value
$StartTime = [DateTime]::Now
$ExpiryTime = $StartTime.AddDays(1)
$SetupSasToken = New-AzStorageAccountSASToken `
-Service Blob `
-Permission "r" `
-Context $StorageContext `
-StartTime $StartTime `
-ExpiryTime $ExpiryTime `
-ResourceType Object `
-Protocol HttpsOnly
Invoke-ScriptWithPrefix -ScriptName 'deploy-cuda.ps1' -AddAdminPw -CudnnUrl ($CudnnBaseUrl + $SetupSasToken)
####################################################################################################
Invoke-ScriptWithPrefix -ScriptName 'deploy-inteloneapi.ps1' -AddAdminPw
####################################################################################################
Invoke-ScriptWithPrefix -ScriptName 'deploy-pwsh.ps1' -AddAdminPw
####################################################################################################
Write-Progress `
-Activity $ProgressActivity `
-Status 'Running provisioning script deploy-settings.txt (as a .ps1) in VM' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)
$ProvisionImageResult = Invoke-AzVMRunCommandWithRetries `
-ResourceGroupName $ResourceGroupName `
-VMName $ProtoVMName `
-CommandId 'RunPowerShellScript' `
-ScriptPath "$PSScriptRoot\deploy-settings.txt"
Write-Host "deploy-settings.txt output: $($ProvisionImageResult.value.Message)"
Restart-AzVM -ResourceGroupName $ResourceGroupName -Name $ProtoVMName
####################################################################################################
Write-Progress `
-Activity $ProgressActivity `
-Status 'Running provisioning script sysprep.ps1 in VM' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)
$SysprepResult = Invoke-AzVMRunCommandWithRetries `
-ResourceGroupName $ResourceGroupName `
-VMName $ProtoVMName `
-CommandId 'RunPowerShellScript' `
-ScriptPath "$PSScriptRoot\sysprep.ps1"
Write-Host "sysprep.ps1 output: $($SysprepResult.value.Message)"
####################################################################################################
Write-Progress `
-Activity $ProgressActivity `
-Status 'Waiting for VM to shut down' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)
Wait-Shutdown -ResourceGroupName $ResourceGroupName -Name $ProtoVMName
####################################################################################################
Write-Progress `
-Activity $ProgressActivity `
-Status 'Converting VM to Image' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)
Stop-AzVM `
-ResourceGroupName $ResourceGroupName `
-Name $ProtoVMName `
-Force
Set-AzVM `
-ResourceGroupName $ResourceGroupName `
-Name $ProtoVMName `
-Generalized
$VM = Get-AzVM -ResourceGroupName $ResourceGroupName -Name $ProtoVMName
$ImageConfig = New-AzImageConfig -Location $Location -SourceVirtualMachineId $VM.ID
$ImageName = Find-ImageName -ResourceGroupName 'vcpkg-image-minting' -Prefix $Prefix
New-AzImage -Image $ImageConfig -ImageName $ImageName -ResourceGroupName 'vcpkg-image-minting'
####################################################################################################
Write-Progress `
-Activity $ProgressActivity `
-Status 'Deleting unused temporary resources' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)
Remove-AzResourceGroup $ResourceGroupName -Force
####################################################################################################
Write-Progress -Activity $ProgressActivity -Completed
Write-Host "Generated Image: $ImageName"
Write-Host 'Finished!'

View File

@@ -1,94 +0,0 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
#
<#
.SYNOPSIS
Creates a Windows virtual machine scale set, set up for vcpkg's CI.
.DESCRIPTION
create-vmss.ps1 creates an Azure Windows VM scale set, set up for vcpkg's CI
system. See https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/overview
for more information.
This script assumes you have installed Azure tools into PowerShell by following the instructions
at https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-3.6.1
or are running from Azure Cloud Shell.
.PARAMETER ImageName
The name of the image to deploy into the scale set.
#>
[CmdLetBinding()]
Param(
[parameter(Mandatory=$true)]
[string]$ImageName
)
$Location = 'eastasia'
$Prefix = 'PrWin-'
$Prefix += (Get-Date -Format 'yyyy-MM-dd')
$VMSize = 'Standard_D32a_v4'
$LiveVMPrefix = 'BUILD'
$ErrorActionPreference = 'Stop'
Import-Module "$PSScriptRoot/../create-vmss-helpers.psm1" -DisableNameChecking
$ResourceGroupName = Find-ResourceGroupName $Prefix
$AdminPW = New-Password
$Image = Get-AzImage -ResourceGroupName 'vcpkg-image-minting' -ImageName $ImageName
New-AzResourceGroup -Name $ResourceGroupName -Location $Location
$VirtualNetwork = Create-LockedDownNetwork -ResourceGroupName $ResourceGroupName -Location $Location
$VmssIpConfigName = $ResourceGroupName + 'VmssIpConfig'
$VmssIpConfig = New-AzVmssIpConfig -SubnetId $VirtualNetwork.Subnets[0].Id -Primary -Name $VmssIpConfigName
$VmssName = $ResourceGroupName + 'Vmss'
$Vmss = New-AzVmssConfig `
-Location $Location `
-SkuCapacity 0 `
-SkuName $VMSize `
-SkuTier 'Standard' `
-Overprovision $false `
-UpgradePolicyMode Manual `
-EvictionPolicy Delete `
-Priority Spot `
-MaxPrice -1
$NicName = $ResourceGroupName + 'NIC'
New-AzNetworkInterface `
-Name $NicName `
-ResourceGroupName $ResourceGroupName `
-Location $Location `
-Subnet $VirtualNetwork.Subnets[0]
$Vmss = Add-AzVmssNetworkInterfaceConfiguration `
-VirtualMachineScaleSet $Vmss `
-Primary $true `
-IpConfiguration $VmssIpConfig `
-NetworkSecurityGroupId $VirtualNetwork.Subnets[0].NetworkSecurityGroup.Id `
-Name $NicName
$Vmss = Set-AzVmssOsProfile `
-VirtualMachineScaleSet $Vmss `
-ComputerNamePrefix $LiveVMPrefix `
-AdminUsername 'AdminUser' `
-AdminPassword $AdminPW `
-WindowsConfigurationProvisionVMAgent $true `
-WindowsConfigurationEnableAutomaticUpdate $false
$Vmss = Set-AzVmssStorageProfile `
-VirtualMachineScaleSet $Vmss `
-OsDiskCreateOption 'FromImage' `
-OsDiskCaching ReadOnly `
-DiffDiskSetting Local `
-ImageReferenceId $Image.Id
New-AzVmss `
-ResourceGroupName $ResourceGroupName `
-Name $VmssName `
-VirtualMachineScaleSet $Vmss
Write-Host "Location: $Location"
Write-Host "Resource group name: $ResourceGroupName"
Write-Host 'Finished!'

View File

@@ -1,62 +0,0 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
# REPLACE WITH DROP-TO-ADMIN-USER-PREFIX.ps1
# REPLACE WITH UTILITY-PREFIX.ps1
# REPLACE WITH $CudnnUrl
$CudnnLocalZipPath = "$PSScriptRoot\cudnn-windows-x86_64-8.3.2.44_cuda11.5-archive.zip"
$CudaUrl = 'https://developer.download.nvidia.com/compute/cuda/11.6.0/network_installers/cuda_11.6.0_windows_network.exe'
$CudaFeatures = 'nvcc_11.6 cuobjdump_11.6 nvprune_11.6 cupti_11.6 memcheck_11.6 nvdisasm_11.6 nvprof_11.6 ' + `
'visual_studio_integration_11.6 visual_profiler_11.6 visual_profiler_11.6 cublas_11.6 cublas_dev_11.6 ' + `
'cudart_11.6 cufft_11.6 cufft_dev_11.6 curand_11.6 curand_dev_11.6 cusolver_11.6 cusolver_dev_11.6 ' + `
'cusparse_11.6 cusparse_dev_11.6 npp_11.6 npp_dev_11.6 nvrtc_11.6 nvrtc_dev_11.6 nvml_dev_11.6 ' + `
'occupancy_calculator_11.6 thrust_11.6 '
$destination = "$env:ProgramFiles\NVIDIA GPU Computing Toolkit\CUDA\v11.6"
try {
Write-Host 'Downloading CUDA...'
[string]$installerPath = Get-TempFilePath -Extension 'exe'
curl.exe -L -o $installerPath -s -S $CudaUrl
Write-Host 'Installing CUDA...'
$proc = Start-Process -FilePath $installerPath -ArgumentList @('-s ' + $CudaFeatures) -Wait -PassThru
$exitCode = $proc.ExitCode
if ($exitCode -eq 0) {
Write-Host 'Installation successful!'
}
else {
Write-Error "Installation failed! Exited with $exitCode."
throw
}
}
catch {
Write-Error "Failed to install CUDA! $($_.Exception.Message)"
throw
}
try {
if ([string]::IsNullOrWhiteSpace($CudnnUrl)) {
if (-Not (Test-Path $CudnnLocalZipPath)) {
throw "CUDNN zip ($CudnnLocalZipPath) was missing, please download from NVidia and place next to this script."
}
$cudnnZipPath = $CudnnLocalZipPath
} else {
Write-Host 'Downloading CUDNN...'
$cudnnZipPath = Get-TempFilePath -Extension 'zip'
curl.exe -L -o $cudnnZipPath -s -S $CudnnUrl
}
Write-Host "Installing CUDNN to $destination..."
tar.exe -xvf "$cudnnZipPath" --strip 1 --directory "$destination"
Write-Host 'Installation successful!'
}
catch {
Write-Error "Failed to install CUDNN! $($_.Exception.Message)"
throw
}

View File

@@ -1,60 +0,0 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
# REPLACE WITH UTILITY-PREFIX.ps1
<#
.SYNOPSIS
Partitions a new physical disk.
.DESCRIPTION
Takes the disk $DiskNumber, turns it on, then partitions it for use with label
$Label and drive letter $Letter.
.PARAMETER DiskNumber
The number of the disk to set up.
.PARAMETER Letter
The drive letter at which to mount the disk.
.PARAMETER Label
The label to give the disk.
#>
Function New-PhysicalDisk {
Param(
[int]$DiskNumber,
[string]$Letter,
[string]$Label
)
if ($Letter.Length -ne 1) {
throw "Bad drive letter $Letter, expected only one letter. (Did you accidentially add a : ?)"
}
try {
Write-Host "Attempting to online physical disk $DiskNumber"
[string]$diskpartScriptPath = Get-TempFilePath -Extension 'txt'
[string]$diskpartScriptContent =
"SELECT DISK $DiskNumber`r`n" +
"ONLINE DISK`r`n"
Write-Host "Writing diskpart script to $diskpartScriptPath with content:"
Write-Host $diskpartScriptContent
Set-Content -Path $diskpartScriptPath -Value $diskpartScriptContent
Write-Host 'Invoking DISKPART...'
& diskpart.exe /s $diskpartScriptPath
Write-Host "Provisioning physical disk $DiskNumber as drive $Letter"
[string]$diskpartScriptContent =
"SELECT DISK $DiskNumber`r`n" +
"ATTRIBUTES DISK CLEAR READONLY`r`n" +
"CREATE PARTITION PRIMARY`r`n" +
"FORMAT FS=NTFS LABEL=`"$Label`" QUICK`r`n" +
"ASSIGN LETTER=$Letter`r`n"
Write-Host "Writing diskpart script to $diskpartScriptPath with content:"
Write-Host $diskpartScriptContent
Set-Content -Path $diskpartScriptPath -Value $diskpartScriptContent
Write-Host 'Invoking DISKPART...'
& diskpart.exe /s $diskpartScriptPath
}
catch {
Write-Error "Failed to provision physical disk $DiskNumber as drive $Letter! $($_.Exception.Message)"
}
}
New-PhysicalDisk -DiskNumber 1 -Letter 'E' -Label 'install disk'

View File

@@ -1,74 +0,0 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
# REPLACE WITH DROP-TO-ADMIN-USER-PREFIX.ps1
# REPLACE WITH UTILITY-PREFIX.ps1
# Seems like only the HPC kit is really needed?
#$oneAPIBaseUrl = 'https://registrationcenter-download.intel.com/akdlm/irc_nas/17768/w_BaseKit_p_2021.2.0.2871_offline.exe'
$oneAPIHPCUrl = 'https://registrationcenter-download.intel.com/akdlm/irc_nas/18578/w_HPCKit_p_2022.1.3.145_offline.exe'
# Possible oneAPI Base components:
#intel.oneapi.win.vtune 2021.1.1-68 true Intel® VTune(TM) Profiler
#intel.oneapi.win.tbb.devel 2021.1.1-133 true Intel® oneAPI Threading Building Blocks
#intel.oneapi.win.dnnl 2021.1.1-44 true Intel® oneAPI Deep Neural Network Library
#intel.oneapi.win.mkl.devel 2021.1.1-52 true Intel® oneAPI Math Kernel Library
#intel.oneapi.win.vpl 2021.1.1-76 true Intel® oneAPI Video Processing Library
#intel.oneapi.win.dpcpp_debugger 10.0.0-2213 true Intel® Distribution for GDB*
#intel.oneapi.win.ipp.devel 2021.1.1-47 true Intel® Integrated Performance Primitives
#intel.oneapi.win.ippcp 2021.1.1-53 true Intel® Integrated Performance Primitives Cryptography
#intel.oneapi.win.dpcpp-compiler 2021.1.1-191 true Intel® oneAPI DPC++/C++ Compiler
#intel.oneapi.win.dpcpp-library 2021.1.1-191 true Intel® oneAPI DPC++ Library
#intel.oneapi.win.dpcpp_ct.common 2021.1.1-54 true Intel® DPC++ Compatibility Tool
#intel.oneapi.win.dal.devel 2021.1.1-71 true Intel® oneAPI Data Analytics Library
#intel.oneapi.win.python3 2021.1.1-46 true Intel® Distribution for Python*
#intel.oneapi.win.advisor 2021.1.1-53 true Intel® Advisor
#$oneAPIBaseComponents = 'intel.oneapi.win.dpcpp-compiler:intel.oneapi.win.dpcpp-library:intel.oneapi.win.mkl.devel:intel.oneapi.win.ipp.devel:intel.oneapi.win.ippcp:intel.oneapi.win.dal.devel:intel.oneapi.win.dnnl:intel.oneapi.win.vpl:intel.oneapi.win.tbb.devel'
$oneAPIHPCComponents = 'intel.oneapi.win.cpp-compiler:intel.oneapi.win.ifort-compiler'
<#
.SYNOPSIS
Installs Intel oneAPI compilers and toolsets. Examples for CI can be found here: https://github.com/oneapi-src/oneapi-ci
.DESCRIPTION
InstallInteloneAPI installs the Intel oneAPI Compiler & Toolkit with the components specified as a
:-separated list of strings in $Components.
.PARAMETER Url
The URL of the Intel Toolkit installer.
.PARAMETER Components
A :-separated list of components to install.
#>
Function InstallInteloneAPI {
Param(
[String]$Url,
[String]$Components
)
try {
[string]$installerPath = Get-TempFilePath -Extension 'exe'
[string]$extractionPath = [System.IO.Path]::GetTempPath() + [System.IO.Path]::GetRandomFileName()
Write-Host 'Downloading Intel oneAPI...to: ' $installerPath
curl.exe -L -o $installerPath -s -S $Url
Write-Host 'Extracting Intel oneAPI...to folder: ' $extractionPath
$proc = Start-Process -FilePath $installerPath -ArgumentList @('-s ', '-x ', '-f ' + $extractionPath , '--log extract.log') -Wait -PassThru
Write-Host 'Install Intel oneAPI...from folder: ' $extractionPath
$proc = Start-Process -FilePath $extractionPath/bootstrapper.exe -ArgumentList @('-s ', '--action install', "--components=$Components" , '--eula=accept', '-p=NEED_VS2017_INTEGRATION=0', '-p=NEED_VS2019_INTEGRATION=0', '-p=NEED_VS2022_INTEGRATION=0', '--log-dir=.') -Wait -PassThru
$exitCode = $proc.ExitCode
if ($exitCode -eq 0) {
Write-Host 'Installation successful!'
}
else {
Write-Error "Installation failed! Exited with $exitCode."
throw
}
}
catch {
Write-Error "Failed to install Intel oneAPI! $($_.Exception.Message)"
throw
}
}
InstallInteloneAPI -Url $oneAPIHPCUrl -Components $oneAPIHPCComponents

View File

@@ -1,47 +0,0 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
# REPLACE WITH DROP-TO-ADMIN-USER-PREFIX.ps1
# REPLACE WITH UTILITY-PREFIX.ps1
$MpiUrl = 'https://download.microsoft.com/download/a/5/2/a5207ca5-1203-491a-8fb8-906fd68ae623/msmpisetup.exe'
<#
.SYNOPSIS
Installs MPI
.DESCRIPTION
Downloads the MPI installer located at $Url, and installs it with the
correct flags.
.PARAMETER Url
The URL of the installer.
#>
Function InstallMpi {
Param(
[String]$Url
)
try {
Write-Host 'Downloading MPI...'
[string]$installerPath = Get-TempFilePath -Extension 'exe'
curl.exe -L -o $installerPath -s -S $Url
Write-Host 'Installing MPI...'
$proc = Start-Process -FilePath $installerPath -ArgumentList @('-force', '-unattend') -Wait -PassThru
$exitCode = $proc.ExitCode
if ($exitCode -eq 0) {
Write-Host 'Installation successful!'
}
else {
Write-Error "Installation failed! Exited with $exitCode."
throw
}
}
catch {
Write-Error "Failed to install MPI! $($_.Exception.Message)"
throw
}
}
InstallMpi -Url $MpiUrl

View File

@@ -1,8 +0,0 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue'
$PsExecPath = 'C:\PsExec64.exe'
Write-Host "Downloading psexec to: $PsExecPath"
& curl.exe -L -o $PsExecPath -s -S https://live.sysinternals.com/PsExec64.exe

View File

@@ -1,9 +0,0 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
# REPLACE WITH DROP-TO-ADMIN-USER-PREFIX.ps1
# REPLACE WITH UTILITY-PREFIX.ps1
$PwshUrl = 'https://github.com/PowerShell/PowerShell/releases/download/v7.2.3/PowerShell-7.2.3-win-x64.msi'
InstallMSI -Url $PwshUrl -Name 'PowerShell Core'

View File

@@ -1,21 +0,0 @@
$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue'
Write-Host 'Disabling pagefile...'
wmic computersystem set AutomaticManagedPagefile=False
wmic pagefileset delete
$av = Get-Command Add-MPPreference -ErrorAction SilentlyContinue
if ($null -eq $av) {
Write-Host 'AntiVirus not installed, skipping exclusions.'
} else {
Write-Host 'Configuring AntiVirus exclusions...'
Add-MpPreference -ExclusionPath C:\agent
Add-MPPreference -ExclusionPath D:\
Add-MPPreference -ExclusionPath E:\
Add-MPPreference -ExclusionProcess ninja.exe
Add-MPPreference -ExclusionProcess clang-cl.exe
Add-MPPreference -ExclusionProcess cl.exe
Add-MPPreference -ExclusionProcess link.exe
Add-MPPreference -ExclusionProcess python.exe
}

View File

@@ -1,738 +0,0 @@
#***************************************************************************************************************
# This script supports the TLS 1.2 everywhere project
# It does the following:
# * By default it disables TLS 1.O, TLS 1.1, SSLv2, SSLv3 and Enables TLS1.2
# * The CipherSuite order is set to the SDL approved version.
# * The FIPS MinEncryptionLevel is set to 3.
# * RC4 is disabled
# * A log with a transcript of all actions taken is generated
#***************************************************************************************************************
#************************************************ SCRIPT USAGE ************************************************
# .\TLSSettings.ps1
# -SetCipherOrder : Excellence/Min-Bar, default(Excellence), use B to set Min-Bar. (Min-Bar ordering prefers ciphers with smaller key sizes to improve performance over security)
# -RebootIfRequired : $true/$false, default($true), use $false to disable auto-reboot (Settings won't take effect until a reboot is completed)
# -EnableOlderTlsVersions : $true/$false, default($false), use $true to explicitly Enable TLS1.0, TLS1.1
#***************************************************************************************************************
#***************************TEAM CAN DETERMINE WHAT CIPHER SUITE ORDER IS CHOSEN ******************************
# Option B provides the min-bar configuration (small trade-off: performance over security)
# Syntax: .\TLSSettings.ps1 -SetCipherOrder B
# if no option is supplied, you will get the opportunity for excellence cipher order (small trade-off: security over performance)
# Syntax: .\TLSSettings.ps1
#***************************************************************************************************************
param (
[string]$SetCipherOrder = " ",
[bool]$RebootIfRequired = $true,
[bool]$EnableOlderTlsVersions = $false
)
#******************* FUNCTION THAT ACTUALLY UPDATES KEYS; WILL RETURN REBOOT FLAG IF CHANGES ***********************
Function Set-CryptoSetting {
param (
$regKeyName,
$value,
$valuedata,
$valuetype
)
$restart = $false
# Check for existence of registry key, and create if it does not exist
If (!(Test-Path -Path $regKeyName)) {
New-Item $regKeyName | Out-Null
}
# Get data of registry value, or null if it does not exist
$val = (Get-ItemProperty -Path $regKeyName -Name $value -ErrorAction SilentlyContinue).$value
If ($val -eq $null) {
# Value does not exist - create and set to desired value
New-ItemProperty -Path $regKeyName -Name $value -Value $valuedata -PropertyType $valuetype | Out-Null
$restart = $true
}
Else {
# Value does exist - if not equal to desired value, change it
If ($val -ne $valuedata) {
Set-ItemProperty -Path $regKeyName -Name $value -Value $valuedata
$restart = $true
}
}
$restart
}
#***************************************************************************************************************
#******************* FUNCTION THAT DISABLES RC4 ***********************
Function DisableRC4 {
$restart = $false
$subkeys = Get-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL"
$ciphers = $subkeys.OpenSubKey("Ciphers", $true)
Write-Log -Message "----- Checking the status of RC4 -----" -Logfile $logLocation -Severity Information
$RC4 = $false
if ($ciphers.SubKeyCount -eq 0) {
$k1 = $ciphers.CreateSubKey("RC4 128/128")
$k1.SetValue("Enabled", 0, [Microsoft.Win32.RegistryValueKind]::DWord)
$restart = $true
$k2 = $ciphers.CreateSubKey("RC4 64/128")
$k2.SetValue("Enabled", 0, [Microsoft.Win32.RegistryValueKind]::DWord)
$k3 = $ciphers.CreateSubKey("RC4 56/128")
$k3.SetValue("Enabled", 0, [Microsoft.Win32.RegistryValueKind]::DWord)
$k4 = $ciphers.CreateSubKey("RC4 40/128")
$k4.SetValue("Enabled", 0, [Microsoft.Win32.RegistryValueKind]::DWord)
Write-Log -Message "RC4 was disabled " -Logfile $logLocation -Severity Information
$RC4 = $true
}
If ($RC4 -ne $true) {
Write-Log -Message "There was no change for RC4 " -Logfile $logLocation -Severity Information
}
$restart
}
#***************************************************************************************************************
#******************* FUNCTION CHECKS FOR PROBLEMATIC FIPS SETTING AND FIXES IT ***********************
Function Test-RegistryValueForFipsSettings {
$restart = $false
$fipsPath = @(
"HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp",
"HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services",
"HKLM:\System\CurrentControlSet\Control\Terminal Server\DefaultUserConfiguration"
)
$fipsValue = "MinEncryptionLevel"
foreach ($path in $fipsPath) {
Write-Log -Message "Checking to see if $($path)\$fipsValue exists" -Logfile $logLocation -Severity Information
$ErrorActionPreference = "stop"
Try {
$result = Get-ItemProperty -Path $path | Select-Object -ExpandProperty $fipsValue
if ($result -eq 4) {
set-itemproperty -Path $path -Name $fipsValue -value 3
Write-Log -Message "Regkey $($path)\$fipsValue was changed from value $result to a value of 3" -Logfile $logLocation -Severity Information
$restart = $true
}
else {
Write-Log -Message "Regkey $($path)\$fipsValue left at value $result" -Logfile $logLocation -Severity Information
}
}
Catch [System.Management.Automation.ItemNotFoundException] {
Write-Log -Message "Reg path $path was not found" -Logfile $logLocation -Severity Information
}
Catch [System.Management.Automation.PSArgumentException] {
Write-Log -Message "Regkey $($path)\$fipsValue was not found" -Logfile $logLocation -Severity Information
}
Catch {
Write-Log -Message "Error of type $($Error[0].Exception.GetType().FullName) trying to get $($path)\$fipsValue" -Logfile $logLocation -Severity Information
}
Finally {$ErrorActionPreference = "Continue"
}
}
$restart
}
#***************************************************************************************************************
#********************************** FUNCTION THAT CREATE LOG DIRECTORY IF IT DOES NOT EXIST *******************************
function CreateLogDirectory {
$TARGETDIR = "$env:HOMEDRIVE\Logs"
if ( -Not (Test-Path -Path $TARGETDIR ) ) {
New-Item -ItemType directory -Path $TARGETDIR | Out-Null
}
$TARGETDIR = $TARGETDIR + "\" + "TLSSettingsLogFile.csv"
return $TARGETDIR
}
#***************************************************************************************************************
#********************************** FUNCTION THAT LOGS WHAT THE SCRIPT IS DOING *******************************
function Write-Log {
[CmdletBinding()]
param(
[Parameter()]
[ValidateNotNullOrEmpty()]
[string]$Message,
[Parameter()]
[ValidateNotNullOrEmpty()]
[string]$LogFile,
[Parameter()]
[ValidateNotNullOrEmpty()]
[ValidateSet('Information', 'Warning', 'Error')]
[string]$Severity = 'Information'
)
[pscustomobject]@{
Time = (Get-Date -f g)
Message = $Message
Severity = $Severity
} | ConvertTo-Csv -NoTypeInformation | Select-Object -Skip 1 | Out-File -Append -FilePath $LogFile
}
#********************************TLS CipherSuite Settings *******************************************
# CipherSuites for windows OS < 10
function Get-BaseCipherSuitesOlderWindows()
{
param
(
[Parameter(Mandatory=$true, Position=0)][bool] $isExcellenceOrder
)
$cipherorder = @()
if ($isExcellenceOrder -eq $true)
{
$cipherorder += "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384_P384"
$cipherorder += "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256_P256"
$cipherorder += "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384_P384"
$cipherorder += "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256_P256"
$cipherorder += "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384"
$cipherorder += "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256"
}
else
{
$cipherorder += "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256_P256"
$cipherorder += "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384_P384"
$cipherorder += "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256_P256"
$cipherorder += "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384_P384"
$cipherorder += "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256"
$cipherorder += "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384"
}
# Add additional ciphers when EnableOlderTlsVersions flag is set to true
if ($EnableOlderTlsVersions)
{
$cipherorder += "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA_P256"
$cipherorder += "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA_P256"
$cipherorder += "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P256"
$cipherorder += "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA_P256"
$cipherorder += "TLS_RSA_WITH_AES_256_GCM_SHA384"
$cipherorder += "TLS_RSA_WITH_AES_128_GCM_SHA256"
$cipherorder += "TLS_RSA_WITH_AES_256_CBC_SHA256"
$cipherorder += "TLS_RSA_WITH_AES_128_CBC_SHA256"
$cipherorder += "TLS_RSA_WITH_AES_256_CBC_SHA"
$cipherorder += "TLS_RSA_WITH_AES_128_CBC_SHA"
}
return $cipherorder
}
# Ciphersuites needed for backwards compatibility with Firefox, Chrome
# Server 2012 R2 doesn't support TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
# Both firefox and chrome negotiate ECDHE_RSA_AES_256_CBC_SHA1, Edge negotiates ECDHE_RSA_AES_256_CBC_SHA384
function Get-BrowserCompatCipherSuitesOlderWindows()
{
param
(
[Parameter(Mandatory=$true, Position=0)][bool] $isExcellenceOrder
)
$cipherorder = @()
if ($isExcellenceOrder -eq $true)
{
$cipherorder += "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384" # (uses SHA-1)
$cipherorder += "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA_P256" # (uses SHA-1)
}
else
{
$cipherorder += "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA_P256" # (uses SHA-1)
$cipherorder += "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384" # (uses SHA-1)
}
return $cipherorder
}
# Ciphersuites for OS versions windows 10 and above
function Get-BaseCipherSuitesWin10Above()
{
param
(
[Parameter(Mandatory=$true, Position=0)][bool] $isExcellenceOrder
)
$cipherorder = @()
if ($isExcellenceOrder -eq $true)
{
$cipherorder += "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384"
$cipherorder += "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256"
$cipherorder += "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"
$cipherorder += "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"
$cipherorder += "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384"
$cipherorder += "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256"
$cipherorder += "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384"
$cipherorder += "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256"
}
else
{
$cipherorder += "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256"
$cipherorder += "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384"
$cipherorder += "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"
$cipherorder += "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"
$cipherorder += "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256"
$cipherorder += "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384"
$cipherorder += "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256"
$cipherorder += "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384"
}
# Add additional ciphers when EnableOlderTlsVersions flag is set to true
if ($EnableOlderTlsVersions)
{
$cipherorder += "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA_P256"
$cipherorder += "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA_P256"
$cipherorder += "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P256"
$cipherorder += "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA_P256"
$cipherorder += "TLS_RSA_WITH_AES_256_GCM_SHA384"
$cipherorder += "TLS_RSA_WITH_AES_128_GCM_SHA256"
$cipherorder += "TLS_RSA_WITH_AES_256_CBC_SHA256"
$cipherorder += "TLS_RSA_WITH_AES_128_CBC_SHA256"
$cipherorder += "TLS_RSA_WITH_AES_256_CBC_SHA"
$cipherorder += "TLS_RSA_WITH_AES_128_CBC_SHA"
}
return $cipherorder
}
#******************************* TLS Version Settings ****************************************************
function Get-RegKeyPathForTls12()
{
$regKeyPath = @(
"HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2",
"HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client",
"HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server"
)
return $regKeyPath
}
function Get-RegKeyPathForTls11()
{
$regKeyPath = @(
"HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1",
"HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client",
"HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server"
)
return $regKeyPath
}
function Get-RegKeypathForTls10()
{
$regKeyPath = @(
"HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0",
"HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client",
"HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server"
)
return $regKeyPath
}
function Get-RegKeyPathForSsl30()
{
$regKeyPath = @(
"HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0",
"HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Client",
"HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Server"
)
return $regKeyPath
}
function Get-RegKeyPathForSsl20()
{
$regKeyPath = @(
"HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0",
"HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Client",
"HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server"
)
return $regKeyPath
}
#Initialize reboot value to false
$reboot = $false
#*****************************Create the logfile if not does not exist***************************************
$logLocation = CreateLogDirectory
#Start writing to the logs
Write-Log -Message "========== Start of logging for a script execution ==========" -Logfile $logLocation -Severity Information
$registryPathGoodGuys = @()
$registryPathBadGuys = @()
# we enable TLS 1.2 and disable SSL 2.0, 3.0 in any case
$registryPathGoodGuys += Get-RegKeyPathForTls12
$registryPathBadGuys += Get-RegKeyPathForSsl20
$registryPathBadGuys += Get-RegKeyPathForSsl30
# add TLS 1.0/1.1 to good/bad depending on user's preference
# default is adding TLS 1.0/1.1 to bad
if ($EnableOlderTlsVersions)
{
$registryPathGoodGuys += Get-RegKeypathForTls10
$registryPathGoodGuys += Get-RegKeyPathForTls11
Write-Log -Message "Enabling TLS1.2, TLS1.1, TLS1.0. Disabling SSL3.0, SSL2.0" -Logfile $logLocation -Severity Information
}
else
{
$registryPathBadGuys += Get-RegKeypathForTls10
$registryPathBadGuys += Get-RegKeyPathForTls11
Write-Log -Message "Enabling TLS1.2. Disabling TLS1.1, TLS1.0, SSL3.0, SSL2.0" -Logfile $logLocation -Severity Information
}
Write-Log -Message "Check which registry keys exist already and which registry keys need to be created." -Logfile $logLocation -Severity Information
#******************* CREATE THE REGISTRY KEYS IF THEY DON'T EXIST********************************
# Check for existence of GoodGuy registry keys, and create if they do not exist
For ($i = 0; $i -lt $registryPathGoodGuys.Length; $i = $i + 1) {
Write-Log -Message "Checking for existing of key: $($registryPathGoodGuys[$i]) " -Logfile $logLocation -Severity Information
If (!(Test-Path -Path $registryPathGoodGuys[$i])) {
New-Item $registryPathGoodGuys[$i] | Out-Null
Write-Log -Message "Creating key: $($registryPathGoodGuys[$i]) " -Logfile $logLocation -Severity Information
}
}
# Check for existence of BadGuy registry keys, and create if they do not exist
For ($i = 0; $i -lt $registryPathBadGuys.Length; $i = $i + 1) {
Write-Log -Message "Checking for existing of key: $($registryPathBadGuys[$i]) " -Logfile $logLocation -Severity Information
If (!(Test-Path -Path $registryPathBadGuys[$i])) {
Write-Log -Message "Creating key: $($registryPathBadGuys[$i]) " -Logfile $logLocation -Severity Information
New-Item $registryPathBadGuys[$i] | Out-Null
}
}
#******************* EXPLICITLY DISABLE SSLV2, SSLV3, TLS10 AND TLS11 ********************************
For ($i = 0; $i -lt $registryPathBadGuys.Length; $i = $i + 1) {
if ($registryPathBadGuys[$i].Contains("Client") -Or $registryPathBadGuys[$i].Contains("Server")) {
Write-Log -Message "Disabling this key: $($registryPathBadGuys[$i]) " -Logfile $logLocation -Severity Information
$result = Set-CryptoSetting $registryPathBadGuys[$i].ToString() Enabled 0 DWord
$result = Set-CryptoSetting $registryPathBadGuys[$i].ToString() DisabledByDefault 1 DWord
$reboot = $reboot -or $result
}
}
#********************************* EXPLICITLY Enable TLS12 ****************************************
For ($i = 0; $i -lt $registryPathGoodGuys.Length; $i = $i + 1) {
if ($registryPathGoodGuys[$i].Contains("Client") -Or $registryPathGoodGuys[$i].Contains("Server")) {
Write-Log -Message "Enabling this key: $($registryPathGoodGuys[$i]) " -Logfile $logLocation -Severity Information
$result = Set-CryptoSetting $registryPathGoodGuys[$i].ToString() Enabled 1 DWord
$result = Set-CryptoSetting $registryPathGoodGuys[$i].ToString() DisabledByDefault 0 DWord
$reboot = $reboot -or $result
}
}
#************************************** Disable RC4 ************************************************
$result = DisableRC4
$reboot = $reboot -or $result
#************************************** Set Cipher Suite Order **************************************
Write-Log -Message "----- starting ciphersuite order calculation -----" -Logfile $logLocation -Severity Information
$configureExcellenceOrder = $true
if ($SetCipherOrder.ToUpper() -eq "B")
{
$configureExcellenceOrder = $false
Write-Host "The min bar cipher suite order was chosen."
Write-Log -Message "The min bar cipher suite order was chosen." -Logfile $logLocation -Severity Information
}
else
{
Write-Host "The opportunity for excellence cipher suite order was chosen."
Write-Log -Message "The opportunity for excellence cipher suite order was chosen." -Logfile $logLocation -Severity Information
}
$cipherlist = @()
if ([Environment]::OSVersion.Version.Major -lt 10)
{
$cipherlist += Get-BaseCipherSuitesOlderWindows -isExcellenceOrder $configureExcellenceOrder
$cipherlist += Get-BrowserCompatCipherSuitesOlderWindows -isExcellenceOrder $configureExcellenceOrder
}
else
{
$cipherlist += Get-BaseCipherSuitesWin10Above -isExcellenceOrder $configureExcellenceOrder
}
$cipherorder = [System.String]::Join(",", $cipherlist)
Write-Host "Appropriate ciphersuite order : $cipherorder"
Write-Log -Message "Appropriate ciphersuite order : $cipherorder" -Logfile $logLocation -Severity Information
$CipherSuiteRegKey = "HKLM:\SOFTWARE\Policies\Microsoft\Cryptography\Configuration\SSL\00010002"
if (!(Test-Path -Path $CipherSuiteRegKey))
{
New-Item $CipherSuiteRegKey | Out-Null
$reboot = $True
Write-Log -Message "Creating key: $($CipherSuiteRegKey) " -Logfile $logLocation -Severity Information
}
$val = (Get-Item -Path $CipherSuiteRegKey -ErrorAction SilentlyContinue).GetValue("Functions", $null)
Write-Log -Message "Previous cipher suite value: $val " -Logfile $logLocation -Severity Information
Write-Log -Message "New cipher suite value : $cipherorder " -Logfile $logLocation -Severity Information
if ($val -ne $cipherorder)
{
Write-Log -Message "Cipher suite order needs to be updated. " -Logfile $logLocation -Severity Information
Write-Host "The original cipher suite order needs to be updated", `n, $val
Set-ItemProperty -Path $CipherSuiteRegKey -Name Functions -Value $cipherorder
Write-Log -Message "Cipher suite value was updated. " -Logfile $logLocation -Severity Information
$reboot = $True
}
else
{
Write-Log -Message "Cipher suite order does not need to be updated. " -Logfile $logLocation -Severity Information
Write-Log -Message "Cipher suite value was not updated as there was no change. " -Logfile $logLocation -Severity Information
}
#****************************** CHECK THE FIPS SETTING WHICH IMPACTS RDP'S ALLOWED CIPHERS **************************
#Check for FipsSettings
Write-Log -Message "Checking to see if reg keys exist and if MinEncryptionLevel is set to 4" -Logfile $logLocation -Severity Information
$result = Test-RegistryValueForFipsSettings
$reboot = $reboot -or $result
#************************************** REBOOT **************************************
if ($RebootIfRequired)
{
Write-Log -Message "You set the RebootIfRequired flag to true. If changes are made, the system will reboot " -Logfile $logLocation -Severity Information
# If any settings were changed, reboot
If ($reboot)
{
Write-Log -Message "Rebooting now... " -Logfile $logLocation -Severity Information
Write-Log -Message "Using this command: shutdown.exe /r /t 5 /c ""Crypto settings changed"" /f /d p:2:4 " -Logfile $logLocation -Severity Information
Write-Host "Rebooting now..."
shutdown.exe /r /t 5 /c "Crypto settings changed" /f /d p:2:4
}
Else
{
Write-Host "Nothing get updated."
Write-Log -Message "Nothing get updated. " -Logfile $logLocation -Severity Information
}
}
else
{
Write-Log -Message "You set the RebootIfRequired flag to false. If changes are made, the system will NOT reboot " -Logfile $logLocation -Severity Information
Write-Log -Message "No changes will take effect until a reboot has been completed. " -Logfile $logLocation -Severity Information
Write-Log -Message "Script does not include a reboot by design" -Logfile $logLocation -Severity Information
}
Write-Log -Message "========== End of logging for a script execution ==========" -Logfile $logLocation -Severity Information
# SIG # Begin signature block
# MIIjhgYJKoZIhvcNAQcCoIIjdzCCI3MCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCAHtlEJwNffjnOP
# Sr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BmDCBgKR+
# MHwxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdS
# ZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xJjAkBgNVBAMT
# HU1pY3Jvc29mdCBUaW1lLVN0YW1wIFBDQSAyMDEwAhMzAAABB343aJiHWjfWAAAA
# AAEHMCIEIGIH6vLdbEFNnxTxBhtIN7CtmhcKy/9m6/xoAA3LHzXUMA0GCSqGSIb3
# DQEBCwUABIIBAKGg3zNulscnGBDlD6Q/U6yLQ5dN3gF9UrprgACiQ1gs/DexU7oC
# hjNZxBnH5RTA/7q9TFf2a1rBydHWVnqXuuQQJ0HuskdpXahxR4y1jboDdGwr7F08
# v/gmPeeUik28Je72QZp5m/R0O61/kMQaDpLO9iPH0Z9iMGfqJonFPDeY4VX8Da2n
# cPY7mrv6YAI+ydZ+mUdBp2yjas7+/N8MntcNtAO0HpWFXQTAmb77RrSssfeZphRA
# mBD+gLx5C3q4uSmuOqaQxUaF0y8FeuetHp0bw2sfce6GlMXJwzTpC6HvXnaVtMy0
# pgzd/KPHW7EgSvmRVKmvwiQGiZBoRG/Gcg8=
# SIG # End signature block

View File

@@ -1,89 +0,0 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
# REPLACE WITH DROP-TO-ADMIN-USER-PREFIX.ps1
# REPLACE WITH UTILITY-PREFIX.ps1
$VisualStudioBootstrapperUrl = 'https://aka.ms/vs/17/release/vs_enterprise.exe'
$Workloads = @(
'Microsoft.VisualStudio.Workload.NativeDesktop',
'Microsoft.VisualStudio.Workload.Universal',
'Microsoft.VisualStudio.Component.VC.Tools.x86.x64',
'Microsoft.VisualStudio.Component.VC.Tools.ARM',
'Microsoft.VisualStudio.Component.VC.Tools.ARM64',
'Microsoft.VisualStudio.Component.VC.ATL',
'Microsoft.VisualStudio.Component.VC.ATLMFC',
'Microsoft.VisualStudio.Component.VC.ATL.ARM',
'Microsoft.VisualStudio.Component.VC.ATL.ARM64',
'Microsoft.VisualStudio.Component.VC.MFC.ARM',
'Microsoft.VisualStudio.Component.VC.MFC.ARM64',
'Microsoft.VisualStudio.Component.Windows10SDK',
'Microsoft.Net.Component.4.8.SDK',
'Microsoft.Net.Component.4.7.2.TargetingPack',
'Microsoft.Component.NetFX.Native',
'Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset',
'Microsoft.VisualStudio.Component.VC.Llvm.Clang',
'Microsoft.VisualStudio.ComponentGroup.UWP.VC.BuildTools',
'Microsoft.VisualStudio.Component.VC.CMake.Project'
)
<#
.SYNOPSIS
Install Visual Studio.
.DESCRIPTION
InstallVisualStudio takes the $Workloads array, and installs it with the
installer that's pointed at by $BootstrapperUrl.
.PARAMETER Workloads
The set of VS workloads to install.
.PARAMETER BootstrapperUrl
The URL of the Visual Studio installer, i.e. one of vs_*.exe.
.PARAMETER InstallPath
The path to install Visual Studio at.
.PARAMETER Nickname
The nickname to give the installation.
#>
Function InstallVisualStudio {
Param(
[String[]]$Workloads,
[String]$BootstrapperUrl,
[String]$InstallPath = $null,
[String]$Nickname = $null
)
try {
Write-Host 'Downloading Visual Studio...'
[string]$bootstrapperExe = Get-TempFilePath -Extension 'exe'
curl.exe -L -o $bootstrapperExe -s -S $BootstrapperUrl
Write-Host 'Installing Visual Studio...'
$vsArgs = @('/c', $bootstrapperExe, '--quiet', '--norestart', '--wait', '--nocache')
foreach ($workload in $Workloads) {
$vsArgs += '--add'
$vsArgs += $workload
}
if (-not ([String]::IsNullOrWhiteSpace($InstallPath))) {
$vsArgs += '--installpath'
$vsArgs += $InstallPath
}
if (-not ([String]::IsNullOrWhiteSpace($Nickname))) {
$vsArgs += '--nickname'
$vsArgs += $Nickname
}
$proc = Start-Process -FilePath cmd.exe -ArgumentList $vsArgs -Wait -PassThru
PrintMsiExitCodeMessage $proc.ExitCode
}
catch {
Write-Error "Failed to install Visual Studio! $($_.Exception.Message)"
throw
}
}
InstallVisualStudio -Workloads $Workloads -BootstrapperUrl $VisualStudioBootstrapperUrl -Nickname 'Stable'

View File

@@ -1,49 +0,0 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
# REPLACE WITH DROP-TO-ADMIN-USER-PREFIX.ps1
# REPLACE WITH UTILITY-PREFIX.ps1
<#
.SYNOPSIS
Installs Windows PSDK/WDK
.DESCRIPTION
Downloads the Windows PSDK/DDK installer located at $Url, and installs it with the
correct flags.
.PARAMETER Url
The URL of the installer.
#>
Function InstallWindowsDK {
Param(
[String]$Url
)
try {
Write-Host "Downloading Windows PSDK or DDK $Url..."
[string]$installerPath = Get-TempFilePath -Extension 'exe'
curl.exe -L -o $installerPath -s -S $Url
Write-Host 'Installing...'
$proc = Start-Process -FilePath $installerPath -ArgumentList @('/features', '+', '/q') -Wait -PassThru
$exitCode = $proc.ExitCode
if ($exitCode -eq 0) {
Write-Host 'Installation successful!'
}
else {
Write-Error "Installation failed! Exited with $exitCode."
throw
}
}
catch {
Write-Error "Failed to install Windows PSDK or DDK! $($_.Exception.Message)"
throw
}
}
# Windows 10 SDK, version 2004 (10.0.19041.0)
InstallWindowsDK 'https://go.microsoft.com/fwlink/?linkid=2120843'
# Windows 10 WDK, version 2004
InstallWindowsDK 'https://go.microsoft.com/fwlink/?linkid=2128854'

View File

@@ -1,35 +0,0 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
#
<#
.SYNOPSIS
Prints total and free disk space for each disk on the system
#>
Function Format-Size {
[CmdletBinding()]
Param([long]$Size)
if ($Size -lt 1024) {
$Size = [int]$Size
return "$Size B"
}
$Size = $Size / 1024
if ($Size -lt 1024) {
$Size = [int]$Size
return "$Size KiB"
}
$Size = $Size / 1024
if ($Size -lt 1024) {
$Size = [int]$Size
return "$Size MiB"
}
$Size = [int]($Size / 1024)
return "$Size GiB"
}
Get-CimInstance -ClassName Win32_LogicalDisk | Format-Table -Property @{Label="Disk"; Expression={ $_.DeviceID }},@{Label="Label"; Expression={ $_.VolumeName }},@{Label="Size"; Expression={ Format-Size($_.Size) }},@{Label="Free Space"; Expression={ Format-Size($_.FreeSpace) }}

View File

@@ -1,27 +0,0 @@
param(
[string]$AdminUserPassword = $null
)
$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue'
if (-Not [string]::IsNullOrEmpty($AdminUserPassword)) {
$PsExecPath = 'C:\PsExec64.exe'
$PsExecArgs = @(
'-u',
'AdminUser',
'-p',
$AdminUserPassword,
'-accepteula',
'-i',
'-h',
'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe',
'-ExecutionPolicy',
'Unrestricted',
'-File',
$PSCommandPath
)
Write-Host "Executing: $PsExecPath $PsExecArgs"
$proc = Start-Process -FilePath $PsExecPath -ArgumentList $PsExecArgs -Wait -PassThru
exit $proc.ExitCode
}

View File

@@ -1,18 +0,0 @@
# This script runs all the scripts we run on Azure machines to deploy prerequisites,
# and assumes it is being run as an admin user.
. "$PSScriptRoot\utility-prefix.ps1"
. "$PSScriptRoot\deploy-tlssettings.ps1" -RebootIfRequired 0
. "$PSScriptRoot\deploy-windows-sdks.ps1"
. "$PSScriptRoot\deploy-visual-studio.ps1"
. "$PSScriptRoot\deploy-mpi.ps1"
. "$PSScriptRoot\deploy-cuda.ps1"
. "$PSScriptRoot\deploy-inteloneapi.ps1"
. "$PSScriptRoot\deploy-pwsh.ps1"
try {
Copy-Item "$PSScriptRoot\deploy-settings.txt" "$PSScriptRoot\deploy-settings.ps1"
. "$PSScriptRoot\deploy-settings.ps1"
} finally {
Remove-Item "$PSScriptRoot\deploy-settings.ps1"
}

View File

@@ -1,17 +0,0 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
#
<#
.SYNOPSIS
Prepares the virtual machine for imaging.
.DESCRIPTION
Runs the `sysprep` utility to prepare the system for imaging.
See https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/sysprep--system-preparation--overview
for more information.
#>
$ErrorActionPreference = 'Stop'
Write-Host 'Running sysprep'
& C:\Windows\system32\sysprep\sysprep.exe /oobe /generalize /mode:vm /shutdown

View File

@@ -1,125 +0,0 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
<#
.SYNOPSIS
Gets a random file path in the temp directory.
.DESCRIPTION
Get-TempFilePath takes an extension, and returns a path with a random
filename component in the temporary directory with that extension.
.PARAMETER Extension
The extension to use for the path.
#>
Function Get-TempFilePath {
Param(
[String]$Extension
)
if ([String]::IsNullOrWhiteSpace($Extension)) {
throw 'Missing Extension'
}
$tempPath = [System.IO.Path]::GetTempPath()
$tempName = [System.IO.Path]::GetRandomFileName() + '.' + $Extension
return Join-Path $tempPath $tempName
}
<#
.SYNOPSIS
Writes a message to the screen depending on ExitCode.
.DESCRIPTION
Since msiexec can return either 0 or 3010 successfully, in both cases
we write that installation succeeded, and which exit code it exited with.
If msiexec returns anything else, we write an error.
.PARAMETER ExitCode
The exit code that msiexec returned.
#>
Function PrintMsiExitCodeMessage {
Param(
$ExitCode
)
# 3010 is probably ERROR_SUCCESS_REBOOT_REQUIRED
if ($ExitCode -eq 0 -or $ExitCode -eq 3010) {
Write-Host "Installation successful! Exited with $ExitCode."
}
else {
Write-Error "Installation failed! Exited with $ExitCode."
throw
}
}
<#
.SYNOPSIS
Install a .msi file.
.DESCRIPTION
InstallMSI takes a url where an .msi lives, and installs that .msi to the system.
.PARAMETER Name
The name of the thing to install.
.PARAMETER Url
The URL at which the .msi lives.
#>
Function InstallMSI {
Param(
[String]$Name,
[String]$Url
)
try {
Write-Host "Downloading $Name..."
[string]$msiPath = Get-TempFilePath -Extension 'msi'
curl.exe -L -o $msiPath -s -S $Url
Write-Host "Installing $Name..."
$args = @('/i', $msiPath, '/norestart', '/quiet', '/qn')
$proc = Start-Process -FilePath 'msiexec.exe' -ArgumentList $args -Wait -PassThru
PrintMsiExitCodeMessage $proc.ExitCode
}
catch {
Write-Error "Failed to install $Name! $($_.Exception.Message)"
throw
}
}
<#
.SYNOPSIS
Unpacks a zip file to $Dir.
.DESCRIPTION
InstallZip takes a URL of a zip file, and unpacks the zip file to the directory
$Dir.
.PARAMETER Name
The name of the tool being installed.
.PARAMETER Url
The URL of the zip file to unpack.
.PARAMETER Dir
The directory to unpack the zip file to.
#>
Function InstallZip {
Param(
[String]$Name,
[String]$Url,
[String]$Dir
)
try {
Write-Host "Downloading $Name..."
[string]$zipPath = Get-TempFilePath -Extension 'zip'
curl.exe -L -o $zipPath -s -S $Url
Write-Host "Installing $Name..."
Expand-Archive -Path $zipPath -DestinationPath $Dir -Force
}
catch {
Write-Error "Failed to install $Name! $($_.Exception.Message)"
throw
}
}

View File

@@ -1,29 +0,0 @@
./vcpkg.exe --feature-flags=versions x-ci-verify-versions --verbose |
ForEach-Object -Begin {
$long_error = ''
} -Process {
if ($long_error -ne '' -and $_ -match '^$|^ ') {
# Extend multi-line message
$long_error = -join($long_error, "%0D%0A", $_ -replace '^ ','' `
-replace '(git add) [^ ]*\\ports\\([^ ]*)', '$1 ports/$2' )
} else {
if ($long_error -ne '') {
# Flush multi-line message
$long_error
$long_error = ''
}
if ($_ -match '^Error: ') {
# Start multi-line message
$long_error = $_ -replace '^Error: ', '##vso[task.logissue type=error]' `
-replace '(^##vso[^\]]*)](.*) [^ ]*\\versions\\(.-)\\(.*.json)(.*)', '$1;sourcepath=versions/$3/$4;linenumber=2]$2 version/$3/$4$5'
} else {
# Normal line
$_
}
}
} -End {
if ($long_error -ne '') {
# Flush multi-line message
$long_error
}
}

View File

@@ -1,3 +0,0 @@
/boost
/downloads
/libs

View File

@@ -1,623 +0,0 @@
[CmdletBinding()]
param (
$libraries = @(),
$version = "1.79.0",
$portsDir = $null
)
$ErrorActionPreference = 'Stop'
$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition
if ($null -eq $portsDir) {
$portsDir = "$scriptsDir/../../ports"
}
if ($IsWindows) {
$vcpkg = "$scriptsDir/../../vcpkg.exe"
$curl = "curl.exe"
}
else {
$vcpkg = "$scriptsDir/../../vcpkg"
$curl = "curl"
}
# Clear this array when moving to a new boost version
$portVersions = @{
#e.g. "boost-asio" = 1;
}
$portData = @{
"boost" = @{
"features" = @{
"mpi" = @{
"description" = "Build with MPI support";
"dependencies" = @("boost-mpi", "boost-graph-parallel", "boost-property-map-parallel");
}
}
};
"boost-asio" = @{
"features" = @{
"ssl" = @{
"description" = "Build with SSL support";
"dependencies" = @(@{ "name" = "openssl"; "platform" = "!emscripten" });
}
}
};
"boost-beast" = @{ "supports" = "!emscripten" };
"boost-fiber" = @{
"supports" = "!osx & !uwp & !arm & !emscripten";
"features" = @{
"numa" = @{
"description" = "Enable NUMA support";
}
}
};
"boost-filesystem" = @{ "supports" = "!uwp" };
"boost-iostreams" = @{
"default-features" = @("bzip2", "lzma", "zlib", "zstd");
"supports" = "!uwp";
"features" = @{
"bzip2" = @{
"description" = "Support bzip2 filters";
"dependencies" = @("bzip2");
};
"lzma" = @{
"description" = "Support LZMA/xz filters";
"dependencies" = @("liblzma");
};
"zlib" = @{
"description" = "Support zlib filters";
"dependencies" = @("zlib");
};
"zstd" = @{
"description" = "Support zstd filters";
"dependencies" = @("zstd");
};
};
};
"boost-context" = @{ "supports" = "!uwp & !emscripten" };
"boost-stacktrace" = @{ "supports" = "!uwp" };
"boost-coroutine" = @{ "supports" = "!arm & !uwp & !emscripten" };
"boost-coroutine2" = @{ "supports" = "!emscripten" };
"boost-test" = @{ "supports" = "!uwp" };
"boost-wave" = @{ "supports" = "!uwp" };
"boost-log" = @{ "supports" = "!uwp & !emscripten" };
"boost-locale" = @{
"dependencies" = @(@{ "name" = "libiconv"; "platform" = "!uwp & !windows & !mingw" });
"supports" = "!uwp";
"features" = @{
"icu" = @{
"description" = "ICU backend for Boost.Locale";
"dependencies" = @("icu");
}
}
};
"boost-mpi" = @{
"dependencies" = @("mpi");
"supports" = "!uwp";
"features" = @{
"python3" = @{
"description" = "Build Python3 bindings";
"supports" = "!static";
"dependencies" = @(@{ "name" = "boost-python"; "features" = @( "python3" ); "platform" = "!uwp & !emscripten & !ios & !android" }, "python3");
}
}
};
"boost-graph-parallel" = @{
"dependencies" = @("mpi");
"supports" = "!uwp";
};
"boost-odeint" = @{
"features" = @{
"mpi" = @{
"description" = "Support parallelization with MPI";
"dependencies" = @("boost-mpi");
}
}
};
"boost-parameter-python" = @{ "supports" = "!emscripten" };
"boost-process" = @{ "supports" = "!emscripten" };
"boost-python" = @{
"default-features" = @("python3");
"supports" = "!uwp & !emscripten & !ios & !android";
"features" = @{
"python2" = @{
"description" = "Build with Python2 support";
"supports" = "!(arm & windows)";
"dependencies" = @("python2");
};
"python3" = @{
"description" = "Build with Python3 support";
"dependencies" = @("python3");
}
}
};
"boost-regex" = @{
"features" = @{
"icu" = @{
"description" = "ICU backend for Boost.Regex";
"dependencies" = @("icu");
}
}
}
}
function GeneratePortName() {
param (
[string]$Library
)
"boost-" + ($Library -replace "_", "-")
}
function GeneratePortDependency() {
param (
[string]$Library
)
$portName = GeneratePortName $Library
if ($portData.Contains($portName) -and $portData[$portName].Contains('supports')) {
@{name = $portName; platform = $portData[$portName]['supports'] }
}
else {
$portName
}
}
function GeneratePortManifest() {
param (
[string]$PortName,
[string]$Homepage,
[string]$Description,
[string]$License,
$Dependencies = @()
)
$manifest = @{
"name" = $PortName
"version" = $version
"homepage" = $Homepage
"description" = $Description
}
if ($License) {
$manifest["license"] += $License
}
if ($portData.Contains($PortName)) {
$manifest += $portData[$PortName]
}
if ($portVersions.Contains($PortName)) {
$manifest["port-version"] = $portVersions[$PortName]
}
if ($Dependencies.Count -gt 0) {
$manifest["dependencies"] += $Dependencies
}
# Remove from the dependencies the ports that are included in the feature dependencies
if ($manifest.Contains('features') -and $manifest.Contains('dependencies')) {
foreach ($feature in $manifest.features.Keys) {
$feature_dependencies = $manifest.features.$feature["dependencies"]
foreach ($dependency in $feature_dependencies) {
if ($dependency.Contains("name")) {
$dep_name = $dependency.name
}
else {
$dep_name = $dependency
}
$manifest["dependencies"] = $manifest["dependencies"] `
| Where-Object {
if ($_.Contains("name")) {
$_.name -notmatch "$dep_name"
} else {
$_ -notmatch "$dep_name"
}
}
}
}
}
$manifest | ConvertTo-Json -Depth 10 -Compress `
| Out-File -Encoding UTF8 "$portsDir/$PortName/vcpkg.json"
& $vcpkg format-manifest "$portsDir/$PortName/vcpkg.json"
}
function GeneratePort() {
param (
[string]$Library,
[string]$Hash,
[bool]$NeedsBuild,
$Dependencies = @()
)
$portName = GeneratePortName $Library
New-Item -ItemType "Directory" "$portsDir/$portName" -erroraction SilentlyContinue | out-null
# Generate vcpkg.json
GeneratePortManifest `
-PortName $portName `
-Homepage "https://github.com/boostorg/$Library" `
-Description "Boost $Library module" `
-License "BSL-1.0" `
-Dependencies $Dependencies
$portfileLines = @(
"# Automatically generated by scripts/boost/generate-ports.ps1"
""
)
if ($Library -eq "system") {
$portfileLines += @(
"vcpkg_buildpath_length_warning(37)"
""
)
}
$portfileLines += @(
"vcpkg_from_github("
" OUT_SOURCE_PATH SOURCE_PATH"
" REPO boostorg/$Library"
" REF boost-$version"
" SHA512 $Hash"
" HEAD_REF master"
)
[Array]$patches = Get-Item -Path "$portsDir/$portName/*.patch"
if ($null -eq $patches -or $patches.Count -eq 0) {
}
elseif ($patches.Count -eq 1) {
$portfileLines += @(" PATCHES $($patches.name)")
}
else {
$portfileLines += @(" PATCHES")
foreach ($patch in $patches) {
$portfileLines += @(" $($patch.name)")
}
}
$portfileLines += @(
")"
""
)
if (Test-Path "$scriptsDir/post-source-stubs/$Library.cmake") {
$portfileLines += @(Get-Content "$scriptsDir/post-source-stubs/$Library.cmake")
}
if ($NeedsBuild) {
$portfileLines += @(
"include(`${CURRENT_HOST_INSTALLED_DIR}/share/boost-build/boost-modular-build.cmake)"
)
# b2-options.cmake contains port-specific build options
if (Test-Path "$portsDir/$portName/b2-options.cmake") {
$portfileLines += @(
"boost_modular_build("
" SOURCE_PATH `${SOURCE_PATH}"
" BOOST_CMAKE_FRAGMENT `"`${CMAKE_CURRENT_LIST_DIR}/b2-options.cmake`""
")"
)
}
elseif (Test-Path "$portsDir/$portName/b2-options.cmake.in") {
$portfileLines += @(
'configure_file('
' "${CMAKE_CURRENT_LIST_DIR}/b2-options.cmake.in"'
' "${CURRENT_BUILDTREES_DIR}/vcpkg-b2-options.cmake"'
' @ONLY'
')'
'boost_modular_build('
' SOURCE_PATH ${SOURCE_PATH}'
' BOOST_CMAKE_FRAGMENT "${CURRENT_BUILDTREES_DIR}/vcpkg-b2-options.cmake"'
')'
)
}
else {
$portfileLines += @(
"boost_modular_build(SOURCE_PATH `${SOURCE_PATH})"
)
}
}
$portfileLines += @(
"include(`${CURRENT_INSTALLED_DIR}/share/boost-vcpkg-helpers/boost-modular-headers.cmake)"
"boost_modular_headers(SOURCE_PATH `${SOURCE_PATH})"
)
if (Test-Path "$scriptsDir/post-build-stubs/$Library.cmake") {
$portfileLines += @(Get-Content "$scriptsDir/post-build-stubs/$Library.cmake")
}
$portfileLines += @("")
Set-Content -LiteralPath "$portsDir/$portName/portfile.cmake" `
-Value "$($portfileLines -join "`r`n")" `
-Encoding UTF8 `
-NoNewline
}
if (!(Test-Path "$scriptsDir/boost")) {
"Cloning boost..."
Push-Location $scriptsDir
try {
git clone https://github.com/boostorg/boost --branch boost-$version
}
finally {
Pop-Location
}
}
else {
Push-Location $scriptsDir/boost
try {
git fetch
git checkout -f boost-$version
}
finally {
Pop-Location
}
}
$foundLibraries = Get-ChildItem $scriptsDir/boost/libs -directory | ForEach-Object name | ForEach-Object {
if ($_ -eq "numeric") {
"numeric_conversion"
"interval"
"odeint"
"ublas"
}
elseif ($_ -eq "headers") {
}
else {
$_
}
}
New-Item -ItemType "Directory" $scriptsDir/downloads -erroraction SilentlyContinue | out-null
$updateServicePorts = $false
if ($libraries.Length -eq 0) {
$libraries = $foundLibraries
$updateServicePorts = $true
}
$boostPortDependencies = @()
foreach ($library in $libraries) {
"Handling boost/$library..."
$archive = "$scriptsDir/downloads/$library-boost-$version.tar.gz"
if (!(Test-Path $archive)) {
"Downloading boost/$library..."
& $curl -L "https://github.com/boostorg/$library/archive/boost-$version.tar.gz" --output "$scriptsDir/downloads/$library-boost-$version.tar.gz"
}
$hash = & $vcpkg --x-wait-for-lock hash $archive
# remove prefix "Waiting to take filesystem lock on <path>/.vcpkg-root... "
if ($hash -is [Object[]]) {
$hash = $hash[1]
}
$unpacked = "$scriptsDir/libs/$library-boost-$version"
if (!(Test-Path $unpacked)) {
"Unpacking boost/$library..."
New-Item -ItemType "Directory" $scriptsDir/libs -erroraction SilentlyContinue | out-null
Push-Location $scriptsDir/libs
try {
cmake -E tar xf $archive
}
finally {
Pop-Location
}
}
Push-Location $unpacked
try {
$usedLibraries = Get-ChildItem -Recurse -Path include, src -File `
| Where-Object { $_ -is [System.IO.FileInfo] } `
| ForEach-Object {
Write-Verbose "${library}: processing file: $_"
Get-Content -LiteralPath $_
} `
| Where-Object {
$_ -match ' *# *include *[<"]boost\/'
} `
| ForEach-Object {
# extract path from the line
Write-Verbose "${library}: processing line: $_"
$_ -replace " *# *include *[<`"]boost\/([a-zA-Z0-9\.\-_\/]*)[>`"].*", "`$1"
}`
| ForEach-Object {
# map the path to the library name
Write-Verbose "${library}: processing path: $_"
if ($_ -match "^detail\/winapi\/") { "winapi" }
elseif ($_ -eq "detail/algorithm.hpp") { "graph" }
elseif ($_ -eq "detail/atomic_count.hpp") { "smart_ptr" }
elseif ($_ -eq "detail/basic_pointerbuf.hpp") { "lexical_cast" }
elseif ($_ -eq "detail/call_traits.hpp") { "utility" }
elseif ($_ -eq "detail/compressed_pair.hpp") { "utility" }
elseif ($_ -eq "detail/interlocked.hpp") { "winapi" }
elseif ($_ -eq "detail/iterator.hpp") { "core" }
elseif ($_ -eq "detail/lcast_precision.hpp") { "lexical_cast" }
elseif ($_ -eq "detail/lightweight_mutex.hpp") { "smart_ptr" }
elseif ($_ -eq "detail/lightweight_test.hpp") { "core" }
elseif ($_ -eq "detail/lightweight_thread.hpp") { "smart_ptr" }
elseif ($_ -eq "detail/no_exceptions_support.hpp") { "core" }
elseif ($_ -eq "detail/scoped_enum_emulation.hpp") { "core" }
elseif ($_ -eq "detail/sp_typeinfo.hpp") { "core" }
elseif ($_ -eq "detail/ob_compressed_pair.hpp") { "utility" }
elseif ($_ -eq "detail/quick_allocator.hpp") { "smart_ptr" }
elseif ($_ -eq "detail/workaround.hpp") { "config" }
elseif ($_ -match "^functional\/hash\/") { "container_hash" }
elseif ($_ -eq "functional/hash.hpp") { "container_hash" }
elseif ($_ -eq "functional/hash_fwd.hpp") { "container_hash" }
elseif ($_ -match "^graph\/distributed\/") { "graph_parallel" }
elseif ($_ -match "^graph\/parallel\/") { "graph_parallel" }
elseif ($_ -eq "graph/accounting.hpp") { "graph_parallel" }
elseif ($_ -eq "exception/exception.hpp") { "throw_exception" }
elseif ($_ -match "^numeric\/conversion\/") { "numeric_conversion" }
elseif ($_ -match "^numeric\/interval\/") { "interval" }
elseif ($_ -match "^numeric\/odeint\/") { "odeint" }
elseif ($_ -match "^numeric\/ublas\/") { "ublas" }
elseif ($_ -eq "numeric/interval.hpp") { "interval" }
elseif ($_ -eq "numeric/odeint.hpp") { "odeint" }
elseif ($_ -match "^parameter\/aux_\/python\/") { "parameter_python" }
elseif ($_ -eq "parameter/python.hpp") { "parameter_python" }
elseif ($_ -eq "pending/detail/disjoint_sets.hpp") { "graph" }
elseif ($_ -eq "pending/detail/int_iterator.hpp") { "iterator" }
elseif ($_ -eq "pending/detail/property.hpp") { "graph" }
elseif ($_ -eq "pending/bucket_sorter.hpp") { "graph" }
elseif ($_ -eq "pending/container_traits.hpp") { "graph" }
elseif ($_ -eq "pending/disjoint_sets.hpp") { "graph" }
elseif ($_ -eq "pending/fenced_priority_queue.hpp") { "graph" }
elseif ($_ -eq "pending/fibonacci_heap.hpp") { "graph" }
elseif ($_ -eq "pending/indirect_cmp.hpp") { "graph" }
elseif ($_ -eq "pending/integer_log2.hpp") { "integer" }
elseif ($_ -eq "pending/is_heap.hpp") { "graph" }
elseif ($_ -eq "pending/iterator_adaptors.hpp") { "iterator" }
elseif ($_ -eq "pending/iterator_tests.hpp") { "iterator" }
elseif ($_ -eq "pending/mutable_heap.hpp") { "graph" }
elseif ($_ -eq "pending/mutable_queue.hpp") { "graph" }
elseif ($_ -eq "pending/property.hpp") { "graph" }
elseif ($_ -eq "pending/property_serialize.hpp") { "graph" }
elseif ($_ -eq "pending/queue.hpp") { "graph" }
elseif ($_ -eq "pending/relaxed_heap.hpp") { "graph" }
elseif ($_ -eq "pending/stringtok.hpp") { "graph" }
elseif ($_ -match "^property_map\/parallel\/") { "property_map_parallel" }
elseif ($_ -eq "utility/addressof.hpp") { "core" }
elseif ($_ -eq "utility/declval.hpp") { "type_traits" }
elseif ($_ -eq "utility/enable_if.hpp") { "core" }
elseif ($_ -eq "utility/explicit_operator_bool.hpp") { "core" }
elseif ($_ -eq "utility/swap.hpp") { "core" }
# extract first directory name or file name from the path
else { $_ -replace "([a-zA-Z0-9\.\-_]*).*", "`$1" }
} `
| ForEach-Object {
# map directory/file name to the library name
Write-Verbose "${library}: processing name: $_"
if ($_ -eq "current_function.hpp") { "assert" }
elseif ($_ -eq "memory_order.hpp") { "atomic" }
elseif ($_ -match "is_placeholder.hpp|mem_fn.hpp") { "bind" }
elseif ($_ -eq "circular_buffer_fwd.hpp") { "circular_buffer" }
elseif ($_ -match "^concept$|concept_archetype.hpp") { "concept_check" }
elseif ($_ -match "cstdint.hpp|cxx11_char_types.hpp|limits.hpp|version.hpp") { "config" }
elseif ($_ -eq "contract_macro.hpp") { "contract" }
elseif ($_ -match "implicit_cast.hpp|polymorphic_cast.hpp|polymorphic_pointer_cast.hpp") { "conversion" }
elseif ($_ -eq "make_default.hpp") { "convert" }
elseif ($_ -match "checked_delete.hpp|get_pointer.hpp|iterator.hpp|non_type.hpp|noncopyable.hpp|ref.hpp|swap.hpp|type.hpp|visit_each.hpp") { "core" }
elseif ($_ -match "blank.hpp|blank_fwd.hpp|cstdlib.hpp") { "detail" }
elseif ($_ -eq "dynamic_bitset_fwd.hpp") { "dynamic_bitset" }
elseif ($_ -eq "exception_ptr.hpp") { "exception" }
elseif ($_ -eq "foreach_fwd.hpp") { "foreach" }
elseif ($_ -eq "function_equal.hpp") { "function" }
elseif ($_ -match "integer_fwd.hpp|integer_traits.hpp") { "integer" }
elseif ($_ -eq "io_fwd.hpp") { "io" }
elseif ($_ -match "function_output_iterator.hpp|generator_iterator.hpp|indirect_reference.hpp|iterator_adaptors.hpp|next_prior.hpp|pointee.hpp|shared_container_iterator.hpp") { "iterator" }
elseif ($_ -match "cstdfloat.hpp|math_fwd.hpp") { "math" }
elseif ($_ -match "multi_index_container.hpp|multi_index_container_fwd.hpp") { "multi_index" }
elseif ($_ -eq "cast.hpp") { "numeric_conversion" }
elseif ($_ -match "none.hpp|none_t.hpp") { "optional" }
elseif ($_ -eq "qvm_lite.hpp") { "qvm" }
elseif ($_ -eq "nondet_random.hpp") { "random" }
elseif ($_ -match "cregex.hpp|regex_fwd.hpp") { "regex" }
elseif ($_ -eq "archive") { "serialization" }
elseif ($_ -match "last_value.hpp|signal.hpp") { "signals" }
elseif ($_ -match "enable_shared_from_this.hpp|intrusive_ptr.hpp|make_shared.hpp|make_unique.hpp|pointer_cast.hpp|pointer_to_other.hpp|scoped_array.hpp|scoped_ptr.hpp|shared_array.hpp|shared_ptr.hpp|weak_ptr.hpp") { "smart_ptr" }
elseif ($_ -eq "cerrno.hpp") { "system" }
elseif ($_ -eq "progress.hpp") { "timer" }
elseif ($_ -match "token_functions.hpp|token_iterator.hpp") { "tokenizer" }
elseif ($_ -match "aligned_storage.hpp") { "type_traits" }
elseif ($_ -match "unordered_map.hpp|unordered_set.hpp") { "unordered" }
elseif ($_ -match "call_traits.hpp|compressed_pair.hpp|operators.hpp|operators_v1.hpp") { "utility" }
# by dafault use the name as is, just remove the file extension if available
else { $_ -replace "\.hp?p?", "" }
} `
| Where-Object {
$_ -ne $library
} `
| Group-Object -NoElement | ForEach-Object Name
" [known] " + $($usedLibraries | Where-Object { $foundLibraries -contains $_ })
" [unknown] " + $($usedLibraries | Where-Object { $foundLibraries -notcontains $_ })
$deps = @($usedLibraries | Where-Object { $foundLibraries -contains $_ })
# break unnecessary dependencies
$deps = @($deps | ? {
-not (
($library -eq 'gil' -and $_ -eq 'filesystem') # PR #20575
)
})
$deps = @($deps | ForEach-Object { GeneratePortDependency $_ })
$deps += @("boost-vcpkg-helpers")
$needsBuild = $false
if (((Test-Path $unpacked/build/Jamfile.v2) -or (Test-Path $unpacked/build/Jamfile)) -and $library -notmatch "function_types") {
$deps += @(
@{ name = "boost-build"; host = $True },
@{ name = "boost-modular-build-helper"; host = $True },
@{ name = "vcpkg-cmake"; host = $True }
)
$needsBuild = $true
}
GeneratePort `
-Library $library `
-Hash $hash `
-Dependencies $deps `
-NeedsBuild $needsBuild
$boostPortDependencies += @(GeneratePortDependency $library)
}
finally {
Pop-Location
}
}
if ($updateServicePorts) {
# Generate manifest file for master boost port which depends on each individual library
GeneratePortManifest `
-PortName "boost" `
-Homepage "https://boost.org" `
-Description "Peer-reviewed portable C++ source libraries" `
-License "BSL-1.0" `
-Dependencies $boostPortDependencies
Set-Content -LiteralPath "$portsDir/boost/portfile.cmake" `
-Value "set(VCPKG_POLICY_EMPTY_PACKAGE enabled)`n" `
-Encoding UTF8 `
-NoNewline
# Generate manifest files for boost-uninstall
GeneratePortManifest `
-PortName "boost-uninstall" `
-Description "Internal vcpkg port used to uninstall Boost" `
-License "MIT"
# Generate manifest files for boost-vcpkg-helpers
GeneratePortManifest `
-PortName "boost-vcpkg-helpers" `
-Description "Internal vcpkg port used to modularize Boost" `
-License "MIT" `
-Dependencies @("boost-uninstall")
# Generate manifest files for boost-modular-build-helper
GeneratePortManifest `
-PortName "boost-modular-build-helper" `
-Description "Internal vcpkg port used to build Boost libraries" `
-License "MIT" `
-Dependencies @("boost-uninstall", "vcpkg-cmake")
# Generate manifest files for boost-build
GeneratePortManifest `
-PortName "boost-build" `
-Homepage "https://github.com/boostorg/build" `
-Description "Boost.Build" `
-License "BSL-1.0" `
-Dependencies @("boost-uninstall")
# Update Boost version in CMake files
$files_with_boost_version = @(
"$portsDir/boost-build/portfile.cmake",
"$portsDir/boost-modular-build-helper/boost-modular-build.cmake",
"$portsDir/boost-vcpkg-helpers/portfile.cmake"
)
$files_with_boost_version | % {
$content = Get-Content -LiteralPath $_ `
-Encoding UTF8 `
-Raw
$content = $content -replace `
"set\(BOOST_VERSION [0-9\.]+\)", `
"set(BOOST_VERSION $version)"
Set-Content -LiteralPath $_ `
-Value $content `
-Encoding UTF8 `
-NoNewline
}
}

View File

@@ -1,7 +0,0 @@
file(APPEND ${CURRENT_PACKAGES_DIR}/include/boost/config/user.hpp "\n#ifndef BOOST_ALL_NO_LIB\n#define BOOST_ALL_NO_LIB\n#endif\n")
file(APPEND ${CURRENT_PACKAGES_DIR}/include/boost/config/user.hpp "\n#undef BOOST_ALL_DYN_LINK\n")
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
file(APPEND ${CURRENT_PACKAGES_DIR}/include/boost/config/user.hpp "\n#define BOOST_ALL_DYN_LINK\n")
endif()
file(COPY ${SOURCE_PATH}/checks DESTINATION ${CURRENT_PACKAGES_DIR}/share/boost-config)

View File

@@ -1,2 +0,0 @@
file(COPY ${SOURCE_PATH}/tools/check DESTINATION ${CURRENT_PACKAGES_DIR}/share/boost-predef)

View File

@@ -1,14 +0,0 @@
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib/manual-link)
file(GLOB MONITOR_LIBS ${CURRENT_PACKAGES_DIR}/lib/*_exec_monitor*)
file(COPY ${MONITOR_LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/lib/manual-link)
file(REMOVE ${MONITOR_LIBS})
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link)
file(GLOB DEBUG_MONITOR_LIBS ${CURRENT_PACKAGES_DIR}/debug/lib/*_exec_monitor*)
file(COPY ${DEBUG_MONITOR_LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link)
file(REMOVE ${DEBUG_MONITOR_LIBS})
endif()

View File

@@ -1,5 +0,0 @@
vcpkg_replace_string("${SOURCE_PATH}/build/Jamfile.v2"
"project.load [ path.join [ path.make $(here:D) ] ../../config/checks/architecture ]"
"project.load [ path.join [ path.make $(here:D) ] ../config/checks/architecture ]"
)
file(COPY "${CURRENT_INSTALLED_DIR}/share/boost-config/checks" DESTINATION "${SOURCE_PATH}/config")

View File

@@ -1,5 +0,0 @@
vcpkg_replace_string("${SOURCE_PATH}/build/Jamfile.v2"
"import ../../config/checks/config"
"import ../config/checks/config"
)
file(COPY "${CURRENT_INSTALLED_DIR}/share/boost-config/checks" DESTINATION "${SOURCE_PATH}/config")

View File

@@ -1,5 +0,0 @@
vcpkg_replace_string("${SOURCE_PATH}/build/Jamfile.v2"
"import ../../config/checks/config"
"import ../config/checks/config"
)
file(COPY "${CURRENT_INSTALLED_DIR}/share/boost-config/checks" DESTINATION "${SOURCE_PATH}/config")

View File

@@ -1,5 +0,0 @@
vcpkg_replace_string("${SOURCE_PATH}/build/Jamfile"
"import ../../config/checks/config"
"import ../config/checks/config"
)
file(COPY "${CURRENT_INSTALLED_DIR}/share/boost-config/checks" DESTINATION "${SOURCE_PATH}/config")

View File

@@ -1,9 +0,0 @@
file(READ "${SOURCE_PATH}/build/Jamfile.v2" _contents)
string(REPLACE "import ../../config/checks/config" "import ../config/checks/config" _contents "${_contents}")
string(REPLACE " <conditional>@select-arch-specific-sources" "#<conditional>@select-arch-specific-sources" _contents "${_contents}")
file(WRITE "${SOURCE_PATH}/build/Jamfile.v2" "${_contents}")
vcpkg_replace_string("${SOURCE_PATH}/build/log-arch-config.jam"
"project.load [ path.join [ path.make $(here:D) ] ../../config/checks/architecture ]"
"project.load [ path.join [ path.make $(here:D) ] ../config/checks/architecture ]"
)
file(COPY "${CURRENT_INSTALLED_DIR}/share/boost-config/checks" DESTINATION "${SOURCE_PATH}/config")

View File

@@ -1,5 +0,0 @@
vcpkg_replace_string("${SOURCE_PATH}/build/Jamfile.v2"
"import ../../config/checks/config"
"import ../config/checks/config"
)
file(COPY "${CURRENT_INSTALLED_DIR}/share/boost-config/checks" DESTINATION "${SOURCE_PATH}/config")

View File

@@ -1,5 +0,0 @@
vcpkg_replace_string("${SOURCE_PATH}/build/Jamfile.v2"
"import ../../predef/check/predef"
"import ../predef/check/predef"
)
file(COPY "${CURRENT_INSTALLED_DIR}/share/boost-predef/check" DESTINATION "${SOURCE_PATH}/predef")

View File

@@ -1,5 +0,0 @@
vcpkg_replace_string("${SOURCE_PATH}/build/Jamfile.v2"
"import ../../config/checks/config"
"import ../config/checks/config"
)
file(COPY "${CURRENT_INSTALLED_DIR}/share/boost-config/checks" DESTINATION "${SOURCE_PATH}/config")

View File

@@ -1,82 +0,0 @@
[CmdletBinding()]
param(
$badParam,
[Parameter(Mandatory=$False)][switch]$win64 = $false,
[Parameter(Mandatory=$False)][string]$withVSPath = "",
[Parameter(Mandatory=$False)][string]$withWinSDK = "",
[Parameter(Mandatory=$False)][switch]$disableMetrics = $false
)
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."
}
}
if ($win64)
{
Write-Warning "-win64 no longer has any effect; ignored."
}
if (-Not [string]::IsNullOrWhiteSpace($withVSPath))
{
Write-Warning "-withVSPath no longer has any effect; ignored."
}
if (-Not [string]::IsNullOrWhiteSpace($withWinSDK))
{
Write-Warning "-withWinSDK no longer has any effect; ignored."
}
$scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition
$vcpkgRootDir = $scriptsDir
while (!($vcpkgRootDir -eq "") -and !(Test-Path "$vcpkgRootDir\.vcpkg-root"))
{
Write-Verbose "Examining $vcpkgRootDir for .vcpkg-root"
$vcpkgRootDir = Split-path $vcpkgRootDir -Parent
}
Write-Verbose "Examining $vcpkgRootDir for .vcpkg-root - Found"
$versionDate = '2022-06-17'
if ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64' -or $env:PROCESSOR_IDENTIFIER -match "ARMv[8,9] \(64-bit\)") {
& "$scriptsDir/tls12-download.exe" github.com "/microsoft/vcpkg-tool/releases/download/$versionDate/vcpkg-arm64.exe" "$vcpkgRootDir\vcpkg.exe"
} else {
& "$scriptsDir/tls12-download.exe" github.com "/microsoft/vcpkg-tool/releases/download/$versionDate/vcpkg.exe" "$vcpkgRootDir\vcpkg.exe"
}
Write-Host ""
if ($LASTEXITCODE -ne 0)
{
Write-Error "Downloading vcpkg.exe failed. Please check your internet connection, or consider downloading a recent vcpkg.exe from https://github.com/microsoft/vcpkg-tool with a browser."
throw
}
if ($disableMetrics)
{
Set-Content -Value "" -Path "$vcpkgRootDir\vcpkg.disable-metrics" -Force
}
elseif (-Not (Test-Path "$vcpkgRootDir\vcpkg.disable-metrics"))
{
# Note that we intentionally leave any existing vcpkg.disable-metrics; once a user has
# opted out they should stay opted out.
Write-Host @"
Telemetry
---------
vcpkg collects usage data in order to help us improve your experience.
The data collected by Microsoft is anonymous.
You can opt-out of telemetry by re-running the bootstrap-vcpkg script with -disableMetrics,
passing --disable-metrics to vcpkg on the command line,
or by setting the VCPKG_DISABLE_METRICS environment variable.
Read more about vcpkg telemetry at docs/about/privacy.md
"@
}

View File

@@ -1,267 +0,0 @@
#!/bin/sh
# Find .vcpkg-root.
vcpkgRootDir=$(X= cd -- "$(dirname -- "$0")" && pwd -P)
while [ "$vcpkgRootDir" != "/" ] && ! [ -e "$vcpkgRootDir/.vcpkg-root" ]; do
vcpkgRootDir="$(dirname "$vcpkgRootDir")"
done
# Parse arguments.
vcpkgDisableMetrics="OFF"
vcpkgUseSystem=false
vcpkgUseMuslC="OFF"
for var in "$@"
do
if [ "$var" = "-disableMetrics" -o "$var" = "--disableMetrics" ]; then
vcpkgDisableMetrics="ON"
elif [ "$var" = "-useSystemBinaries" -o "$var" = "--useSystemBinaries" ]; then
echo "Warning: -useSystemBinaries no longer has any effect; ignored. Note that the VCPKG_USE_SYSTEM_BINARIES environment variable behavior is not changed."
elif [ "$var" = "-allowAppleClang" -o "$var" = "--allowAppleClang" ]; then
echo "Warning: -allowAppleClang no longer has any effect; ignored."
elif [ "$var" = "-buildTests" ]; then
echo "Warning: -buildTests no longer has any effect; ignored."
elif [ "$var" = "-musl" ]; then
vcpkgUseMuslC="ON"
elif [ "$var" = "-help" -o "$var" = "--help" ]; then
echo "Usage: ./bootstrap-vcpkg.sh [options]"
echo
echo "Options:"
echo " -help Display usage help"
echo " -disableMetrics Mark this vcpkg root to disable metrics."
echo " -musl Use the musl binary rather than the glibc binary on Linux."
exit 1
else
echo "Unknown argument $var. Use '-help' for help."
exit 1
fi
done
# Enable using this entry point on windows from git bash by redirecting to the .bat file.
unixName=$(uname -s | sed 's/MINGW.*_NT.*/MINGW_NT/')
if [ "$unixName" = "MINGW_NT" ]; then
if [ "$vcpkgDisableMetrics" = "ON" ]; then
args="-disableMetrics"
else
args=""
fi
vcpkgRootDir=$(cygpath -aw "$vcpkgRootDir")
cmd "/C $vcpkgRootDir\\bootstrap-vcpkg.bat $args" || exit 1
exit 0
fi
# Determine the downloads directory.
if [ -z ${VCPKG_DOWNLOADS+x} ]; then
downloadsDir="$vcpkgRootDir/downloads"
else
downloadsDir="$VCPKG_DOWNLOADS"
if [ ! -d "$VCPKG_DOWNLOADS" ]; then
echo "VCPKG_DOWNLOADS was set to '$VCPKG_DOWNLOADS', but that was not a directory."
exit 1
fi
fi
# Check for minimal prerequisites.
vcpkgCheckRepoTool()
{
__tool=$1
if ! command -v "$__tool" >/dev/null 2>&1 ; then
echo "Could not find $__tool. Please install it (and other dependencies) with:"
echo "On Debian and Ubuntu derivatives:"
echo " sudo apt-get install curl zip unzip tar"
echo "On recent Red Hat and Fedora derivatives:"
echo " sudo dnf install curl zip unzip tar"
echo "On older Red Hat and Fedora derivatives:"
echo " sudo yum install curl zip unzip tar"
echo "On SUSE Linux and derivatives:"
echo " sudo zypper install curl zip unzip tar"
echo "On Arch Linux and derivatives:"
echo " sudo pacman -S curl zip unzip tar cmake ninja"
echo "On Alpine:"
echo " apk add build-base cmake ninja zip unzip curl git"
echo " (and export VCPKG_FORCE_SYSTEM_BINARIES=1)"
exit 1
fi
}
vcpkgCheckRepoTool curl
vcpkgCheckRepoTool zip
vcpkgCheckRepoTool unzip
vcpkgCheckRepoTool tar
UNAME="$(uname)"
ARCH="$(uname -m)"
if [ -e /etc/alpine-release ]; then
vcpkgUseSystem="ON"
vcpkgUseMuslC="ON"
fi
if [ "$UNAME" = "OpenBSD" ]; then
vcpkgUseSystem="ON"
if [ -z "$CXX" ]; then
CXX=/usr/bin/clang++
fi
if [ -z "$CC" ]; then
CC=/usr/bin/clang
fi
fi
if [ "$vcpkgUseSystem" = "ON" ]; then
vcpkgCheckRepoTool cmake
vcpkgCheckRepoTool ninja
vcpkgCheckRepoTool git
vcpkgCheckRepoTool gcc
fi
# Determine what we are going to do to bootstrap:
# MacOS -> Download vcpkg-macos
# Linux
# useMuslC -> download vcpkg-muslc
# amd64 -> download vcpkg-glibc
# Otherwise
# Download and build from source
# Choose the vcpkg binary to download
vcpkgDownloadTool="ON"
vcpkgToolReleaseTag="2022-06-17"
if [ "$UNAME" = "Darwin" ]; then
echo "Downloading vcpkg-macos..."
vcpkgToolReleaseSha="66ef24562d0a165d9462a3b3cc2e6ff728e26ab529aa4406dffb107492c1e91277fee4b187e776ae7a7730c5ff8cfb1063822852493b156e03151c730b509b2b"
vcpkgToolName="vcpkg-macos"
elif [ "$vcpkgUseMuslC" = "ON" ]; then
echo "Downloading vcpkg-muslc..."
vcpkgToolReleaseSha="28533a64c0d876fdf78f7ed301847063b3ff0c2593cac6df3b0d38a5e09174cd8770caf985476523dab6f740b54c7400c8542e8df63fd094b5956a35d8579989"
vcpkgToolName="vcpkg-muslc"
elif [ "$ARCH" = "x86_64" ]; then
echo "Downloading vcpkg-glibc..."
vcpkgToolReleaseSha="c85ec50df0de9648e1c5bdb690aa38d6c2ad2d9e5f92cd77648966f44f9b45418374925aacf5bbff0c608145f58dc9cd3391368e441e8254145c39ab1ae1fd33"
vcpkgToolName="vcpkg-glibc"
else
echo "Unable to determine a binary release of vcpkg; attempting to build from source."
vcpkgDownloadTool="OFF"
vcpkgToolReleaseSha="e52a359617c283932b4e4a33f4fa288fbe06edd676e4248b5543b83573a378dbf30c021395045e0726e69d4b5d41b012fd61af5eb4d586a1fb793c16bd64b77c"
fi
# Do the download or build.
vcpkgCheckEqualFileHash()
{
url=$1; filePath=$2; expectedHash=$3
if command -v "sha512sum" >/dev/null 2>&1 ; then
actualHash=$(sha512sum "$filePath")
else
# sha512sum is not available by default on osx
# shasum is not available by default on Fedora
actualHash=$(shasum -a 512 "$filePath")
fi
actualHash="${actualHash%% *}" # shasum returns [hash filename], so get the first word
if ! [ "$expectedHash" = "$actualHash" ]; then
echo ""
echo "File does not have expected hash:"
echo " url: [ $url ]"
echo " File path: [ $downloadPath ]"
echo " Expected hash: [ $sha512 ]"
echo " Actual hash: [ $actualHash ]"
exit 1
fi
}
vcpkgDownloadFile()
{
url=$1; downloadPath=$2 sha512=$3
rm -rf "$downloadPath.part"
curl -L $url --tlsv1.2 --create-dirs --retry 3 --output "$downloadPath.part" --silent --show-error --fail || exit 1
vcpkgCheckEqualFileHash $url "$downloadPath.part" $sha512
chmod +x "$downloadPath.part"
mv "$downloadPath.part" "$downloadPath"
}
vcpkgExtractTar()
{
archive=$1; toPath=$2
rm -rf "$toPath" "$toPath.partial"
mkdir -p "$toPath.partial"
$(cd "$toPath.partial" && tar xzf "$archive")
mv "$toPath.partial" "$toPath"
}
if [ "$vcpkgDownloadTool" = "ON" ]; then
vcpkgDownloadFile "https://github.com/microsoft/vcpkg-tool/releases/download/$vcpkgToolReleaseTag/$vcpkgToolName" "$vcpkgRootDir/vcpkg" $vcpkgToolReleaseSha
else
if [ "x$CXX" = "x" ]; then
if which g++-12 >/dev/null 2>&1; then
CXX=g++-12
elif which g++-11 >/dev/null 2>&1; then
CXX=g++-11
elif which g++-10 >/dev/null 2>&1; then
CXX=g++-10
elif which g++-9 >/dev/null 2>&1; then
CXX=g++-9
elif 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
elif which g++ >/dev/null 2>&1; then
CXX=g++
fi
# If we can't find g++, allow CMake to do the look-up
fi
vcpkgToolReleaseTarball="$vcpkgToolReleaseTag.tar.gz"
vcpkgToolUrl="https://github.com/microsoft/vcpkg-tool/archive/$vcpkgToolReleaseTarball"
baseBuildDir="$vcpkgRootDir/buildtrees/_vcpkg"
buildDir="$baseBuildDir/build"
tarballPath="$downloadsDir/$vcpkgToolReleaseTarball"
srcBaseDir="$baseBuildDir/src"
srcDir="$srcBaseDir/vcpkg-tool-$vcpkgToolReleaseTag"
if [ -e "$tarballPath" ]; then
vcpkgCheckEqualFileHash "$vcpkgToolUrl" "$tarballPath" "$vcpkgToolReleaseSha"
else
echo "Downloading vcpkg tool sources"
vcpkgDownloadFile "$vcpkgToolUrl" "$tarballPath" "$vcpkgToolReleaseSha"
fi
echo "Building vcpkg-tool..."
rm -rf "$baseBuildDir"
mkdir -p "$buildDir"
vcpkgExtractTar "$tarballPath" "$srcBaseDir"
cmakeConfigOptions="-DCMAKE_BUILD_TYPE=Release -G 'Ninja' -DVCPKG_DEVELOPMENT_WARNINGS=OFF"
if [ "${VCPKG_MAX_CONCURRENCY}" != "" ] ; then
cmakeConfigOptions=" $cmakeConfigOptions '-DCMAKE_JOB_POOL_COMPILE:STRING=compile' '-DCMAKE_JOB_POOL_LINK:STRING=link' '-DCMAKE_JOB_POOLS:STRING=compile=$VCPKG_MAX_CONCURRENCY;link=$VCPKG_MAX_CONCURRENCY' "
fi
(cd "$buildDir" && CXX="$CXX" eval cmake "$srcDir" $cmakeConfigOptions) || exit 1
(cd "$buildDir" && cmake --build .) || exit 1
rm -rf "$vcpkgRootDir/vcpkg"
cp "$buildDir/vcpkg" "$vcpkgRootDir/"
fi
# Apply the disable-metrics marker file.
if [ "$vcpkgDisableMetrics" = "ON" ]; then
touch "$vcpkgRootDir/vcpkg.disable-metrics"
elif ! [ -f "$vcpkgRootDir/vcpkg.disable-metrics" ]; then
# Note that we intentionally leave any existing vcpkg.disable-metrics; once a user has
# opted out they should stay opted out.
cat <<EOF
Telemetry
---------
vcpkg collects usage data in order to help us improve your experience.
The data collected by Microsoft is anonymous.
You can opt-out of telemetry by re-running the bootstrap-vcpkg script with -disableMetrics,
passing --disable-metrics to vcpkg on the command line,
or by setting the VCPKG_DISABLE_METRICS environment variable.
Read more about vcpkg telemetry at docs/about/privacy.md
EOF
fi

View File

@@ -1,43 +0,0 @@
set(BUILD_INFO_FILE_PATH ${CURRENT_PACKAGES_DIR}/BUILD_INFO)
file(WRITE ${BUILD_INFO_FILE_PATH} "CRTLinkage: ${VCPKG_CRT_LINKAGE}\n")
file(APPEND ${BUILD_INFO_FILE_PATH} "LibraryLinkage: ${VCPKG_LIBRARY_LINKAGE}\n")
if (DEFINED VCPKG_POLICY_DLLS_WITHOUT_LIBS)
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyDLLsWithoutLIBs: ${VCPKG_POLICY_DLLS_WITHOUT_LIBS}\n")
endif()
if (DEFINED VCPKG_POLICY_DLLS_WITHOUT_EXPORTS)
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyDLLsWithoutExports: ${VCPKG_POLICY_DLLS_WITHOUT_EXPORTS}\n")
endif()
if (DEFINED VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY)
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyDLLsInStaticLibrary: ${VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY}\n")
endif()
if (DEFINED VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES)
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyMismatchedNumberOfBinaries: ${VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES}\n")
endif()
if (DEFINED VCPKG_POLICY_EMPTY_PACKAGE)
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyEmptyPackage: ${VCPKG_POLICY_EMPTY_PACKAGE}\n")
endif()
if (DEFINED VCPKG_POLICY_ONLY_RELEASE_CRT)
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyOnlyReleaseCRT: ${VCPKG_POLICY_ONLY_RELEASE_CRT}\n")
endif()
if (DEFINED VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT)
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyAllowObsoleteMsvcrt: ${VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT}\n")
endif()
if (DEFINED VCPKG_POLICY_EMPTY_INCLUDE_FOLDER)
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyEmptyIncludeFolder: ${VCPKG_POLICY_EMPTY_INCLUDE_FOLDER}\n")
endif()
if (DEFINED VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS)
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyAllowRestrictedHeaders: ${VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS}\n")
endif()
if (DEFINED VCPKG_POLICY_SKIP_DUMPBIN_CHECKS)
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicySkipDumpbinChecks: ${VCPKG_POLICY_SKIP_DUMPBIN_CHECKS}\n")
endif()
if (DEFINED VCPKG_POLICY_SKIP_ARCHITECTURE_CHECK)
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicySkipArchitectureCheck: ${VCPKG_POLICY_SKIP_ARCHITECTURE_CHECK}\n")
endif()
if (DEFINED VCPKG_POLICY_CMAKE_HELPER_PORT)
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyCmakeHelperPort: ${VCPKG_POLICY_CMAKE_HELPER_PORT}\n")
endif()
if (DEFINED VCPKG_HEAD_VERSION)
file(APPEND ${BUILD_INFO_FILE_PATH} "Version: ${VCPKG_HEAD_VERSION}\n")
endif()

View File

@@ -1,104 +0,0 @@
#!/usr/bin/bash
# cl_cpp_wrapper
# Wrapper around MS's cl.exe to make it act more like Unix cpp
PATH="$PATH:/usr/bin"
case $MACHTYPE in
*-msys)
slash="-"
;;
*)
slash="/"
;;
esac
# prog specifies the program that should be run cl.exe
prog=cl.exe
debug=
cppopt=("${slash}nologo")
cppopt+=("${slash}E")
verbose=
shared_index=-1
processargs()
{
### Run through every option and convert it to the proper MS one
while test $# -gt 0; do
case "$1" in
-D*) optarg= ;;
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
gotparam=1
case "$1" in
--help)
usage
exit 0
;;
--verbose)
verbose=1
;;
-*)
# Remaining '-' options are passed to the compiler
if test x$optarg != x ; then
cppopt+=("${slash}${1:1}=$optarg")
else
cppopt+=("${slash}${1:1}")
fi
;;
/*)
# All '/' options are assumed to be for cpp and are passed through
cppopt+=("${slash}${1:1}")
;;
*)
file=$1
#cppopt+=("$1")
;;
esac
shift
done
}
# Whitespace in paths is dealt with by setting IFS and using bash arrays
# processargs $CPP_FLAGS
IFS=""
processargs $@
if test x$V = x1 ; then
verbose=1
fi
if test -n "$verbose" ; then
echo -n "$prog"
for opt in "${cppopt[@]}" ; do
echo -n " \"$opt\""
done
echo ""
fi
[ $# -ge 1 -a -f "$1" ] && input="$file" || input="-"
input_file="${file:-/proc/self/fd/0}"
if [ "$input_file" == "/proc/self/fd/0" ]; then
#echo "STDIN"
# CL does not support reading from STDIN so it is wrapped here.
tmpout=cpp_wrapper_$RANDOM.h
/usr/bin/cp $input_file $tmpout
# from https://stackoverflow.com/questions/36313562/how-to-redirect-stdin-to-file-in-bash
#exec 3> cppstdtmp.h
#while IFS= read -r line; do
# printf '%s' "$line"
#done
#exec 3<&-
#echo "$(</dev/stdin)" > cppstdtmp.h
exec $prog ${cppopt[@]} $tmpout
rm -f $tmpout
else
#echo "FILE"
exec $prog ${cppopt[@]} $input_file
fi

View File

@@ -1,128 +0,0 @@
#! /bin/sh
# Wrapper for windres to rc which do not understand '-i -o --output-format'.
# cvtres is invoked by the linker
scriptversion=2021-04-02.18; # UTC
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN* | MSYS*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/* | msys/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_windres_wrapper rc args...
# Adjust compile command to suit rc instead of windres
func_windres_wrapper ()
{
# Assume a capable shell
in=
out=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
eat=1
func_file_conv "$2"
out="$file"
echo "OUTPUT:$file"
set x "$@"
shift
;;
*.obj)
func_file_conv "$1"
out="$file"
echo "OUTPUT:$file"
set x "$@"
shift
;;
--output-format=*)
set x "$@"
shift
;;
-i)
eat=1
func_file_conv "$2" mingw
in="$file"
echo "INPUT:$file"
set x "$@"
shift
;;
-*)
set x "$@" "${1//\\\"/\"}"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
echo "$@" -fo "$out" "$in"
exec "$@" -fo "$out" "$in"
exit 1
}
eat=
func_windres_wrapper "$@"
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

View File

@@ -1,19 +0,0 @@
# native file used to make the build machine compiler unusable
[host_machine]
system = 'none'
cpu_family = 'none'
cpu = 'none'
endian = 'little'
[properties]
[binaries]
c = ['false']
cpp = ['false']
objc = ['false']
objcpp = ['false']
ar = ['false']
pkgconfig = ['false']
cmake = ['false']
ninja = ['false']

View File

@@ -1,378 +0,0 @@
[cmdletbinding()]
param([string]$targetBinary, [string]$installedDir, [string]$tlogFile, [string]$copiedFilesLog)
$g_searched = @{}
# Note: installedDir is actually the bin\ directory.
$g_install_root = Split-Path $installedDir -parent
$g_is_debug = (Split-Path $g_install_root -leaf) -eq 'debug'
# Ensure we create the copied files log, even if we don't end up copying any files
if ($copiedFilesLog)
{
Set-Content -Path $copiedFilesLog -Value "" -Encoding UTF8
}
function computeHash([System.Security.Cryptography.HashAlgorithm]$alg, [string]$str) {
$bytes = [System.Text.Encoding]::UTF8.GetBytes($str)
$hash = $alg.ComputeHash($bytes)
return [Convert]::ToBase64String($hash)
}
function getMutex([string]$targetDir) {
try {
$sha512Hash = [System.Security.Cryptography.SHA512]::Create()
if ($sha512Hash) {
$hash = (computeHash $sha512Hash $targetDir) -replace ('/' ,'-')
$mtxName = "VcpkgAppLocalDeployBinary-" + $hash
return New-Object System.Threading.Mutex($false, $mtxName)
}
return New-Object System.Threading.Mutex($false, "VcpkgAppLocalDeployBinary")
}
catch {
Write-Error -Message $_ -ErrorAction Stop
}
}
# Note: this function signature is depended upon by the qtdeploy.ps1 script introduced in 5.7.1-7
function deployBinary([string]$targetBinaryDir, [string]$SourceDir, [string]$targetBinaryName) {
try {
$mtx = getMutex($targetBinaryDir)
if ($mtx) {
$mtx.WaitOne() | Out-Null
}
$sourceBinaryFilePath = Join-Path $SourceDir $targetBinaryName
$targetBinaryFilePath = Join-Path $targetBinaryDir $targetBinaryName
if (Test-Path $targetBinaryFilePath) {
$sourceModTime = (Get-Item $sourceBinaryFilePath).LastWriteTime
$destModTime = (Get-Item $targetBinaryFilePath).LastWriteTime
if ($destModTime -lt $sourceModTime) {
Write-Verbose " ${targetBinaryName}: Updating from $sourceBinaryFilePath"
Copy-Item $sourceBinaryFilePath $targetBinaryDir
} else {
Write-Verbose " ${targetBinaryName}: already present"
}
}
else {
Write-Verbose " ${targetBinaryName}: Copying $sourceBinaryFilePath"
Copy-Item $sourceBinaryFilePath $targetBinaryDir
}
if ($copiedFilesLog) { Add-Content $copiedFilesLog $targetBinaryFilePath -Encoding UTF8 }
if ($tlogFile) { Add-Content $tlogFile $targetBinaryFilePath -Encoding Unicode }
} finally {
if ($mtx) {
$mtx.ReleaseMutex() | Out-Null
$mtx.Dispose() | Out-Null
}
}
}
Write-Verbose "Resolving base path $targetBinary..."
try
{
$baseBinaryPath = Resolve-Path $targetBinary -erroraction stop
$baseTargetBinaryDir = Split-Path $baseBinaryPath -parent
}
catch [System.Management.Automation.ItemNotFoundException]
{
return
}
# Note: this function signature is depended upon by the qtdeploy.ps1 script
function resolve([string]$targetBinary) {
Write-Verbose "Resolving $targetBinary..."
try
{
$targetBinaryPath = Resolve-Path $targetBinary -erroraction stop
}
catch [System.Management.Automation.ItemNotFoundException]
{
return
}
$targetBinaryDir = Split-Path $targetBinaryPath -parent
if (Get-Command "dumpbin" -ErrorAction SilentlyContinue) {
$a = $(dumpbin /DEPENDENTS $targetBinary | ? { $_ -match "^ [^ ].*\.dll" } | % { $_ -replace "^ ","" })
} elseif (Get-Command "llvm-objdump" -ErrorAction SilentlyContinue) {
$a = $(llvm-objdump -p $targetBinary| ? { $_ -match "^ {4}DLL Name: .*\.dll" } | % { $_ -replace "^ {4}DLL Name: ","" })
} elseif (Get-Command "objdump" -ErrorAction SilentlyContinue) {
$a = $(objdump -p $targetBinary| ? { $_ -match "^\tDLL Name: .*\.dll" } | % { $_ -replace "^\tDLL Name: ","" })
} else {
Write-Error "Neither dumpbin, llvm-objdump nor objdump could be found. Can not take care of dll dependencies."
}
$a | % {
if ([string]::IsNullOrEmpty($_)) {
return
}
if ($g_searched.ContainsKey($_)) {
Write-Verbose " ${_}: previously searched - Skip"
return
}
$g_searched.Set_Item($_, $true)
$installedItemFilePath = Join-Path $installedDir $_
$targetItemFilePath = Join-Path $targetBinaryDir $_
if (Test-Path $installedItemFilePath) {
deployBinary $baseTargetBinaryDir $installedDir "$_"
if (Test-Path function:\deployPluginsIfQt) { deployPluginsIfQt $baseTargetBinaryDir (Join-Path $g_install_root 'plugins') "$_" }
if (Test-Path function:\deployOpenNI2) { deployOpenNI2 $targetBinaryDir "$g_install_root" "$_" }
if (Test-Path function:\deployPluginsIfMagnum) {
if ($g_is_debug) {
deployPluginsIfMagnum $targetBinaryDir (Join-Path (Join-Path "$g_install_root" 'bin') 'magnum-d') "$_"
} else {
deployPluginsIfMagnum $targetBinaryDir (Join-Path (Join-Path "$g_install_root" 'bin') 'magnum') "$_"
}
}
if (Test-Path function:\deployAzureKinectSensorSDK) { deployAzureKinectSensorSDK $targetBinaryDir "$g_install_root" "$_" }
resolve (Join-Path $baseTargetBinaryDir "$_")
} elseif (Test-Path $targetItemFilePath) {
Write-Verbose " ${_}: $_ not found in $g_install_root; locally deployed"
resolve "$targetItemFilePath"
} else {
Write-Verbose " ${_}: $installedItemFilePath not found"
}
}
Write-Verbose "Done Resolving $targetBinary."
}
# Note: This is a hack to make Qt5 work.
# Introduced with Qt package version 5.7.1-7
if (Test-Path "$g_install_root\plugins\qtdeploy.ps1") {
. "$g_install_root\plugins\qtdeploy.ps1"
}
# Note: This is a hack to make OpenNI2 work.
if (Test-Path "$g_install_root\bin\OpenNI2\openni2deploy.ps1") {
. "$g_install_root\bin\OpenNI2\openni2deploy.ps1"
}
# Note: This is a hack to make Magnum work.
if (Test-Path "$g_install_root\bin\magnum\magnumdeploy.ps1") {
. "$g_install_root\bin\magnum\magnumdeploy.ps1"
} elseif (Test-Path "$g_install_root\bin\magnum-d\magnumdeploy.ps1") {
. "$g_install_root\bin\magnum-d\magnumdeploy.ps1"
}
# Note: This is a hack to make Azure Kinect Sensor SDK work.
if (Test-Path "$g_install_root\tools\azure-kinect-sensor-sdk\k4adeploy.ps1") {
. "$g_install_root\tools\azure-kinect-sensor-sdk\k4adeploy.ps1"
}
resolve($targetBinary)
Write-Verbose $($g_searched | out-string)
# SIG # Begin signature block
# MIIntwYJKoZIhvcNAQcCoIInqDCCJ6QCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCAw4oRiVyZP7w6g
# qWIJMRXurO+EoO/lf/MY7lRybXYZ/aCCDYEwggX/MIID56ADAgECAhMzAAACUosz
# qviV8znbAAAAAAJSMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMRMwEQYD
# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy
# b3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMTH01pY3Jvc29mdCBDb2RlIFNpZ25p
# bmcgUENBIDIwMTEwHhcNMjEwOTAyMTgzMjU5WhcNMjIwOTAxMTgzMjU5WjB0MQsw
# CQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9u
# ZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMR4wHAYDVQQDExVNaWNy
# b3NvZnQgQ29ycG9yYXRpb24wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
# AQDQ5M+Ps/X7BNuv5B/0I6uoDwj0NJOo1KrVQqO7ggR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RunnV+ZY7YkyQkdsN+I1Mbe2/KC85Eiy2X04qwPd5ACF68aMrdSGvI
# e4eO5pJEHRGkimm9Mm44QCLrxx0zbQIU16GBOWbSyD/oy54MkOreoiIuWhCVS6lN
# oJrOEaFbCsrUVMcGAc13YgcLbCw0V/YZNRLMakT9sbjYqfn4xRE3DO8PmyHlzDw8
# g6CzIZQExAVkyxY+ZHXf8HcR5n3DHfLGMxCu7o4O7+os0axGBrdSmHJBVuSF+0Q3
# 0OaF2MDIrMNYfhlQt5DxB2sw8EnyLctrW2Ve7wuq02gBM+BT2Ln66a9wzNK7HPKs
# rSkQg2stGl0hoCRPZ9geSm++3pbtFhzUMosPpfA9mirBELDpWg5YRF9gftRdUfJZ
# bLYStWVOB5OFNv2LpxoOdvVzqiigK3+LRrnlcWxPt6/6QqlC5EIFYOkMUw==
# SIG # End signature block

View File

@@ -1,80 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Rule Name="VcpkgOptions" DisplayName="vcpkg" PageTemplate="generic" Description="Vcpkg"
xmlns="http://schemas.microsoft.com/build/2009/properties">
<Rule.Categories>
<Category Name="General" DisplayName="General" Description="General Vcpkg Configuration" />
<Category Name="Conditional" DisplayName="Target and Configuration Specific" Description="Conditional Vcpkg Configuration" />
</Rule.Categories>
<Rule.DataSource>
<!-- Note: HasConfigurationCondition must be either "true" or ommitted. Otherwise, the vcpkg property sheet will not be displayed. -->
<!-- Note: Remove all instances of 'Label="Vcpkg"' from this file if the vcpkg property sheet does not display any values. -->
<DataSource Persistence="ProjectFile" Label="Vcpkg" HasConfigurationCondition="true" />
</Rule.DataSource>
<BoolProperty Name="VcpkgEnabled" DisplayName="Use Vcpkg" Category="General" Default="true"
Description="Use Vcpkg for includes and libraries.">
<BoolProperty.DataSource>
<DataSource Persistence="ProjectFile" Label="Vcpkg" HasConfigurationCondition="false" />
</BoolProperty.DataSource>
</BoolProperty>
<BoolProperty Name="VcpkgEnableManifest" DisplayName="Use Vcpkg Manifest" Category="General" Default="false"
Description="Use the vcpkg manifest file to define your dependencies.">
<BoolProperty.DataSource>
<DataSource Persistence="ProjectFile" Label="Vcpkg" HasConfigurationCondition="false" />
</BoolProperty.DataSource>
</BoolProperty>
<BoolProperty Name="VcpkgManifestInstall" DisplayName="Install Vcpkg Dependencies" Category="General" Default="true"
Description="Install dependencies from the vcpkg manifest.">
<BoolProperty.DataSource>
<DataSource Persistence="ProjectFile" Label="Vcpkg" HasConfigurationCondition="false" />
</BoolProperty.DataSource>
</BoolProperty>
<BoolProperty Name="VcpkgAutoLink" DisplayName="Use AutoLink" Category="General" Default="true"
Description="Enables automatic linking with libraries build using Vcpkg. Does not work with lld-link.exe.">
<BoolProperty.DataSource>
<DataSource Persistence="ProjectFile" Label="Vcpkg" HasConfigurationCondition="false" />
</BoolProperty.DataSource>
</BoolProperty>
<StringProperty Name="VcpkgRoot" DisplayName="Vcpkg Root" Category="General" Subtype="folder" Visible="false"
Description="Root path where Vcpkg is located. Be careful with changing this one. It is, for example, unable to update this property page from the new location without restarting visual studio.">
<StringProperty.DataSource>
<DataSource Persistence="ProjectFile" Label="Vcpkg" HasConfigurationCondition="false" />
</StringProperty.DataSource>
</StringProperty>
<StringProperty Name="VcpkgManifestRoot" DisplayName="Vcpkg Manifest Root" Category="General" Subtype="folder" Visible="false"
Description="The path to the directory which contains the manifest file, and the vcpkg_installed directory.">
<StringProperty.DataSource>
<DataSource Persistence="ProjectFile" Label="Vcpkg" HasConfigurationCondition="false" />
</StringProperty.DataSource>
</StringProperty>
<StringProperty Name="VcpkgInstalledDir" DisplayName="Installed Directory" Category="General" Subtype="folder" Visible="true"
Description="The location where headers and binaries will be consumed from. In manifest mode, this directory will be created and populated based on vcpkg.json.">
</StringProperty>
<BoolProperty Name="VcpkgUseStatic" DisplayName="Use Static Libraries" Category="Conditional" Default="false"
Description="Vcpkg can build static libraries (e.g. x64-windows-static). This options changes the default triplet to use these static libraries by appending -static to $(VcpkgTriplet). This will not be shown in the evaluation of the Triplet within the UI." />
<StringProperty Name="VcpkgTriplet" DisplayName="Triplet" Category="Conditional" Subtype="Text"
Description="Specifies the triplet used by Vcpkg. Does not include the '-static' suffix that may be added by the 'Use static libraries' flag." />
<StringProperty Name="VcpkgHostTriplet" DisplayName="Host Triplet" Category="Conditional" Subtype="Text"
Description="Specifies the host triplet used by Vcpkg. If empty, this will be automatically determined." />
<StringProperty Name="VcpkgAdditionalInstallOptions" DisplayName="Additional Options" Category="General" Subtype="Text"
Description="Additional command line options to be passed to the underlying vcpkg tool when installing in manifest mode." />
<EnumProperty Name="VcpkgConfiguration" DisplayName="Vcpkg Configuration" Category="Conditional"
Description="Specifies if release or debug libraries build with vcpkg should be used.">
<EnumValue Name="Release" Description="Uses release libraries" />
<EnumValue Name="Debug" Description="Uses debug libraries" />
</EnumProperty>
</Rule>

View File

@@ -1,21 +0,0 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Do not define derived properties here. This file may be imported once and some of the properties below may be overridden afterwards -->
<PropertyGroup>
<VcpkgPropsImported>true</VcpkgPropsImported>
<VcpkgEnabled Condition="'$(VcpkgEnabled)' == ''">true</VcpkgEnabled>
<VcpkgConfiguration Condition="'$(VcpkgConfiguration)' == ''">$(Configuration)</VcpkgConfiguration>
<VcpkgUseStatic Condition="'$(VcpkgUseStatic)' == ''">false</VcpkgUseStatic>
<VcpkgRoot Condition="'$(VcpkgRoot)' == ''">$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\..\..'))</VcpkgRoot>
<VcpkgAutoLink Condition="'$(VcpkgAutoLink)' == ''">true</VcpkgAutoLink>
<!-- 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'">false</VcpkgAutoLink>
<VcpkgApplocalDeps Condition="'$(VcpkgApplocalDeps)' == ''">true</VcpkgApplocalDeps>
<!-- Manifest files -->
<VcpkgEnableManifest Condition="'$(VcpkgEnableManifest)' == ''">false</VcpkgEnableManifest>
<VcpkgManifestInstall Condition="'$(VcpkgManifestInstall)' == ''">true</VcpkgManifestInstall>
<VcpkgManifestRoot Condition="'$(VcpkgManifestRoot)' == ''">$([MSbuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), vcpkg.json))</VcpkgManifestRoot>
</PropertyGroup>
</Project>

View File

@@ -1,210 +0,0 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Import default properties if not done yet. This does not overwrite any previously defined properties. -->
<Import Condition="'$(VcpkgPropsImported)' != 'true'" Project="vcpkg.props" />
<!-- VS2015's version of "vcpkg integrate install" imports both the props and targets together in the "props" area,
meaning we have no opportunity to respond to user customizations in their project files. It also means that this
.targets must defend against normal properties being unset. (For example, VcpkgPlatformTarget below.)
Also, we copy all initial values to internal values to avoid properties being inconsistently evaluated in targets
and dependent properties.
-->
<PropertyGroup>
<_ZVcpkgRoot>$(VcpkgRoot)</_ZVcpkgRoot>
<_ZVcpkgManifestRoot>$(VcpkgManifestRoot)</_ZVcpkgManifestRoot>
<_ZVcpkgInstalledDir>$(VcpkgInstalledDir)</_ZVcpkgInstalledDir>
</PropertyGroup>
<!-- Add trailing slashes to inputs that must have them to conform with msbuild conventions. -->
<PropertyGroup>
<_ZVcpkgRoot Condition="!$(_ZVcpkgRoot.EndsWith('\'))">$(_ZVcpkgRoot)\</_ZVcpkgRoot>
<_ZVcpkgManifestRoot Condition="'$(_ZVcpkgManifestRoot)' != '' and !$(_ZVcpkgManifestRoot.EndsWith('\'))">$(_ZVcpkgManifestRoot)\</_ZVcpkgManifestRoot>
<_ZVcpkgInstalledDir Condition="'$(_ZVcpkgInstalledDir)' != '' and !$(_ZVcpkgInstalledDir.EndsWith('\'))">$(_ZVcpkgInstalledDir)\</_ZVcpkgInstalledDir>
</PropertyGroup>
<!-- Determine the triplet to use. Note that $(PlatformTarget) is not available at the top of the .vcxproj file. -->
<PropertyGroup Condition="'$(VcpkgOSTarget)' == ''">
<VcpkgOSTarget>windows</VcpkgOSTarget>
<VcpkgOSTarget Condition="'$(AppContainerApplication)' == 'true'">uwp</VcpkgOSTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(VcpkgPlatformTarget)' == ''">
<VcpkgPlatformTarget>$(Platform)</VcpkgPlatformTarget>
<VcpkgPlatformTarget Condition="'$(Platform)' == 'Win32'">x86</VcpkgPlatformTarget>
</PropertyGroup>
<PropertyGroup>
<_ZVcpkgLinkage />
<_ZVcpkgLinkage Condition="'$(VcpkgUseStatic)' == 'true'">-static</_ZVcpkgLinkage>
<VcpkgTriplet Condition="'$(VcpkgTriplet)' == ''">$(VcpkgPlatformTarget)-$(VcpkgOSTarget)$(_ZVcpkgLinkage)</VcpkgTriplet>
</PropertyGroup>
<!-- Include the triplet in ProjectStateLine to force VS2017 and later to fully rebuild if the user changes it. -->
<PropertyGroup>
<ProjectStateLine>VcpkgTriplet=$(VcpkgTriplet):$(ProjectStateLine)</ProjectStateLine>
</PropertyGroup>
<!-- Determine the locations trees we want to consume. _ZVcpkgInstalledDir is special in that it doesn't have a default
value in the .props because we normally derive it, but users may override the value. -->
<Choose>
<When Condition="'$(VcpkgEnableManifest)' == 'true'">
<PropertyGroup>
<_ZVcpkgInstalledDir Condition="'$(_ZVcpkgInstalledDir)' == ''">$(_ZVcpkgManifestRoot)vcpkg_installed\$(VcpkgTriplet)\</_ZVcpkgInstalledDir>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<_ZVcpkgInstalledDir Condition="'$(_ZVcpkgInstalledDir)' == ''">$(_ZVcpkgRoot)installed\</_ZVcpkgInstalledDir>
</PropertyGroup>
</Otherwise>
</Choose>
<PropertyGroup>
<_ZVcpkgCurrentInstalledDir>$(_ZVcpkgInstalledDir)$(VcpkgTriplet)\</_ZVcpkgCurrentInstalledDir>
<_ZVcpkgNormalizedConfiguration Condition="$(VcpkgConfiguration.StartsWith('Debug'))">Debug</_ZVcpkgNormalizedConfiguration>
<_ZVcpkgNormalizedConfiguration Condition="$(VcpkgConfiguration.StartsWith('Release')) or '$(VcpkgConfiguration)' == 'RelWithDebInfo' or '$(VcpkgConfiguration)' == 'MinSizeRel'">Release</_ZVcpkgNormalizedConfiguration>
<_ZVcpkgConfigSubdir Condition="'$(_ZVcpkgNormalizedConfiguration)' == 'Debug'">debug\</_ZVcpkgConfigSubdir>
<_ZVcpkgExecutable>$(_ZVcpkgRoot)vcpkg.exe</_ZVcpkgExecutable>
<ExternalIncludePath>$(ExternalIncludePath);$(_ZVcpkgCurrentInstalledDir)include</ExternalIncludePath>
</PropertyGroup>
<PropertyGroup>
<!-- Note: Overwrite VcpkgPageSchema with a non-existing path to disable the VcPkg property sheet in your projects -->
<VcpkgPageSchema Condition="'$(VcpkgPageSchema)' == ''">$(_ZVcpkgRoot)scripts\buildsystems\msbuild\vcpkg-general.xml</VcpkgPageSchema>
</PropertyGroup>
<ItemGroup Condition="'$(VcpkgPageSchema)' != '' and exists('$(VcpkgPageSchema)') and '$(MSBuildToolsVersion)' != '14.0'">
<PropertyPageSchema Include="$(VcpkgPageSchema)">
<Context>Project</Context>
</PropertyPageSchema>
</ItemGroup>
<!-- Install settings to get headers and import libs for the currently selected _ZVcpkgCurrentInstalledDir -->
<ItemDefinitionGroup Condition="'$(VcpkgEnabled)' == 'true'">
<Lib>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories);$(_ZVcpkgCurrentInstalledDir)$(_ZVcpkgConfigSubdir)lib;$(_ZVcpkgCurrentInstalledDir)$(_ZVcpkgConfigSubdir)lib\manual-link</AdditionalLibraryDirectories>
</Lib>
<Link>
<AdditionalDependencies Condition="'$(VcpkgAutoLink)' != 'false'">%(AdditionalDependencies);$(_ZVcpkgCurrentInstalledDir)$(_ZVcpkgConfigSubdir)lib\*.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories);$(_ZVcpkgCurrentInstalledDir)$(_ZVcpkgConfigSubdir)lib;$(_ZVcpkgCurrentInstalledDir)$(_ZVcpkgConfigSubdir)lib\manual-link</AdditionalLibraryDirectories>
</Link>
<ClCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(_ZVcpkgCurrentInstalledDir)include</AdditionalIncludeDirectories>
</ClCompile>
<ResourceCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(_ZVcpkgCurrentInstalledDir)include</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<Target Name="VcpkgCheckManifestRoot" BeforeTargets="VcpkgInstallManifestDependencies" Condition="'$(VcpkgEnabled)' == 'true'">
<Error Text="The vcpkg manifest was enabled, but we couldn't find a manifest file (vcpkg.json) in any directories above $(MSBuildProjectDirectory). Please add a manifest, disable manifests in your properties page, or pass /p:VcpkgEnableManifest=false."
Condition="'$(VcpkgEnableManifest)' == 'true' and '$(_ZVcpkgManifestRoot)' == ''" />
<Message Text="The vcpkg manifest was disabled, but we found a manifest file in $(_ZVcpkgManifestRoot). You may want to enable vcpkg manifests in your properties page or pass /p:VcpkgEnableManifest=true to the msbuild invocation."
Importance="High" Condition="'$(VcpkgEnableManifest)' != 'true' and '$(_ZVcpkgManifestRoot)' != ''" />
</Target>
<Target Name="VcpkgTripletSelection" BeforeTargets="ClCompile">
<Message Text="Using triplet &quot;$(VcpkgTriplet)&quot; from &quot;$(_ZVcpkgCurrentInstalledDir)&quot;"
Importance="Normal" Condition="'$(VcpkgEnabled)' == 'true'"/>
<Message Text="Not using Vcpkg because VcpkgEnabled is &quot;$(VcpkgEnabled)&quot;"
Importance="Normal" Condition="'$(VcpkgEnabled)' != 'true'"/>
<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 '$(_ZVcpkgNormalizedConfiguration)' == ''"/>
</Target>
<Choose>
<When Condition="'$(VcpkgHostTriplet)' != ''">
<PropertyGroup>
<_ZVcpkgHostTripletParameter>"--host-triplet=$(VcpkgHostTriplet)"</_ZVcpkgHostTripletParameter>
<_ZVcpkgHostTripletSuffix>$(VcpkgHostTriplet).</_ZVcpkgHostTripletSuffix>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<_ZVcpkgHostTripletParameter />
<_ZVcpkgHostTripletSuffix />
</PropertyGroup>
</Otherwise>
</Choose>
<PropertyGroup>
<_ZVcpkgManifestFileLocation>$(_ZVcpkgManifestRoot)vcpkg.json</_ZVcpkgManifestFileLocation>
<_ZVcpkgConfigurationFileLocation>$(_ZVcpkgManifestRoot)vcpkg-configuration.json</_ZVcpkgConfigurationFileLocation>
<_ZVcpkgMSBuildStampFile>$(_ZVcpkgInstalledDir).msbuildstamp-$(VcpkgTriplet).$(_ZVcpkgHostTripletSuffix)stamp</_ZVcpkgMSBuildStampFile>
</PropertyGroup>
<ItemGroup Condition="'$(VcpkgEnabled)' == 'true'">
<_ZVcpkgInstallManifestDependenciesInputs Include="$(_ZVcpkgManifestFileLocation)"/>
<_ZVcpkgInstallManifestDependenciesInputs Include="$(_ZVcpkgConfigurationFileLocation)" Condition="Exists('$(_ZVcpkgConfigurationFileLocation)')"/>
</ItemGroup>
<Target Name="VcpkgInstallManifestDependencies" BeforeTargets="ClCompile"
Condition="'$(VcpkgEnabled)' == 'true' and '$(VcpkgEnableManifest)' == 'true' and '$(VcpkgManifestInstall)' == 'true'"
Inputs="@(_ZVcpkgInstallManifestDependenciesInputs)"
Outputs="$(_ZVcpkgMSBuildStampFile)">
<!-- This is set inside the target because $(TLogLocation) may not be set yet when parsing the .targets on VS2015 -->
<PropertyGroup>
<_ZVcpkgTLogFileLocation>$(TLogLocation)VcpkgInstallManifest$(VcpkgTriplet).$(_ZVcpkgHostTripletSuffix)read.1u.tlog</_ZVcpkgTLogFileLocation>
</PropertyGroup>
<Message Text="Installing vcpkg dependencies to $(_ZVcpkgInstalledDir)" Importance="High" />
<MakeDir Directories="$(_ZVcpkgInstalledDir)" />
<Message Text="%22$(_ZVcpkgExecutable)%22 install $(_ZVcpkgHostTripletParameter) --x-wait-for-lock --triplet %22$(VcpkgTriplet)%22 --vcpkg-root %22$(_ZVcpkgRoot)\%22 %22--x-manifest-root=$(_ZVcpkgManifestRoot)\%22 %22--x-install-root=$(_ZVcpkgInstalledDir)\%22 $(VcpkgAdditionalInstallOptions)"
Importance="High" />
<Exec Command="%22$(_ZVcpkgExecutable)%22 install $(_ZVcpkgHostTripletParameter) --x-wait-for-lock --triplet %22$(VcpkgTriplet)%22 --vcpkg-root %22$(_ZVcpkgRoot)\%22 %22--x-manifest-root=$(_ZVcpkgManifestRoot)\%22 %22--x-install-root=$(_ZVcpkgInstalledDir)\%22 $(VcpkgAdditionalInstallOptions)"
StandardOutputImportance="High" />
<WriteLinesToFile File="$(_ZVcpkgTLogFileLocation)"
Lines="@(_ZVcpkgInstallManifestDependenciesInputs -> '^%(Identity)')"
Encoding="Unicode"
Overwrite="true"/>
<Touch Files="$(_ZVcpkgMSBuildStampFile)" AlwaysCreate="true" />
<CreateProperty Value="false">
<Output TaskParameter="ValueSetByTask" PropertyName="Link_MinimalRebuildFromTracking" />
</CreateProperty>
</Target>
<Target Name="AppLocalFromInstalled" AfterTargets="CopyFilesToOutputDirectory" BeforeTargets="CopyLocalFilesOutputGroup;RegisterOutput"
Condition="'$(VcpkgEnabled)' == 'true' and '$(VcpkgApplocalDeps)' == 'true' and '$(LinkSkippedExecution)' != 'true'">
<Message Text="[vcpkg] Starting VcpkgApplocalDeps" Importance="low" />
<PropertyGroup>
<_ZVcpkgAppLocalPowerShellCommonArguments>-ExecutionPolicy Bypass -noprofile -File "$(MSBuildThisFileDirectory)applocal.ps1" "$(TargetPath)" "$(_ZVcpkgCurrentInstalledDir)$(_ZVcpkgConfigSubdir)bin" "$(TLogLocation)$(ProjectName).write.1u.tlog" "$(IntDir)vcpkg.applocal.log"</_ZVcpkgAppLocalPowerShellCommonArguments>
</PropertyGroup>
<!-- Search %PATH% for pwsh.exe if it is available. -->
<Exec
Command="pwsh.exe $(_ZVcpkgAppLocalPowerShellCommonArguments)"
StandardOutputImportance="Normal"
StandardErrorImportance="Normal"
IgnoreExitCode="true"
UseCommandProcessor="false">
<Output TaskParameter="ExitCode"
PropertyName="_ZVcpkgAppLocalExitCode" />
</Exec>
<!-- Fall back to well known system PowerShell location otherwise. -->
<Message Text="[vcpkg] Failed to run applocal.ps1 using pwsh, falling back to system PowerShell." Importance="low"
Condition="$(_ZVcpkgAppLocalExitCode) == 9009" />
<Exec
Command="%22$(SystemRoot)\System32\WindowsPowerShell\v1.0\powershell.exe%22 $(_ZVcpkgAppLocalPowerShellCommonArguments)"
StandardOutputImportance="Normal"
StandardErrorImportance="Normal"
IgnoreExitCode="true"
UseCommandProcessor="false"
Condition="$(_ZVcpkgAppLocalExitCode) == 9009">
<Output TaskParameter="ExitCode"
PropertyName="_ZVcpkgAppLocalExitCode" />
</Exec>
<!-- We're ignoring the above exit codes, so translate into a warning if both failed. -->
<Warning Text="[vcpkg] Failed to gather app local DLL dependencies, program may not run. Set VcpkgApplocalDeps to false in your project file to suppress this warning. PowerShell arguments: $(_ZVcpkgAppLocalPowerShellCommonArguments)"
Condition="$(_ZVcpkgAppLocalExitCode) != 0"/>
<ReadLinesFromFile File="$(IntDir)vcpkg.applocal.log"
Condition="$(_ZVcpkgAppLocalExitCode) == 0">
<Output TaskParameter="Lines" ItemName="VcpkgAppLocalDLLs" />
</ReadLinesFromFile>
<Message Text="@(VcpkgAppLocalDLLs,'%0A')" Importance="Normal" Condition="$(_ZVcpkgAppLocalExitCode) == 0" />
<ItemGroup Condition="$(_ZVcpkgAppLocalExitCode) == 0">
<ReferenceCopyLocalPaths Include="@(VcpkgAppLocalDLLs)" />
</ItemGroup>
</Target>
</Project>

View File

@@ -1,425 +0,0 @@
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
finish the job started by macdeployqtfix
from: https://github.com/arl/macdeployqtfix
The MIT License (MIT)
Copyright (c) 2015 Aurelien Rainone
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
from subprocess import Popen, PIPE
from string import Template
import os
import sys
import logging
import argparse
import re
from collections import namedtuple
QTLIB_NAME_REGEX = r'^(?:@executable_path)?/.*/(Qt[a-zA-Z]*).framework/(?:Versions/\d/)?\1$'
QTLIB_NORMALIZED = r'$prefix/Frameworks/$qtlib.framework/Versions/$qtversion/$qtlib'
QTPLUGIN_NAME_REGEX = r'^(?:@executable_path)?/.*/[pP]lug[iI]ns/(.*)/(.*).dylib$'
QTPLUGIN_NORMALIZED = r'$prefix/PlugIns/$plugintype/$pluginname.dylib'
LOADERPATH_REGEX = r'^@[a-z_]+path/(.*)'
LOADERPATH_NORMALIZED = r'$prefix/Frameworks/$loaderpathlib'
class GlobalConfig(object):
logger = None
qtpath = None
exepath = None
def run_and_get_output(popen_args):
"""Run process and get all output"""
process_output = namedtuple('ProcessOutput', ['stdout', 'stderr', 'retcode'])
try:
GlobalConfig.logger.debug('run_and_get_output({0})'.format(repr(popen_args)))
proc = Popen(popen_args, stdin=PIPE, stdout=PIPE, stderr=PIPE)
stdout, stderr = proc.communicate(b'')
proc_out = process_output(stdout, stderr, proc.returncode)
GlobalConfig.logger.debug('\tprocess_output: {0}'.format(proc_out))
return proc_out
except Exception as exc:
GlobalConfig.logger.error('\texception: {0}'.format(exc))
return process_output('', exc.message, -1)
def get_dependencies(filename):
"""
input: filename must be an absolute path
Should call `otool` and returns the list of dependencies, unsorted,
unmodified, just the raw list so then we could eventually re-use in other
more specialized functions
"""
GlobalConfig.logger.debug('get_dependencies({0})'.format(filename))
popen_args = ['otool', '-L', filename]
proc_out = run_and_get_output(popen_args)
deps = []
if proc_out.retcode == 0:
# some string splitting
deps = [s.strip().split(b' ')[0].decode('utf-8') for s in proc_out.stdout.splitlines()[1:] if s]
# prevent infinite recursion when a binary depends on itself (seen with QtWidgets)...
deps = [s for s in deps if os.path.basename(filename) not in s]
return deps
def is_qt_plugin(filename):
"""
Checks if a given file is a qt plugin.
Accepts absolute path as well as path containing @executable_path
"""
qtlib_name_rgx = re.compile(QTPLUGIN_NAME_REGEX)
return qtlib_name_rgx.match(filename) is not None
def is_qt_lib(filename):
"""
Checks if a given file is a qt library.
Accepts absolute path as well as path containing @executable_path
"""
qtlib_name_rgx = re.compile(QTLIB_NAME_REGEX)
return qtlib_name_rgx.match(filename) is not None
def is_loader_path_lib(filename):
"""
Checks if a given file is loaded via @loader_path or @rpath
"""
qtlib_name_rgx = re.compile(LOADERPATH_REGEX)
return qtlib_name_rgx.match(filename) is not None
def normalize_qtplugin_name(filename):
"""
input: a path to a qt plugin, as returned by otool, that can have this form :
- an absolute path /../plugins/PLUGINTYPE/PLUGINNAME.dylib
- @executable_path/../plugins/PLUGINTYPE/PLUGINNAME.dylib
output:
a tuple (qtlib, abspath, rpath) where:
- qtname is the name of the plugin (libqcocoa.dylib, etc.)
- abspath is the absolute path of the qt lib inside the app bundle of exepath
- relpath is the correct rpath to a qt lib inside the app bundle
"""
GlobalConfig.logger.debug('normalize_plugin_name({0})'.format(filename))
qtplugin_name_rgx = re.compile(QTPLUGIN_NAME_REGEX)
rgxret = qtplugin_name_rgx.match(filename)
if not rgxret:
msg = 'couldn\'t normalize a non-qt plugin filename: {0}'.format(filename)
GlobalConfig.logger.critical(msg)
raise Exception(msg)
# qtplugin normalization settings
qtplugintype = rgxret.groups()[0]
qtpluginname = rgxret.groups()[1]
templ = Template(QTPLUGIN_NORMALIZED)
# from qtlib, forge 2 path :
# - absolute path of qt lib in bundle,
abspath = os.path.normpath(templ.safe_substitute(
prefix=os.path.dirname(GlobalConfig.exepath) + '/..',
plugintype=qtplugintype,
pluginname=qtpluginname))
# - and rpath containing @executable_path, relative to exepath
rpath = templ.safe_substitute(
prefix='@executable_path/..',
plugintype=qtplugintype,
pluginname=qtpluginname)
GlobalConfig.logger.debug('\treturns({0})'.format((qtpluginname, abspath, rpath)))
return qtpluginname, abspath, rpath
def normalize_qtlib_name(filename):
"""
input: a path to a qt library, as returned by otool, that can have this form :
- an absolute path /lib/xxx/yyy
- @executable_path/../Frameworks/QtSerialPort.framework/Versions/5/QtSerialPort
output:
a tuple (qtlib, abspath, rpath) where:
- qtlib is the name of the qtlib (QtCore, QtWidgets, etc.)
- abspath is the absolute path of the qt lib inside the app bundle of exepath
- relpath is the correct rpath to a qt lib inside the app bundle
"""
GlobalConfig.logger.debug('normalize_qtlib_name({0})'.format(filename))
qtlib_name_rgx = re.compile(QTLIB_NAME_REGEX)
rgxret = qtlib_name_rgx.match(filename)
if not rgxret:
msg = 'couldn\'t normalize a non-qt lib filename: {0}'.format(filename)
GlobalConfig.logger.critical(msg)
raise Exception(msg)
# qtlib normalization settings
qtlib = rgxret.groups()[0]
qtversion = 5
templ = Template(QTLIB_NORMALIZED)
# from qtlib, forge 2 path :
# - absolute path of qt lib in bundle,
abspath = os.path.normpath(templ.safe_substitute(
prefix=os.path.dirname(GlobalConfig.exepath) + '/..',
qtlib=qtlib,
qtversion=qtversion))
# - and rpath containing @executable_path, relative to exepath
rpath = templ.safe_substitute(
prefix='@executable_path/..',
qtlib=qtlib,
qtversion=qtversion)
GlobalConfig.logger.debug('\treturns({0})'.format((qtlib, abspath, rpath)))
return qtlib, abspath, rpath
def normalize_loaderpath_name(filename):
"""
input: a path to a loaderpath library, as returned by otool, that can have this form :
- an relative path @loaderpath/yyy
output:
a tuple (loaderpathlib, abspath, rpath) where:
- loaderpathlib is the name of the loaderpath lib
- abspath is the absolute path of the qt lib inside the app bundle of exepath
- relpath is the correct rpath to a qt lib inside the app bundle
"""
GlobalConfig.logger.debug('normalize_loaderpath_name({0})'.format(filename))
loaderpath_name_rgx = re.compile(LOADERPATH_REGEX)
rgxret = loaderpath_name_rgx.match(filename)
if not rgxret:
msg = 'couldn\'t normalize a loaderpath lib filename: {0}'.format(filename)
GlobalConfig.logger.critical(msg)
raise Exception(msg)
# loaderpath normalization settings
loaderpathlib = rgxret.groups()[0]
templ = Template(LOADERPATH_NORMALIZED)
# from loaderpath, forge 2 path :
# - absolute path of qt lib in bundle,
abspath = os.path.normpath(templ.safe_substitute(
prefix=os.path.dirname(GlobalConfig.exepath) + '/..',
loaderpathlib=loaderpathlib))
# - and rpath containing @executable_path, relative to exepath
rpath = templ.safe_substitute(
prefix='@executable_path/..',
loaderpathlib=loaderpathlib)
GlobalConfig.logger.debug('\treturns({0})'.format((loaderpathlib, abspath, rpath)))
return loaderpathlib, abspath, rpath
def fix_dependency(binary, dep):
"""
fix 'dep' dependency of 'binary'. 'dep' is a qt library
"""
if is_qt_lib(dep):
qtname, dep_abspath, dep_rpath = normalize_qtlib_name(dep)
qtnamesrc = os.path.join(GlobalConfig.qtpath, 'lib', '{0}.framework'.
format(qtname), qtname)
elif is_qt_plugin(dep):
qtname, dep_abspath, dep_rpath = normalize_qtplugin_name(dep)
qtnamesrc = os.path.join(GlobalConfig.qtpath, 'lib', '{0}.framework'.
format(qtname), qtname)
elif is_loader_path_lib(dep):
qtname, dep_abspath, dep_rpath = normalize_loaderpath_name(dep)
qtnamesrc = os.path.join(GlobalConfig.qtpath + '/lib', qtname)
else:
return True
# if the source path doesn't exist it's probably not a dependency
# originating with vcpkg and we should leave it alone
if not os.path.exists(qtnamesrc):
return True
dep_ok = True
# check that rpath of 'dep' inside binary has been correctly set
# (ie: relative to exepath using '@executable_path' syntax)
if dep != dep_rpath:
# dep rpath is not ok
GlobalConfig.logger.info('changing rpath \'{0}\' in binary {1}'.format(dep, binary))
# call install_name_tool -change on binary
popen_args = ['install_name_tool', '-change', dep, dep_rpath, binary]
proc_out = run_and_get_output(popen_args)
if proc_out.retcode != 0:
GlobalConfig.logger.error(proc_out.stderr)
dep_ok = False
else:
# call install_name_tool -id on binary
popen_args = ['install_name_tool', '-id', dep_rpath, binary]
proc_out = run_and_get_output(popen_args)
if proc_out.retcode != 0:
GlobalConfig.logger.error(proc_out.stderr)
dep_ok = False
# now ensure that 'dep' exists at the specified path, relative to bundle
if dep_ok and not os.path.exists(dep_abspath):
# ensure destination directory exists
GlobalConfig.logger.info('ensuring directory \'{0}\' exists: {0}'.
format(os.path.dirname(dep_abspath)))
popen_args = ['mkdir', '-p', os.path.dirname(dep_abspath)]
proc_out = run_and_get_output(popen_args)
if proc_out.retcode != 0:
GlobalConfig.logger.info(proc_out.stderr)
dep_ok = False
else:
# copy missing dependency into bundle
GlobalConfig.logger.info('copying missing dependency in bundle: {0}'.
format(qtname))
popen_args = ['cp', qtnamesrc, dep_abspath]
proc_out = run_and_get_output(popen_args)
if proc_out.retcode != 0:
GlobalConfig.logger.info(proc_out.stderr)
dep_ok = False
else:
# ensure permissions are correct if we ever have to change its rpath
GlobalConfig.logger.info('ensuring 755 perm to {0}'.format(dep_abspath))
popen_args = ['chmod', '755', dep_abspath]
proc_out = run_and_get_output(popen_args)
if proc_out.retcode != 0:
GlobalConfig.logger.info(proc_out.stderr)
dep_ok = False
else:
GlobalConfig.logger.debug('{0} is at correct location in bundle'.format(qtname))
if dep_ok:
return fix_binary(dep_abspath)
return False
def fix_binary(binary):
"""
input:
binary: relative or absolute path (no @executable_path syntax)
process:
- first fix the rpath for the qt libs on which 'binary' depend
- copy into the bundle of exepath the eventual libraries that are missing
- (create the soft links) needed ?
- do the same for all qt dependencies of binary (recursive)
"""
GlobalConfig.logger.debug('fix_binary({0})'.format(binary))
# loop on 'binary' dependencies
for dep in get_dependencies(binary):
if not fix_dependency(binary, dep):
GlobalConfig.logger.error('quitting early: couldn\'t fix dependency {0} of {1}'.format(dep, binary))
return False
return True
def fix_main_binaries():
"""
list the main binaries of the app bundle and fix them
"""
# deduce bundle path
bundlepath = os.path.sep.join(GlobalConfig.exepath.split(os.path.sep)[0:-3])
# fix main binary
GlobalConfig.logger.info('fixing executable \'{0}\''.format(GlobalConfig.exepath))
if fix_binary(GlobalConfig.exepath):
GlobalConfig.logger.info('fixing plugins')
for root, dummy, files in os.walk(bundlepath):
for name in [f for f in files if os.path.splitext(f)[1] == '.dylib']:
GlobalConfig.logger.info('fixing plugin {0}'.format(name))
if not fix_binary(os.path.join(root, name)):
return False
return True
def main():
descr = """finish the job started by macdeployqt!
- find dependencies/rpaths with otool
- copy missed dependencies with cp and mkdir
- fix missed rpaths with install_name_tool
exit codes:
- 0 : success
- 1 : error
"""
parser = argparse.ArgumentParser(description=descr,
formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument('exepath',
help='path to the binary depending on Qt')
parser.add_argument('qtpath',
help='path of Qt libraries used to build the Qt application')
parser.add_argument('-q', '--quiet', action='store_true', default=False,
help='do not create log on standard output')
parser.add_argument('-nl', '--no-log-file', action='store_true', default=False,
help='do not create log file \'./macdeployqtfix.log\'')
parser.add_argument('-v', '--verbose', action='store_true', default=False,
help='produce more log messages(debug log)')
args = parser.parse_args()
# globals
GlobalConfig.qtpath = os.path.normpath(args.qtpath)
GlobalConfig.exepath = args.exepath
GlobalConfig.logger = logging.getLogger()
# configure logging
###################
# create formatter
formatter = logging.Formatter('%(levelname)s | %(message)s')
# create console GlobalConfig.logger
if not args.quiet:
chdlr = logging.StreamHandler(sys.stdout)
chdlr.setFormatter(formatter)
GlobalConfig.logger.addHandler(chdlr)
# create file GlobalConfig.logger
if not args.no_log_file:
fhdlr = logging.FileHandler('./macdeployqtfix.log', mode='w')
fhdlr.setFormatter(formatter)
GlobalConfig.logger.addHandler(fhdlr)
if args.no_log_file and args.quiet:
GlobalConfig.logger.addHandler(logging.NullHandler())
else:
GlobalConfig.logger.setLevel(logging.DEBUG if args.verbose else logging.INFO)
if fix_main_binaries():
GlobalConfig.logger.info('macdeployqtfix terminated with success')
ret = 0
else:
GlobalConfig.logger.error('macdeployqtfix terminated with error')
ret = 1
sys.exit(ret)
if __name__ == "__main__":
main()

View File

@@ -1,861 +0,0 @@
# Mark variables as used so cmake doesn't complain about them
mark_as_advanced(CMAKE_TOOLCHAIN_FILE)
# NOTE: to figure out what cmake versions are required for different things,
# grep for `CMake 3`. All version requirement comments should follow that format.
# Attention: Changes to this file do not affect ABI hashing.
#[===[.md:
# z_vcpkg_add_fatal_error
Add a fatal error.
```cmake
z_vcpkg_add_fatal_error(<message>...)
```
We use this system, instead of `message(FATAL_ERROR)`,
since cmake prints a lot of nonsense if the toolchain errors out before it's found the build tools.
This `Z_VCPKG_HAS_FATAL_ERROR` must be checked before any filesystem operations are done,
since otherwise you might be doing something with bad variables set up.
#]===]
# this is defined above everything else so that it can be used.
set(Z_VCPKG_FATAL_ERROR)
set(Z_VCPKG_HAS_FATAL_ERROR OFF)
function(z_vcpkg_add_fatal_error ERROR)
if(NOT Z_VCPKG_HAS_FATAL_ERROR)
set(Z_VCPKG_HAS_FATAL_ERROR ON PARENT_SCOPE)
set(Z_VCPKG_FATAL_ERROR "${ERROR}" PARENT_SCOPE)
else()
string(APPEND Z_VCPKG_FATAL_ERROR "\n${ERROR}")
endif()
endfunction()
set(Z_VCPKG_CMAKE_REQUIRED_MINIMUM_VERSION "3.7.2")
if(CMAKE_VERSION VERSION_LESS Z_VCPKG_CMAKE_REQUIRED_MINIMUM_VERSION)
message(FATAL_ERROR "vcpkg.cmake requires at least CMake ${Z_VCPKG_CMAKE_REQUIRED_MINIMUM_VERSION}.")
endif()
cmake_policy(PUSH)
cmake_policy(VERSION 3.7.2)
include(CMakeDependentOption)
# VCPKG toolchain options.
option(VCPKG_VERBOSE "Enables messages from the VCPKG toolchain for debugging purposes." OFF)
mark_as_advanced(VCPKG_VERBOSE)
option(VCPKG_APPLOCAL_DEPS "Automatically copy dependencies into the output directory for executables." ON)
option(X_VCPKG_APPLOCAL_DEPS_SERIALIZED "(experimental) Add USES_TERMINAL to VCPKG_APPLOCAL_DEPS to force serialization." OFF)
# requires CMake 3.14
option(X_VCPKG_APPLOCAL_DEPS_INSTALL "(experimental) Automatically copy dependencies into the install target directory for executables. Requires CMake 3.14." OFF)
option(VCPKG_PREFER_SYSTEM_LIBS "Appends the vcpkg paths to CMAKE_PREFIX_PATH, CMAKE_LIBRARY_PATH and CMAKE_FIND_ROOT_PATH so that vcpkg libraries/packages are found after toolchain/system libraries/packages." OFF)
# Manifest options and settings
if(NOT DEFINED VCPKG_MANIFEST_DIR)
if(EXISTS "${CMAKE_SOURCE_DIR}/vcpkg.json")
set(VCPKG_MANIFEST_DIR "${CMAKE_SOURCE_DIR}")
endif()
endif()
set(VCPKG_MANIFEST_DIR "${VCPKG_MANIFEST_DIR}"
CACHE PATH "The path to the vcpkg manifest directory." FORCE)
if(DEFINED VCPKG_MANIFEST_DIR AND NOT VCPKG_MANIFEST_DIR STREQUAL "")
set(Z_VCPKG_HAS_MANIFEST_DIR ON)
else()
set(Z_VCPKG_HAS_MANIFEST_DIR OFF)
endif()
option(VCPKG_MANIFEST_MODE "Use manifest mode, as opposed to classic mode." "${Z_VCPKG_HAS_MANIFEST_DIR}")
if(VCPKG_MANIFEST_MODE AND NOT Z_VCPKG_HAS_MANIFEST_DIR)
z_vcpkg_add_fatal_error(
"vcpkg manifest mode was enabled, but we couldn't find a manifest file (vcpkg.json)
in the current source directory (${CMAKE_CURRENT_SOURCE_DIR}).
Please add a manifest, or disable manifests by turning off VCPKG_MANIFEST_MODE."
)
endif()
if(NOT DEFINED CACHE{Z_VCPKG_CHECK_MANIFEST_MODE})
set(Z_VCPKG_CHECK_MANIFEST_MODE "${VCPKG_MANIFEST_MODE}"
CACHE INTERNAL "Making sure VCPKG_MANIFEST_MODE doesn't change")
endif()
if(NOT VCPKG_MANIFEST_MODE AND Z_VCPKG_CHECK_MANIFEST_MODE)
z_vcpkg_add_fatal_error([[
vcpkg manifest mode was disabled for a build directory where it was initially enabled.
This is not supported. Please delete the build directory and reconfigure.
]])
elseif(VCPKG_MANIFEST_MODE AND NOT Z_VCPKG_CHECK_MANIFEST_MODE)
z_vcpkg_add_fatal_error([[
vcpkg manifest mode was enabled for a build directory where it was initially disabled.
This is not supported. Please delete the build directory and reconfigure.
]])
endif()
CMAKE_DEPENDENT_OPTION(VCPKG_MANIFEST_INSTALL [[
Install the dependencies listed in your manifest:
If this is off, you will have to manually install your dependencies.
See https://github.com/microsoft/vcpkg/tree/master/docs/specifications/manifests.md for more info.
]]
ON
"VCPKG_MANIFEST_MODE"
OFF)
if(VCPKG_MANIFEST_INSTALL)
set(VCPKG_BOOTSTRAP_OPTIONS "${VCPKG_BOOTSTRAP_OPTIONS}" CACHE STRING "Additional options to bootstrap vcpkg" FORCE)
set(VCPKG_OVERLAY_PORTS "${VCPKG_OVERLAY_PORTS}" CACHE STRING "Overlay ports to use for vcpkg install in manifest mode" FORCE)
set(VCPKG_OVERLAY_TRIPLETS "${VCPKG_OVERLAY_TRIPLETS}" CACHE STRING "Overlay triplets to use for vcpkg install in manifest mode" FORCE)
set(VCPKG_INSTALL_OPTIONS "${VCPKG_INSTALL_OPTIONS}" CACHE STRING "Additional install options to pass to vcpkg" FORCE)
set(Z_VCPKG_UNUSED VCPKG_BOOTSTRAP_OPTIONS)
set(Z_VCPKG_UNUSED VCPKG_OVERLAY_PORTS)
set(Z_VCPKG_UNUSED VCPKG_OVERLAY_TRIPLETS)
set(Z_VCPKG_UNUSED VCPKG_INSTALL_OPTIONS)
endif()
# CMake helper utilities
#[===[.md:
# z_vcpkg_function_arguments
Get a list of the arguments which were passed in.
Unlike `ARGV`, which is simply the arguments joined with `;`,
so that `(A B)` is not distinguishable from `("A;B")`,
this macro gives `"A;B"` for the first argument list,
and `"A\;B"` for the second.
```cmake
z_vcpkg_function_arguments(<out-var> [<N>])
```
`z_vcpkg_function_arguments` gets the arguments between `ARGV<N>` and the last argument.
`<N>` defaults to `0`, so that all arguments are taken.
## Example:
```cmake
function(foo_replacement)
z_vcpkg_function_arguments(ARGS)
foo(${ARGS})
...
endfunction()
```
#]===]
# NOTE: this function definition is copied directly from scripts/cmake/z_vcpkg_function_arguments.cmake
# do not make changes here without making the same change there.
macro(z_vcpkg_function_arguments OUT_VAR)
if("${ARGC}" EQUAL 1)
set(z_vcpkg_function_arguments_FIRST_ARG 0)
elseif("${ARGC}" EQUAL 2)
set(z_vcpkg_function_arguments_FIRST_ARG "${ARGV1}")
else()
# vcpkg bug
message(FATAL_ERROR "z_vcpkg_function_arguments: invalid arguments (${ARGV})")
endif()
set("${OUT_VAR}" "")
# this allows us to get the value of the enclosing function's ARGC
set(z_vcpkg_function_arguments_ARGC_NAME "ARGC")
set(z_vcpkg_function_arguments_ARGC "${${z_vcpkg_function_arguments_ARGC_NAME}}")
math(EXPR z_vcpkg_function_arguments_LAST_ARG "${z_vcpkg_function_arguments_ARGC} - 1")
# GREATER_EQUAL added in CMake 3.7
if(NOT z_vcpkg_function_arguments_LAST_ARG LESS z_vcpkg_function_arguments_FIRST_ARG)
foreach(z_vcpkg_function_arguments_N RANGE "${z_vcpkg_function_arguments_FIRST_ARG}" "${z_vcpkg_function_arguments_LAST_ARG}")
string(REPLACE ";" "\\;" z_vcpkg_function_arguments_ESCAPED_ARG "${ARGV${z_vcpkg_function_arguments_N}}")
# adds an extra `;` on the first time through
set("${OUT_VAR}" "${${OUT_VAR}};${z_vcpkg_function_arguments_ESCAPED_ARG}")
endforeach()
# remove leading `;`
string(SUBSTRING "${${OUT_VAR}}" 1 -1 "${OUT_VAR}")
endif()
endmacro()
#[===[.md:
# z_vcpkg_set_powershell_path
Gets either the path to powershell or powershell core,
and places it in the variable Z_VCPKG_POWERSHELL_PATH.
#]===]
function(z_vcpkg_set_powershell_path)
# Attempt to use pwsh if it is present; otherwise use powershell
if(NOT DEFINED Z_VCPKG_POWERSHELL_PATH)
find_program(Z_VCPKG_PWSH_PATH pwsh)
if(Z_VCPKG_PWSH_PATH)
set(Z_VCPKG_POWERSHELL_PATH "${Z_VCPKG_PWSH_PATH}" CACHE INTERNAL "The path to the PowerShell implementation to use.")
else()
message(DEBUG "vcpkg: Could not find PowerShell Core; falling back to PowerShell")
find_program(Z_VCPKG_BUILTIN_POWERSHELL_PATH powershell REQUIRED)
if(Z_VCPKG_BUILTIN_POWERSHELL_PATH)
set(Z_VCPKG_POWERSHELL_PATH "${Z_VCPKG_BUILTIN_POWERSHELL_PATH}" CACHE INTERNAL "The path to the PowerShell implementation to use.")
else()
message(WARNING "vcpkg: Could not find PowerShell; using static string 'powershell.exe'")
set(Z_VCPKG_POWERSHELL_PATH "powershell.exe" CACHE INTERNAL "The path to the PowerShell implementation to use.")
endif()
endif()
endif() # Z_VCPKG_POWERSHELL_PATH
endfunction()
# Determine whether the toolchain is loaded during a try-compile configuration
get_property(Z_VCPKG_CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE)
if(VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
include("${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}")
endif()
if(VCPKG_TOOLCHAIN)
cmake_policy(POP)
return()
endif()
#If CMake does not have a mapping for MinSizeRel and RelWithDebInfo in imported targets
#it will map those configuration to the first valid configuration in CMAKE_CONFIGURATION_TYPES or the targets IMPORTED_CONFIGURATIONS.
#In most cases this is the debug configuration which is wrong.
if(NOT DEFINED CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL)
set(CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL "MinSizeRel;Release;")
if(VCPKG_VERBOSE)
message(STATUS "VCPKG-Info: CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL set to MinSizeRel;Release;")
endif()
endif()
if(NOT DEFINED CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO)
set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO "RelWithDebInfo;Release;")
if(VCPKG_VERBOSE)
message(STATUS "VCPKG-Info: CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO set to RelWithDebInfo;Release;")
endif()
endif()
if(VCPKG_TARGET_TRIPLET)
# This is required since a user might do: 'set(VCPKG_TARGET_TRIPLET somevalue)' [no CACHE] before the first project() call
# Latter within the toolchain file we do: 'set(VCPKG_TARGET_TRIPLET somevalue CACHE STRING "")' which
# will otherwise override the user setting of VCPKG_TARGET_TRIPLET in the current scope of the toolchain since the CACHE value
# did not exist previously. Since the value is newly created CMake will use the CACHE value within this scope since it is the more
# recently created value in directory scope. This 'strange' behaviour only happens on the very first configure call since subsequent
# configure call will see the user value as the more recent value. The same logic must be applied to all cache values within this file!
# The FORCE keyword is required to ALWAYS lift the user provided/previously set value into a CACHE value.
set(VCPKG_TARGET_TRIPLET "${VCPKG_TARGET_TRIPLET}" CACHE STRING "Vcpkg target triplet (ex. x86-windows)" FORCE)
elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Ww][Ii][Nn]32$")
set(Z_VCPKG_TARGET_TRIPLET_ARCH x86)
elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Xx]64$")
set(Z_VCPKG_TARGET_TRIPLET_ARCH x64)
elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]$")
set(Z_VCPKG_TARGET_TRIPLET_ARCH arm)
elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]64$")
set(Z_VCPKG_TARGET_TRIPLET_ARCH arm64)
else()
if(CMAKE_GENERATOR STREQUAL "Visual Studio 14 2015 Win64")
set(Z_VCPKG_TARGET_TRIPLET_ARCH x64)
elseif(CMAKE_GENERATOR STREQUAL "Visual Studio 14 2015 ARM")
set(Z_VCPKG_TARGET_TRIPLET_ARCH arm)
elseif(CMAKE_GENERATOR STREQUAL "Visual Studio 14 2015")
set(Z_VCPKG_TARGET_TRIPLET_ARCH x86)
elseif(CMAKE_GENERATOR STREQUAL "Visual Studio 15 2017 Win64")
set(Z_VCPKG_TARGET_TRIPLET_ARCH x64)
elseif(CMAKE_GENERATOR STREQUAL "Visual Studio 15 2017 ARM")
set(Z_VCPKG_TARGET_TRIPLET_ARCH arm)
elseif(CMAKE_GENERATOR STREQUAL "Visual Studio 15 2017")
set(Z_VCPKG_TARGET_TRIPLET_ARCH x86)
elseif(CMAKE_GENERATOR STREQUAL "Visual Studio 16 2019")
set(Z_VCPKG_TARGET_TRIPLET_ARCH x64)
elseif(CMAKE_GENERATOR STREQUAL "Visual Studio 17 2022")
set(Z_VCPKG_TARGET_TRIPLET_ARCH x64)
else()
find_program(Z_VCPKG_CL cl)
if(Z_VCPKG_CL MATCHES "amd64/cl.exe$" OR Z_VCPKG_CL MATCHES "x64/cl.exe$")
set(Z_VCPKG_TARGET_TRIPLET_ARCH x64)
elseif(Z_VCPKG_CL MATCHES "arm/cl.exe$")
set(Z_VCPKG_TARGET_TRIPLET_ARCH arm)
elseif(Z_VCPKG_CL MATCHES "arm64/cl.exe$")
set(Z_VCPKG_TARGET_TRIPLET_ARCH arm64)
elseif(Z_VCPKG_CL MATCHES "bin/cl.exe$" OR Z_VCPKG_CL MATCHES "x86/cl.exe$")
set(Z_VCPKG_TARGET_TRIPLET_ARCH x86)
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin" AND DEFINED CMAKE_SYSTEM_NAME AND NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
list(LENGTH CMAKE_OSX_ARCHITECTURES Z_VCPKG_OSX_ARCH_COUNT)
if(Z_VCPKG_OSX_ARCH_COUNT EQUAL 0)
message(WARNING "Unable to determine target architecture. "
"Consider providing a value for the CMAKE_OSX_ARCHITECTURES cache variable. "
"Continuing without vcpkg.")
set(VCPKG_TOOLCHAIN ON)
cmake_policy(POP)
return()
endif()
if(Z_VCPKG_OSX_ARCH_COUNT GREATER 1)
message(WARNING "Detected more than one target architecture. Using the first one.")
endif()
list(GET CMAKE_OSX_ARCHITECTURES 0 Z_VCPKG_OSX_TARGET_ARCH)
if(Z_VCPKG_OSX_TARGET_ARCH STREQUAL "arm64")
set(Z_VCPKG_TARGET_TRIPLET_ARCH arm64)
elseif(Z_VCPKG_OSX_TARGET_ARCH STREQUAL "arm64s")
set(Z_VCPKG_TARGET_TRIPLET_ARCH arm64s)
elseif(Z_VCPKG_OSX_TARGET_ARCH STREQUAL "armv7s")
set(Z_VCPKG_TARGET_TRIPLET_ARCH armv7s)
elseif(Z_VCPKG_OSX_TARGET_ARCH STREQUAL "armv7")
set(Z_VCPKG_TARGET_TRIPLET_ARCH arm)
elseif(Z_VCPKG_OSX_TARGET_ARCH STREQUAL "x86_64")
set(Z_VCPKG_TARGET_TRIPLET_ARCH x64)
elseif(Z_VCPKG_OSX_TARGET_ARCH STREQUAL "i386")
set(Z_VCPKG_TARGET_TRIPLET_ARCH x86)
else()
message(WARNING "Unable to determine target architecture, continuing without vcpkg.")
set(VCPKG_TOOLCHAIN ON)
cmake_policy(POP)
return()
endif()
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64" OR
CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64" OR
CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "amd64")
set(Z_VCPKG_TARGET_TRIPLET_ARCH x64)
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "s390x")
set(Z_VCPKG_TARGET_TRIPLET_ARCH s390x)
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "ppc64le")
set(Z_VCPKG_TARGET_TRIPLET_ARCH ppc64le)
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "armv7l")
set(Z_VCPKG_TARGET_TRIPLET_ARCH arm)
elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64)$")
set(Z_VCPKG_TARGET_TRIPLET_ARCH arm64)
else()
if(Z_VCPKG_CMAKE_IN_TRY_COMPILE)
message(STATUS "Unable to determine target architecture, continuing without vcpkg.")
else()
message(WARNING "Unable to determine target architecture, continuing without vcpkg.")
endif()
set(VCPKG_TOOLCHAIN ON)
cmake_policy(POP)
return()
endif()
endif()
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone")
set(Z_VCPKG_TARGET_TRIPLET_PLAT uwp)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR (NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux"))
set(Z_VCPKG_TARGET_TRIPLET_PLAT linux)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR (NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin"))
set(Z_VCPKG_TARGET_TRIPLET_PLAT osx)
elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS")
set(Z_VCPKG_TARGET_TRIPLET_PLAT ios)
elseif(MINGW)
set(Z_VCPKG_TARGET_TRIPLET_PLAT mingw-dynamic)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR (NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows"))
set(Z_VCPKG_TARGET_TRIPLET_PLAT windows)
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR (NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "FreeBSD"))
set(Z_VCPKG_TARGET_TRIPLET_PLAT freebsd)
endif()
if(EMSCRIPTEN)
set(Z_VCPKG_TARGET_TRIPLET_ARCH wasm32)
set(Z_VCPKG_TARGET_TRIPLET_PLAT emscripten)
endif()
set(VCPKG_TARGET_TRIPLET "${Z_VCPKG_TARGET_TRIPLET_ARCH}-${Z_VCPKG_TARGET_TRIPLET_PLAT}" CACHE STRING "Vcpkg target triplet (ex. x86-windows)")
set(Z_VCPKG_TOOLCHAIN_DIR "${CMAKE_CURRENT_LIST_DIR}")
# Detect .vcpkg-root to figure VCPKG_ROOT_DIR
set(Z_VCPKG_ROOT_DIR_CANDIDATE "${CMAKE_CURRENT_LIST_DIR}")
while(NOT DEFINED Z_VCPKG_ROOT_DIR)
if(EXISTS "${Z_VCPKG_ROOT_DIR_CANDIDATE}/.vcpkg-root")
set(Z_VCPKG_ROOT_DIR "${Z_VCPKG_ROOT_DIR_CANDIDATE}" CACHE INTERNAL "Vcpkg root directory")
elseif(IS_DIRECTORY "${Z_VCPKG_ROOT_DIR_CANDIDATE}")
get_filename_component(Z_VCPKG_ROOT_DIR_TEMP "${Z_VCPKG_ROOT_DIR_CANDIDATE}" DIRECTORY)
if(Z_VCPKG_ROOT_DIR_TEMP STREQUAL Z_VCPKG_ROOT_DIR_CANDIDATE)
break() # If unchanged, we have reached the root of the drive without finding vcpkg.
endif()
SET(Z_VCPKG_ROOT_DIR_CANDIDATE "${Z_VCPKG_ROOT_DIR_TEMP}")
unset(Z_VCPKG_ROOT_DIR_TEMP)
else()
break()
endif()
endwhile()
unset(Z_VCPKG_ROOT_DIR_CANDIDATE)
if(NOT Z_VCPKG_ROOT_DIR)
z_vcpkg_add_fatal_error("Could not find .vcpkg-root")
endif()
if(DEFINED VCPKG_INSTALLED_DIR)
# do nothing
elseif(DEFINED _VCPKG_INSTALLED_DIR)
set(VCPKG_INSTALLED_DIR "${_VCPKG_INSTALLED_DIR}")
elseif(VCPKG_MANIFEST_MODE)
set(VCPKG_INSTALLED_DIR "${CMAKE_BINARY_DIR}/vcpkg_installed")
else()
set(VCPKG_INSTALLED_DIR "${Z_VCPKG_ROOT_DIR}/installed")
endif()
set(VCPKG_INSTALLED_DIR "${VCPKG_INSTALLED_DIR}"
CACHE PATH
"The directory which contains the installed libraries for each triplet" FORCE)
set(_VCPKG_INSTALLED_DIR "${VCPKG_INSTALLED_DIR}"
CACHE PATH
"The directory which contains the installed libraries for each triplet" FORCE)
function(z_vcpkg_add_vcpkg_to_cmake_path list suffix)
set(vcpkg_paths
"${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}${suffix}"
"${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug${suffix}"
)
if(NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE MATCHES "^[Dd][Ee][Bb][Uu][Gg]$")
list(REVERSE vcpkg_paths) # Debug build: Put Debug paths before Release paths.
endif()
if(VCPKG_PREFER_SYSTEM_LIBS)
list(APPEND "${list}" "${vcpkg_paths}")
else()
list(INSERT "${list}" 0 "${vcpkg_paths}") # CMake 3.15 is required for list(PREPEND ...).
endif()
set("${list}" "${${list}}" PARENT_SCOPE)
endfunction()
z_vcpkg_add_vcpkg_to_cmake_path(CMAKE_PREFIX_PATH "")
z_vcpkg_add_vcpkg_to_cmake_path(CMAKE_LIBRARY_PATH "/lib/manual-link")
z_vcpkg_add_vcpkg_to_cmake_path(CMAKE_FIND_ROOT_PATH "")
if(NOT VCPKG_PREFER_SYSTEM_LIBS)
set(CMAKE_FIND_FRAMEWORK "LAST") # we assume that frameworks are usually system-wide libs, not vcpkg-built
set(CMAKE_FIND_APPBUNDLE "LAST") # we assume that appbundles are usually system-wide libs, not vcpkg-built
endif()
# If one CMAKE_FIND_ROOT_PATH_MODE_* variables is set to ONLY, to make sure that ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}
# and ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug are searched, it is not sufficient to just add them to CMAKE_FIND_ROOT_PATH,
# as CMAKE_FIND_ROOT_PATH specify "one or more directories to be prepended to all other search directories", so to make sure that
# the libraries are searched as they are, it is necessary to add "/" to the CMAKE_PREFIX_PATH
if(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE STREQUAL "ONLY" OR
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY STREQUAL "ONLY" OR
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE STREQUAL "ONLY")
list(APPEND CMAKE_PREFIX_PATH "/")
endif()
set(VCPKG_CMAKE_FIND_ROOT_PATH "${CMAKE_FIND_ROOT_PATH}")
# CMAKE_EXECUTABLE_SUFFIX is not yet defined
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
set(Z_VCPKG_EXECUTABLE "${Z_VCPKG_ROOT_DIR}/vcpkg.exe")
set(Z_VCPKG_BOOTSTRAP_SCRIPT "${Z_VCPKG_ROOT_DIR}/bootstrap-vcpkg.bat")
else()
set(Z_VCPKG_EXECUTABLE "${Z_VCPKG_ROOT_DIR}/vcpkg")
set(Z_VCPKG_BOOTSTRAP_SCRIPT "${Z_VCPKG_ROOT_DIR}/bootstrap-vcpkg.sh")
endif()
if(VCPKG_MANIFEST_MODE AND VCPKG_MANIFEST_INSTALL AND NOT Z_VCPKG_CMAKE_IN_TRY_COMPILE AND NOT Z_VCPKG_HAS_FATAL_ERROR)
if(NOT EXISTS "${Z_VCPKG_EXECUTABLE}" AND NOT Z_VCPKG_HAS_FATAL_ERROR)
message(STATUS "Bootstrapping vcpkg before install")
file(TO_NATIVE_PATH "${CMAKE_BINARY_DIR}/vcpkg-bootstrap.log" Z_VCPKG_BOOTSTRAP_LOG)
execute_process(
COMMAND "${Z_VCPKG_BOOTSTRAP_SCRIPT}" ${VCPKG_BOOTSTRAP_OPTIONS}
OUTPUT_FILE "${Z_VCPKG_BOOTSTRAP_LOG}"
ERROR_FILE "${Z_VCPKG_BOOTSTRAP_LOG}"
RESULT_VARIABLE Z_VCPKG_BOOTSTRAP_RESULT)
if(Z_VCPKG_BOOTSTRAP_RESULT EQUAL 0)
message(STATUS "Bootstrapping vcpkg before install - done")
else()
message(STATUS "Bootstrapping vcpkg before install - failed")
z_vcpkg_add_fatal_error("vcpkg install failed. See logs for more information: ${Z_VCPKG_BOOTSTRAP_LOG}")
endif()
endif()
if(NOT Z_VCPKG_HAS_FATAL_ERROR)
message(STATUS "Running vcpkg install")
set(Z_VCPKG_ADDITIONAL_MANIFEST_PARAMS)
if(DEFINED VCPKG_HOST_TRIPLET AND NOT VCPKG_HOST_TRIPLET STREQUAL "")
list(APPEND Z_VCPKG_ADDITIONAL_MANIFEST_PARAMS "--host-triplet=${VCPKG_HOST_TRIPLET}")
endif()
if(VCPKG_OVERLAY_PORTS)
foreach(Z_VCPKG_OVERLAY_PORT IN LISTS VCPKG_OVERLAY_PORTS)
list(APPEND Z_VCPKG_ADDITIONAL_MANIFEST_PARAMS "--overlay-ports=${Z_VCPKG_OVERLAY_PORT}")
endforeach()
endif()
if(VCPKG_OVERLAY_TRIPLETS)
foreach(Z_VCPKG_OVERLAY_TRIPLET IN LISTS VCPKG_OVERLAY_TRIPLETS)
list(APPEND Z_VCPKG_ADDITIONAL_MANIFEST_PARAMS "--overlay-triplets=${Z_VCPKG_OVERLAY_TRIPLET}")
endforeach()
endif()
if(DEFINED VCPKG_FEATURE_FLAGS OR DEFINED CACHE{VCPKG_FEATURE_FLAGS})
list(JOIN VCPKG_FEATURE_FLAGS "," Z_VCPKG_FEATURE_FLAGS)
set(Z_VCPKG_FEATURE_FLAGS "--feature-flags=${Z_VCPKG_FEATURE_FLAGS}")
endif()
foreach(Z_VCPKG_FEATURE IN LISTS VCPKG_MANIFEST_FEATURES)
list(APPEND Z_VCPKG_ADDITIONAL_MANIFEST_PARAMS "--x-feature=${Z_VCPKG_FEATURE}")
endforeach()
if(VCPKG_MANIFEST_NO_DEFAULT_FEATURES)
list(APPEND Z_VCPKG_ADDITIONAL_MANIFEST_PARAMS "--x-no-default-features")
endif()
if(NOT CMAKE_VERSION VERSION_LESS "3.18") # == GREATER_EQUAL, but that was added in CMake 3.7
set(Z_VCPKG_MANIFEST_INSTALL_ECHO_PARAMS ECHO_OUTPUT_VARIABLE ECHO_ERROR_VARIABLE)
else()
set(Z_VCPKG_MANIFEST_INSTALL_ECHO_PARAMS)
endif()
execute_process(
COMMAND "${Z_VCPKG_EXECUTABLE}" install
--triplet "${VCPKG_TARGET_TRIPLET}"
--vcpkg-root "${Z_VCPKG_ROOT_DIR}"
"--x-wait-for-lock"
"--x-manifest-root=${VCPKG_MANIFEST_DIR}"
"--x-install-root=${_VCPKG_INSTALLED_DIR}"
"${Z_VCPKG_FEATURE_FLAGS}"
${Z_VCPKG_ADDITIONAL_MANIFEST_PARAMS}
${VCPKG_INSTALL_OPTIONS}
OUTPUT_VARIABLE Z_VCPKG_MANIFEST_INSTALL_LOGTEXT
ERROR_VARIABLE Z_VCPKG_MANIFEST_INSTALL_LOGTEXT
RESULT_VARIABLE Z_VCPKG_MANIFEST_INSTALL_RESULT
${Z_VCPKG_MANIFEST_INSTALL_ECHO_PARAMS}
)
file(TO_NATIVE_PATH "${CMAKE_BINARY_DIR}/vcpkg-manifest-install.log" Z_VCPKG_MANIFEST_INSTALL_LOGFILE)
file(WRITE "${Z_VCPKG_MANIFEST_INSTALL_LOGFILE}" "${Z_VCPKG_MANIFEST_INSTALL_LOGTEXT}")
if(Z_VCPKG_MANIFEST_INSTALL_RESULT EQUAL 0)
message(STATUS "Running vcpkg install - done")
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
"${VCPKG_MANIFEST_DIR}/vcpkg.json")
if(EXISTS "${VCPKG_MANIFEST_DIR}/vcpkg-configuration.json")
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
"${VCPKG_MANIFEST_DIR}/vcpkg-configuration.json")
endif()
else()
message(STATUS "Running vcpkg install - failed")
z_vcpkg_add_fatal_error("vcpkg install failed. See logs for more information: ${Z_VCPKG_MANIFEST_INSTALL_LOGFILE}")
endif()
endif()
endif()
option(VCPKG_SETUP_CMAKE_PROGRAM_PATH "Enable the setup of CMAKE_PROGRAM_PATH to vcpkg paths" ON)
set(VCPKG_CAN_USE_HOST_TOOLS OFF)
if(DEFINED VCPKG_HOST_TRIPLET AND NOT VCPKG_HOST_TRIPLET STREQUAL "")
set(VCPKG_CAN_USE_HOST_TOOLS ON)
endif()
cmake_dependent_option(VCPKG_USE_HOST_TOOLS "Setup CMAKE_PROGRAM_PATH to use host tools" ON "VCPKG_CAN_USE_HOST_TOOLS" OFF)
unset(VCPKG_CAN_USE_HOST_TOOLS)
if(VCPKG_SETUP_CMAKE_PROGRAM_PATH)
set(tools_base_path "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools")
if(VCPKG_USE_HOST_TOOLS)
set(tools_base_path "${VCPKG_INSTALLED_DIR}/${VCPKG_HOST_TRIPLET}/tools")
endif()
list(APPEND CMAKE_PROGRAM_PATH "${tools_base_path}")
file(GLOB Z_VCPKG_TOOLS_DIRS LIST_DIRECTORIES true "${tools_base_path}/*")
file(GLOB Z_VCPKG_TOOLS_FILES LIST_DIRECTORIES false "${tools_base_path}/*")
file(GLOB Z_VCPKG_TOOLS_DIRS_BIN LIST_DIRECTORIES true "${tools_base_path}/*/bin")
file(GLOB Z_VCPKG_TOOLS_FILES_BIN LIST_DIRECTORIES false "${tools_base_path}/*/bin")
list(REMOVE_ITEM Z_VCPKG_TOOLS_DIRS ${Z_VCPKG_TOOLS_FILES} "") # need at least one item for REMOVE_ITEM if CMake <= 3.19
list(REMOVE_ITEM Z_VCPKG_TOOLS_DIRS_BIN ${Z_VCPKG_TOOLS_FILES_BIN} "")
string(REPLACE "/bin" "" Z_VCPKG_TOOLS_DIRS_TO_REMOVE "${Z_VCPKG_TOOLS_DIRS_BIN}")
list(REMOVE_ITEM Z_VCPKG_TOOLS_DIRS ${Z_VCPKG_TOOLS_DIRS_TO_REMOVE} "")
list(APPEND Z_VCPKG_TOOLS_DIRS ${Z_VCPKG_TOOLS_DIRS_BIN})
foreach(Z_VCPKG_TOOLS_DIR IN LISTS Z_VCPKG_TOOLS_DIRS)
list(APPEND CMAKE_PROGRAM_PATH "${Z_VCPKG_TOOLS_DIR}")
endforeach()
unset(Z_VCPKG_TOOLS_DIR)
unset(Z_VCPKG_TOOLS_DIRS)
unset(Z_VCPKG_TOOLS_FILES)
unset(Z_VCPKG_TOOLS_DIRS_BIN)
unset(Z_VCPKG_TOOLS_FILES_BIN)
unset(Z_VCPKG_TOOLS_DIRS_TO_REMOVE)
unset(tools_base_path)
endif()
cmake_policy(POP)
# Any policies applied to the below macros and functions appear to leak into consumers
function(add_executable)
z_vcpkg_function_arguments(ARGS)
_add_executable(${ARGS})
set(target_name "${ARGV0}")
list(FIND ARGV "IMPORTED" IMPORTED_IDX)
list(FIND ARGV "ALIAS" ALIAS_IDX)
list(FIND ARGV "MACOSX_BUNDLE" MACOSX_BUNDLE_IDX)
if(IMPORTED_IDX EQUAL -1 AND ALIAS_IDX EQUAL -1)
if(VCPKG_APPLOCAL_DEPS)
if(Z_VCPKG_TARGET_TRIPLET_PLAT MATCHES "windows|uwp")
z_vcpkg_set_powershell_path()
set(EXTRA_OPTIONS "")
if(X_VCPKG_APPLOCAL_DEPS_SERIALIZED)
set(EXTRA_OPTIONS USES_TERMINAL)
endif()
add_custom_command(TARGET "${target_name}" POST_BUILD
COMMAND "${Z_VCPKG_POWERSHELL_PATH}" -noprofile -executionpolicy Bypass -file "${Z_VCPKG_TOOLCHAIN_DIR}/msbuild/applocal.ps1"
-targetBinary "$<TARGET_FILE:${target_name}>"
-installedDir "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$<CONFIG:Debug>:/debug>/bin"
-OutVariable out
VERBATIM
${EXTRA_OPTIONS}
)
elseif(Z_VCPKG_TARGET_TRIPLET_PLAT MATCHES "osx")
if(NOT MACOSX_BUNDLE_IDX EQUAL -1)
add_custom_command(TARGET "${target_name}" POST_BUILD
COMMAND python "${Z_VCPKG_TOOLCHAIN_DIR}/osx/applocal.py"
"$<TARGET_FILE:${target_name}>"
"${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$<CONFIG:Debug>:/debug>"
VERBATIM
)
endif()
endif()
endif()
set_target_properties("${target_name}" PROPERTIES VS_USER_PROPS do_not_import_user.props)
set_target_properties("${target_name}" PROPERTIES VS_GLOBAL_VcpkgEnabled false)
endif()
endfunction()
function(add_library)
z_vcpkg_function_arguments(ARGS)
_add_library(${ARGS})
set(target_name "${ARGV0}")
list(FIND ARGS "IMPORTED" IMPORTED_IDX)
list(FIND ARGS "INTERFACE" INTERFACE_IDX)
list(FIND ARGS "ALIAS" ALIAS_IDX)
if(IMPORTED_IDX EQUAL -1 AND INTERFACE_IDX EQUAL -1 AND ALIAS_IDX EQUAL -1)
get_target_property(IS_LIBRARY_SHARED "${target_name}" TYPE)
if(VCPKG_APPLOCAL_DEPS AND Z_VCPKG_TARGET_TRIPLET_PLAT MATCHES "windows|uwp" AND (IS_LIBRARY_SHARED STREQUAL "SHARED_LIBRARY" OR IS_LIBRARY_SHARED STREQUAL "MODULE_LIBRARY"))
z_vcpkg_set_powershell_path()
add_custom_command(TARGET "${target_name}" POST_BUILD
COMMAND "${Z_VCPKG_POWERSHELL_PATH}" -noprofile -executionpolicy Bypass -file "${Z_VCPKG_TOOLCHAIN_DIR}/msbuild/applocal.ps1"
-targetBinary "$<TARGET_FILE:${target_name}>"
-installedDir "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$<CONFIG:Debug>:/debug>/bin"
-OutVariable out
VERBATIM
)
endif()
set_target_properties("${target_name}" PROPERTIES VS_USER_PROPS do_not_import_user.props)
set_target_properties("${target_name}" PROPERTIES VS_GLOBAL_VcpkgEnabled false)
endif()
endfunction()
# This is an experimental function to enable applocal install of dependencies as part of the `make install` process
# Arguments:
# TARGETS - a list of installed targets to have dependencies copied for
# DESTINATION - the runtime directory for those targets (usually `bin`)
# COMPONENT - the component this install command belongs to (optional)
#
# Note that this function requires CMake 3.14 for policy CMP0087
function(x_vcpkg_install_local_dependencies)
if(CMAKE_VERSION VERSION_LESS "3.14")
message(FATAL_ERROR "x_vcpkg_install_local_dependencies and X_VCPKG_APPLOCAL_DEPS_INSTALL require at least CMake 3.14
(current version: ${CMAKE_VERSION})"
)
endif()
cmake_parse_arguments(PARSE_ARGV 0 arg
""
"DESTINATION;COMPONENT"
"TARGETS"
)
if(DEFINED arg_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
endif()
if(NOT DEFINED arg_DESTINATION)
message(FATAL_ERROR "DESTINATION must be specified")
endif()
if(Z_VCPKG_TARGET_TRIPLET_PLAT MATCHES "^(windows|uwp)$")
# Install CODE|SCRIPT allow the use of generator expressions
cmake_policy(SET CMP0087 NEW) # CMake 3.14
z_vcpkg_set_powershell_path()
if(NOT IS_ABSOLUTE "${arg_DESTINATION}")
set(arg_DESTINATION "\${CMAKE_INSTALL_PREFIX}/${arg_DESTINATION}")
endif()
set(component_param "")
if(DEFINED arg_COMPONENT)
set(component_param COMPONENT "${arg_COMPONENT}")
endif()
foreach(target IN LISTS arg_TARGETS)
get_target_property(target_type "${target}" TYPE)
if(NOT target_type STREQUAL "INTERFACE_LIBRARY")
install(CODE "message(\"-- Installing app dependencies for ${target}...\")
execute_process(COMMAND \"${Z_VCPKG_POWERSHELL_PATH}\" -noprofile -executionpolicy Bypass -file \"${Z_VCPKG_TOOLCHAIN_DIR}/msbuild/applocal.ps1\"
-targetBinary \"${arg_DESTINATION}/$<TARGET_FILE_NAME:${target}>\"
-installedDir \"${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$<CONFIG:Debug>:/debug>/bin\"
-OutVariable out)"
${component_param}
)
endif()
endforeach()
endif()
endfunction()
if(X_VCPKG_APPLOCAL_DEPS_INSTALL)
function(install)
z_vcpkg_function_arguments(ARGS)
_install(${ARGS})
if(ARGV0 STREQUAL "TARGETS")
# Will contain the list of targets
set(parsed_targets "")
# Destination - [RUNTIME] DESTINATION argument overrides this
set(destination "bin")
set(component_param "")
# Parse arguments given to the install function to find targets and (runtime) destination
set(modifier "") # Modifier for the command in the argument
set(last_command "") # Last command we found to process
foreach(arg IN LISTS ARGS)
if(arg MATCHES "^(ARCHIVE|LIBRARY|RUNTIME|OBJECTS|FRAMEWORK|BUNDLE|PRIVATE_HEADER|PUBLIC_HEADER|RESOURCE|INCLUDES)$")
set(modifier "${arg}")
continue()
endif()
if(arg MATCHES "^(TARGETS|DESTINATION|PERMISSIONS|CONFIGURATIONS|COMPONENT|NAMELINK_COMPONENT|OPTIONAL|EXCLUDE_FROM_ALL|NAMELINK_ONLY|NAMELINK_SKIP|EXPORT)$")
set(last_command "${arg}")
continue()
endif()
if(last_command STREQUAL "TARGETS")
list(APPEND parsed_targets "${arg}")
endif()
if(last_command STREQUAL "DESTINATION" AND (modifier STREQUAL "" OR modifier STREQUAL "RUNTIME"))
set(destination "${arg}")
endif()
if(last_command STREQUAL "COMPONENT")
set(component_param "COMPONENT" "${arg}")
endif()
endforeach()
x_vcpkg_install_local_dependencies(
TARGETS ${parsed_targets}
DESTINATION "${destination}"
${component_param}
)
endif()
endfunction()
endif()
if(NOT DEFINED VCPKG_OVERRIDE_FIND_PACKAGE_NAME)
set(VCPKG_OVERRIDE_FIND_PACKAGE_NAME find_package)
endif()
# NOTE: this is not a function, which means that arguments _are not_ perfectly forwarded
# this is fine for `find_package`, since there are no usecases for `;` in arguments,
# so perfect forwarding is not important
macro("${VCPKG_OVERRIDE_FIND_PACKAGE_NAME}" z_vcpkg_find_package_package_name)
set(z_vcpkg_find_package_package_name "${z_vcpkg_find_package_package_name}")
set(z_vcpkg_find_package_ARGN "${ARGN}")
set(z_vcpkg_find_package_backup_vars)
# Workaround to set the ROOT_PATH until upstream CMake stops overriding
# the ROOT_PATH at apple OS initialization phase.
# See https://gitlab.kitware.com/cmake/cmake/merge_requests/3273
# Fixed in CMake 3.15
if(CMAKE_SYSTEM_NAME STREQUAL iOS)
list(APPEND z_vcpkg_find_package_backup_vars "CMAKE_FIND_ROOT_PATH")
if(DEFINED CMAKE_FIND_ROOT_PATH)
set(z_vcpkg_find_package_backup_CMAKE_FIND_ROOT_PATH "${CMAKE_FIND_ROOT_PATH}")
else()
set(z_vcpkg_find_package_backup_CMAKE_FIND_ROOT_PATH)
endif()
list(APPEND CMAKE_FIND_ROOT_PATH "${VCPKG_CMAKE_FIND_ROOT_PATH}")
endif()
string(TOLOWER "${z_vcpkg_find_package_package_name}" z_vcpkg_find_package_lowercase_package_name)
set(z_vcpkg_find_package_vcpkg_cmake_wrapper_path
"${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/${z_vcpkg_find_package_lowercase_package_name}/vcpkg-cmake-wrapper.cmake")
if(EXISTS "${z_vcpkg_find_package_vcpkg_cmake_wrapper_path}")
list(APPEND z_vcpkg_find_package_backup_vars "ARGS")
if(DEFINED ARGS)
set(z_vcpkg_find_package_backup_ARGS "${ARGS}")
else()
set(z_vcpkg_find_package_backup_ARGS)
endif()
set(ARGS "${z_vcpkg_find_package_package_name};${z_vcpkg_find_package_ARGN}")
include("${z_vcpkg_find_package_vcpkg_cmake_wrapper_path}")
elseif(z_vcpkg_find_package_package_name STREQUAL "Boost" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/boost")
# Checking for the boost headers disables this wrapper unless the user has installed at least one boost library
# these intentionally are not backed up
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_NO_BOOST_CMAKE ON)
set(Boost_USE_STATIC_RUNTIME)
unset(Boost_USE_STATIC_RUNTIME CACHE)
if(CMAKE_VS_PLATFORM_TOOLSET STREQUAL "v120")
set(Boost_COMPILER "-vc120")
else()
set(Boost_COMPILER "-vc140")
endif()
_find_package("${z_vcpkg_find_package_package_name}" ${z_vcpkg_find_package_ARGN})
elseif(z_vcpkg_find_package_package_name STREQUAL "ICU" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/unicode/utf.h")
list(FIND z_vcpkg_find_package_ARGN "COMPONENTS" z_vcpkg_find_package_COMPONENTS_IDX)
if(NOT z_vcpkg_find_package_COMPONENTS_IDX EQUAL -1)
_find_package("${z_vcpkg_find_package_package_name}" ${z_vcpkg_find_package_ARGN} COMPONENTS data)
else()
_find_package("${z_vcpkg_find_package_package_name}" ${z_vcpkg_find_package_ARGN})
endif()
elseif(z_vcpkg_find_package_package_name STREQUAL "GSL" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/gsl")
_find_package("${z_vcpkg_find_package_package_name}" ${z_vcpkg_find_package_ARGN})
if(GSL_FOUND AND TARGET GSL::gsl)
set_property( TARGET GSL::gslcblas APPEND PROPERTY IMPORTED_CONFIGURATIONS Release )
set_property( TARGET GSL::gsl APPEND PROPERTY IMPORTED_CONFIGURATIONS Release )
if( EXISTS "${GSL_LIBRARY_DEBUG}" AND EXISTS "${GSL_CBLAS_LIBRARY_DEBUG}")
set_property( TARGET GSL::gsl APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
set_target_properties( GSL::gsl PROPERTIES IMPORTED_LOCATION_DEBUG "${GSL_LIBRARY_DEBUG}" )
set_property( TARGET GSL::gslcblas APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
set_target_properties( GSL::gslcblas PROPERTIES IMPORTED_LOCATION_DEBUG "${GSL_CBLAS_LIBRARY_DEBUG}" )
endif()
endif()
elseif("${z_vcpkg_find_package_package_name}" STREQUAL "CURL" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/curl")
_find_package("${z_vcpkg_find_package_package_name}" ${z_vcpkg_find_package_ARGN})
if(CURL_FOUND)
if(EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/nghttp2.lib")
list(APPEND CURL_LIBRARIES
"debug" "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/nghttp2.lib"
"optimized" "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/nghttp2.lib")
endif()
endif()
elseif("${z_vcpkg_find_package_lowercase_package_name}" STREQUAL "grpc" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/grpc")
_find_package(gRPC ${z_vcpkg_find_package_ARGN})
else()
_find_package("${z_vcpkg_find_package_package_name}" ${z_vcpkg_find_package_ARGN})
endif()
foreach(z_vcpkg_find_package_backup_var IN LISTS z_vcpkg_find_package_backup_vars)
if(DEFINED z_vcpkg_find_package_backup_${z_vcpkg_find_package_backup_var})
set("${z_vcpkg_find_package_backup_var}" "${z_vcpkg_find_package_backup_${z_vcpkg_find_package_backup_var}}")
else()
set("${z_vcpkg_find_package_backup_var}")
endif()
endforeach()
endmacro()
cmake_policy(PUSH)
cmake_policy(VERSION 3.7.2)
set(VCPKG_TOOLCHAIN ON)
set(Z_VCPKG_UNUSED "${CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION}")
set(Z_VCPKG_UNUSED "${CMAKE_EXPORT_NO_PACKAGE_REGISTRY}")
set(Z_VCPKG_UNUSED "${CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY}")
set(Z_VCPKG_UNUSED "${CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY}")
set(Z_VCPKG_UNUSED "${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP}")
# Propogate these values to try-compile configurations so the triplet and toolchain load
if(NOT Z_VCPKG_CMAKE_IN_TRY_COMPILE)
list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
VCPKG_TARGET_TRIPLET
VCPKG_TARGET_ARCHITECTURE
VCPKG_APPLOCAL_DEPS
VCPKG_CHAINLOAD_TOOLCHAIN_FILE
Z_VCPKG_ROOT_DIR
)
endif()
if(Z_VCPKG_HAS_FATAL_ERROR)
message(FATAL_ERROR "${Z_VCPKG_FATAL_ERROR}")
endif()
cmake_policy(POP)

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +0,0 @@
if (NOT DEFINED Z_VCPKG_OVERRIDEN_EXECUTE_PROCESS)
set(Z_VCPKG_OVERRIDEN_EXECUTE_PROCESS ON)
if (DEFINED VCPKG_DOWNLOAD_MODE)
function(execute_process)
message(FATAL_ERROR "This command cannot be executed in Download Mode.\nHalting portfile execution.\n")
endfunction()
set(Z_VCPKG_EXECUTE_PROCESS_NAME "_execute_process")
else()
set(Z_VCPKG_EXECUTE_PROCESS_NAME "execute_process")
endif()
endif()

View File

@@ -1,511 +0,0 @@
# Mirror list from https://github.com/msys2/MSYS2-packages/blob/master/pacman-mirrors/mirrorlist.msys
# Sourceforge is not used because it does not keep older package versions
set(Z_VCPKG_ACQUIRE_MSYS_MIRRORS
"https://www2.futureware.at/~nickoe/msys2-mirror/"
"https://mirror.yandex.ru/mirrors/msys2/"
"https://mirrors.tuna.tsinghua.edu.cn/msys2/"
"https://mirrors.ustc.edu.cn/msys2/"
"https://mirror.bit.edu.cn/msys2/"
"https://mirror.selfnet.de/msys2/"
"https://mirrors.sjtug.sjtu.edu.cn/msys2/"
)
function(z_vcpkg_acquire_msys_download_package out_archive)
cmake_parse_arguments(PARSE_ARGV 1 "arg" "" "URL;SHA512;FILENAME" "")
if(DEFINED arg_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "internal error: z_vcpkg_acquire_msys_download_package passed extra args: ${arg_UNPARSED_ARGUMENTS}")
endif()
set(all_urls "${arg_URL}")
foreach(mirror IN LISTS Z_VCPKG_ACQUIRE_MSYS_MIRRORS)
string(REPLACE "https://repo.msys2.org/" "${mirror}" mirror_url "${arg_URL}")
list(APPEND all_urls "${mirror_url}")
endforeach()
vcpkg_download_distfile(msys_archive
URLS ${all_urls}
SHA512 "${arg_SHA512}"
FILENAME "msys-${arg_FILENAME}"
QUIET
)
set("${out_archive}" "${msys_archive}" PARENT_SCOPE)
endfunction()
# writes to the following variables in parent scope:
# - Z_VCPKG_MSYS_ARCHIVES
# - Z_VCPKG_MSYS_TOTAL_HASH
# - Z_VCPKG_MSYS_PACKAGES
function(z_vcpkg_acquire_msys_declare_package)
cmake_parse_arguments(PARSE_ARGV 0 arg "" "NAME;URL;SHA512" "DEPS")
if(DEFINED arg_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "internal error: z_vcpkg_acquire_msys_declare_package passed extra args: ${arg_UNPARSED_ARGUMENTS}")
endif()
foreach(required_arg IN ITEMS URL SHA512)
if(NOT DEFINED arg_${required_arg})
message(FATAL_ERROR "internal error: z_vcpkg_acquire_msys_declare_package requires argument: ${required_arg}")
endif()
endforeach()
if(NOT arg_URL MATCHES [[^https://repo\.msys2\.org/.*/(([^-]+(-[^0-9][^-]*)*)-.+\.pkg\.tar\.(xz|zst))$]])
message(FATAL_ERROR "internal error: regex does not match supplied URL to vcpkg_acquire_msys: ${arg_URL}")
endif()
set(filename "${CMAKE_MATCH_1}")
if(NOT DEFINED arg_NAME)
set(arg_NAME "${CMAKE_MATCH_2}")
endif()
if("${arg_NAME}" IN_LIST Z_VCPKG_MSYS_PACKAGES OR arg_Z_ALL_PACKAGES)
list(REMOVE_ITEM Z_VCPKG_MSYS_PACKAGES "${arg_NAME}")
list(APPEND Z_VCPKG_MSYS_PACKAGES ${arg_DEPS})
set(Z_VCPKG_MSYS_PACKAGES "${Z_VCPKG_MSYS_PACKAGES}" PARENT_SCOPE)
z_vcpkg_acquire_msys_download_package(archive
URL "${arg_URL}"
SHA512 "${arg_SHA512}"
FILENAME "${filename}"
)
list(APPEND Z_VCPKG_MSYS_ARCHIVES "${archive}")
set(Z_VCPKG_MSYS_ARCHIVES "${Z_VCPKG_MSYS_ARCHIVES}" PARENT_SCOPE)
string(APPEND Z_VCPKG_MSYS_TOTAL_HASH "${arg_SHA512}")
set(Z_VCPKG_MSYS_TOTAL_HASH "${Z_VCPKG_MSYS_TOTAL_HASH}" PARENT_SCOPE)
endif()
endfunction()
function(vcpkg_acquire_msys out_msys_root)
cmake_parse_arguments(PARSE_ARGV 1 "arg"
"NO_DEFAULT_PACKAGES;Z_ALL_PACKAGES"
""
"PACKAGES;DIRECT_PACKAGES"
)
if(DEFINED arg_UNPARSED_ARGUMENTS)
message(WARNING "vcpkg_acquire_msys was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
endif()
set(Z_VCPKG_MSYS_TOTAL_HASH)
set(Z_VCPKG_MSYS_ARCHIVES)
set(Z_VCPKG_MSYS_PACKAGES "${arg_PACKAGES}")
if(NOT arg_NO_DEFAULT_PACKAGES)
list(APPEND Z_VCPKG_MSYS_PACKAGES bash coreutils sed grep gawk gzip diffutils make pkg-config)
endif()
if(DEFINED arg_DIRECT_PACKAGES AND NOT arg_DIRECT_PACKAGES STREQUAL "")
list(LENGTH arg_DIRECT_PACKAGES direct_packages_length)
math(EXPR direct_packages_parity "${direct_packages_length} % 2")
math(EXPR direct_packages_number "${direct_packages_length} / 2")
math(EXPR direct_packages_last "${direct_packages_number} - 1")
if(direct_packages_parity EQUAL 1)
message(FATAL_ERROR "vcpkg_acquire_msys(... DIRECT_PACKAGES ...) requires exactly pairs of URL/SHA512")
endif()
# direct_packages_last > direct_packages_number - 1 > 0 - 1 >= 0, so this is fine
foreach(index RANGE "${direct_packages_last}")
math(EXPR url_index "${index} * 2")
math(EXPR sha512_index "${url_index} + 1")
list(GET arg_DIRECT_PACKAGES "${url_index}" url)
list(GET arg_DIRECT_PACKAGES "${sha512_index}" sha512)
get_filename_component(filename "${url}" NAME)
z_vcpkg_acquire_msys_download_package(archive
URL "${url}"
SHA512 "${sha512}"
FILENAME "${filename}"
)
list(APPEND Z_VCPKG_MSYS_ARCHIVES "${archive}")
string(APPEND Z_VCPKG_MSYS_TOTAL_HASH "${sha512}")
endforeach()
endif()
# To add new entries, use https://packages.msys2.org/package/$PACKAGE?repo=msys
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/unzip-6.0-2-x86_64.pkg.tar.xz"
SHA512 b8a1e0ce6deff26939cb46267f80ada0a623b7d782e80873cea3d388b4dc3a1053b14d7565b31f70bc904bf66f66ab58ccc1cd6bfa677065de1f279dd331afb9
DEPS libbz2
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/libbz2-1.0.8-3-x86_64.pkg.tar.zst"
SHA512 955420cabd45a02f431f5b685d8dc8acbd07a8dcdda5fdf8b9de37d3ab02d427bdb0a6d8b67c448e307f21094e405e916fd37a8e9805abd03610f45c02d64b9e
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/patch-2.7.6-1-x86_64.pkg.tar.xz"
SHA512 04d06b9d5479f129f56e8290e0afe25217ffa457ec7bed3e576df08d4a85effd80d6e0ad82bd7541043100799b608a64da3c8f535f8ea173d326da6194902e8c
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/gzip-1.11-1-x86_64.pkg.tar.zst"
SHA512 bcd9d7839aef5f2b73c4d39b51838e62626c201c808d512806ba0a1619aee83c7deddb0d499fd93f9815fe351d7ab656c31c9dc7ee1171d77ad6d598e04dfcbe
DEPS msys2-runtime
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/texinfo-6.8-3-x86_64.pkg.tar.zst"
SHA512 5cc16d3b3c3b9859fe61233fa27f2146526e2b4d6e626814d283b35bfd77bc15eb4ffaec00bde6c10df93466d9155a06854a7ecf2e0d9af746dd56c4d88d192e
DEPS bash perl
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/bash-5.1.008-1-x86_64.pkg.tar.zst"
SHA512 a2ab8c958615134dc666254baca8cb13ed773036954e458de74ffb3bfe661bb33149082d38b677024da451755098a9201ab7dd435ced6e7f6b4e94c3ae368daf
DEPS msys2-runtime
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/autoconf-2.71-3-any.pkg.tar.zst"
SHA512 f639deac9b2191c2096584cf374103bbb1e9d2476dd0ebec94b1e80da59be25b88e362ac5280487a89f0bb0ed57f99b66e314f36b7de9cda03c0974806a3a4e2
DEPS m4 perl
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/autoconf-archive-2019.01.06-1-any.pkg.tar.xz"
SHA512 77540d3d3644d94a52ade1f5db27b7b4b5910bbcd6995195d511378ca6d394a1dd8d606d57161c744699e6c63c5e55dfe6e8664d032cc8c650af9fdbb2db08b0
DEPS m4 perl
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/diffutils-3.8-2-x86_64.pkg.tar.zst"
SHA512 ee74e457c417d6978b3185f2fb8e15c9c30ecfc316c2474d69c978e7eb2282a3bd050d68dbf43d694cb5ab6f159b0e7ca319d01f8192071d82a224dde87d69b5
DEPS msys2-runtime
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/binutils-2.37-5-x86_64.pkg.tar.zst"
SHA512 32129cf97b53d5f6d87b42f17643e9dfc2e41b9ab4e4dfdc10e69725a9349bb25e57e0937e7504798cae91f7a88e0f4f5814e9f6a021bb68779d023176d2f311
DEPS libiconv libintl
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/libtool-2.4.6-9-x86_64.pkg.tar.xz"
SHA512 b309799e5a9d248ef66eaf11a0bd21bf4e8b9bd5c677c627ec83fa760ce9f0b54ddf1b62cbb436e641fbbde71e3b61cb71ff541d866f8ca7717a3a0dbeb00ebf
DEPS grep sed coreutils file findutils
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/file-5.41-2-x86_64.pkg.tar.zst"
SHA512 124c3983608879362acea7d487bf23690f371b3cfe0355385f0e643263b2a5568abe5cebda92ef9bc534e81f850138f589e75982f36a53f509676056d71de642
DEPS gcc-libs zlib libbz2
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/zlib-1.2.11-1-x86_64.pkg.tar.xz"
SHA512 b607da40d3388b440f2a09e154f21966cd55ad77e02d47805f78a9dee5de40226225bf0b8335fdfd4b83f25ead3098e9cb974d4f202f28827f8468e30e3b790d
DEPS gcc-libs
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/bzip2-1.0.8-3-x86_64.pkg.tar.zst"
SHA512 9d03e8fc5677dd1386454bd27a683667e829ad5b1b87fc0879027920b2e79b25a2d773ab2556cd29844b18dd25b26fef5a57bf89e35ca318e39443dcaf0ca3ba
DEPS gcc-libs
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/libbz2-1.0.8-3-x86_64.pkg.tar.zst"
SHA512 955420cabd45a02f431f5b685d8dc8acbd07a8dcdda5fdf8b9de37d3ab02d427bdb0a6d8b67c448e307f21094e405e916fd37a8e9805abd03610f45c02d64b9e
DEPS gcc-libs
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/coreutils-8.32-2-x86_64.pkg.tar.zst"
SHA512 0719e8d3683711453ff77496cad11583e877ea52806e5ea3f470444705705db20a8a9fe99987166b02c6bd240c06c7d86faa979a7bc5536c9c804d800b60b7be
DEPS libiconv libintl gmp
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/grep-3.0-2-x86_64.pkg.tar.xz"
SHA512 c784d5f8a929ae251f2ffaccf7ab0b3936ae9f012041e8f074826dd6077ad0a859abba19feade1e71b3289cc640626dfe827afe91c272b38a1808f228f2fdd00
DEPS libiconv libintl libpcre
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/sed-4.8-2-x86_64.pkg.tar.zst"
SHA512 8391be777239e0bfc19dc477995ee581ea9dbb1ba34fc27f57ba9d858e7489ac9b7200479d405712b43fa88434dd597be71d161fa8c05606e7ef991711bfc4c1
DEPS libintl
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/libpcre-8.45-1-x86_64.pkg.tar.zst"
SHA512 b10a69380c44ea35367f310a7400eae26beacf347ddbb5da650b54924b80ffd791f12a9d70923567e5081e3c7098f042e47bcff1328d95b0b27ce63bcd762e88
DEPS gcc-libs
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/m4-1.4.19-2-x86_64.pkg.tar.zst"
SHA512 7471099ba7e3b47e5b019dc0e563165a8660722f2bbd337fb579e6d1832c0e7dcab0ca9297c4692b18add92c4ad49e94391c621cf38874e2ff63d4f926bac38c
DEPS msys2-runtime
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/automake-wrapper-11-4-any.pkg.tar.zst"
SHA512 175940ebccb490c25d2c431dd025f24a7d0c930a7ee8cb81a44a4989c1d07f4b5a8134e1d05a7a1b206f8e19a2308ee198b1295e31b2e139f5d9c1c077252c94
DEPS gawk
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/gawk-5.1.0-2-x86_64.pkg.tar.zst"
SHA512 d4b00e2b53ce99ddd3ee8e41c41add5ab36d26a54107acf7f5a5bf4a0033d72465cdab86f5b2eb8b7aca2cb5027a3e35cb194794c3bf563c0075ca3dbcad6987
DEPS libintl libreadline mpfr
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/mpfr-4.1.0-1-x86_64.pkg.tar.zst"
SHA512 d64fa60e188124591d41fc097d7eb51d7ea4940bac05cdcf5eafde951ed1eaa174468f5ede03e61106e1633e3428964b34c96de76321ed8853b398fbe8c4d072
DEPS gmp gcc-libs
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/gmp-6.2.1-1-x86_64.pkg.tar.zst"
SHA512 c5c8009ef069d05c2209b69c8e87094b09aac4b5c3dfdbea474d8262e55d286b400f1360c6a9778fd5eb87fb76a6463c21188286a1a1919ad79153eae3c44b0f
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/xz-5.2.5-1-x86_64.pkg.tar.xz" # this seems to require immediate updating on version bumps.
SHA512 99d092c3398277e47586cead103b41e023e9432911fb7bdeafb967b826f6a57d32e58afc94c8230dad5b5ec2aef4f10d61362a6d9e410a6645cf23f076736bba
DEPS liblzma libiconv gettext
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/liblzma-5.2.5-1-x86_64.pkg.tar.xz"
SHA512 8d5c04354fdc7309e73abce679a4369c0be3dc342de51cef9d2a932b7df6a961c8cb1f7e373b1b8b2be40343a95fbd57ac29ebef63d4a2074be1d865e28ca6ad
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/libreadline-8.1.001-1-x86_64.pkg.tar.zst"
SHA512 4104eb0c18b8c06ab3bd4ba6420e3464df8293bec673c88da49e2f74cf1d583c922e9ead5691271fe593d424f92d1fd8668a3002174d756993d5b18337459bab
DEPS ncurses
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/ncurses-6.2-2-x86_64.pkg.tar.zst"
SHA512 4bf744a21ab2030ea9d65eb4d824ec5bed4532b7a489859e5e19bba11b5ba9be08613de48acb38baacfd2a7295722e4d858d7c577565f1999d2583defbbb58f2
DEPS msys2-runtime
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/automake1.16-1.16.3-3-any.pkg.tar.zst"
SHA512 77a195a9fe8680bee55c04b8ecc0e9ee43e2d89607c745098dfac4687f4f853885cabbb005202d70e9a9cdf9facf6849cc47c6b2f25573b5af8201696d926c72
DEPS perl
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/perl-5.32.1-2-x86_64.pkg.tar.zst"
SHA512 ad21734c05bc7faa809bc4ba761fb41a3b448d31794d1fd3d430cf4afe05ae991aabece4ec9a25718c01cc323d507bf97530533f0a20aabc18a7a2ccc0ae02b1
DEPS libcrypt
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/libcrypt-2.1-3-x86_64.pkg.tar.zst"
SHA512 15cee333a82b55ff6072b7be30bf1c33c926d8ac21a0a91bc4cbf655b6f547bc29496df5fa288eb47ca2f88af2a4696f9b718394437b65dd06e3d6669ca0c2e5
DEPS gcc-libs
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/pkg-config-0.29.2-4-x86_64.pkg.tar.zst"
SHA512 9f72c81d8095ca1c341998bc80788f7ce125770ec4252f1eb6445b9cba74db5614caf9a6cc7c0fcc2ac18d4a0f972c49b9f245c3c9c8e588126be6c72a8c1818
DEPS libiconv
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/make-4.3-3-x86_64.pkg.tar.zst"
SHA512 1d991bfc2f076c8288023c7dd71c65470ad852e0744870368a4ab56644f88c7f6bbeca89dbeb7ac8b2719340cfec737a8bceae49569bbe4e75b6b8ffdcfe76f1
DEPS libintl msys2-runtime
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/gettext-devel-0.21-1-x86_64.pkg.tar.zst"
SHA512 44444064b9860dbd3cb886812fb20ee97ab04a65616cca497be69c592d5507e7bc66bfe8dbd060a4df9c5d9bb44cb0f231584d65cb04351146d54d15852227af
DEPS gettext
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/gettext-0.21-1-x86_64.pkg.tar.zst"
SHA512 6ef5f4094c4a174550a898cac4f60215d22de09f7e5f72bdb297d18a6f027e6122b4a519aa8d5781f9b0201dcae14ad7910b181b1499d6d8bbeb5a35b3a08581
DEPS libintl libgettextpo libasprintf tar
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/tar-1.34-2-x86_64.pkg.tar.zst"
SHA512 127a971f5c087500ec4858697205b36ae76dba82307f1bcaaa44e746337d85d97360e46e55ef7fecbfa2a4af428ee26d804fa7d7c2b8ce6de1b86328dd14ef2d
DEPS libiconv libintl
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/libgettextpo-0.21-1-x86_64.pkg.tar.zst"
SHA512 bb217639deadb36734bafb8db5217e654d00b93a3ef366116cc6c9b8b8951abef9a7e9b04be3fae09074cf68576f18575a0d09f3d2f344985606c1449a17222e
DEPS gcc-libs
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/libasprintf-0.21-1-x86_64.pkg.tar.zst"
SHA512 62dde7bfcfea75ea9adb463807d7c128019ffeec0fb23e73bc39f760e45483c61f4f29e89cdbfab1e317d520c83fe3b65306fbd7258fe11ea951612dbee479fe
DEPS gcc-libs
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/findutils-4.8.0-1-x86_64.pkg.tar.zst"
SHA512 74f8750636becefd3675c89957dfb8a244d2db6fec80bf352998edfef93f66d0e2a37d7f2869a79dd197acf2057ccd6aefd12c58e94154765896a432831ab49c
DEPS libintl libiconv
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/libintl-0.21-1-x86_64.pkg.tar.zst"
SHA512 be0242eed25793e86e0560868f76cf06a358ffc0b2beb357e776d6c7819e545ac90f9358b17a85aa598584babe3ab4bb4544e360a28f5cec965f314178b930d1
DEPS libiconv
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/libiconv-1.16-2-x86_64.pkg.tar.zst"
SHA512 3ab569eca9887ef85e7dd5dbca3143d8a60f7103f370a7ecc979a58a56b0c8dcf1f54ac3df4495bc306bd44bf36ee285aaebbb221c4eebfc912cf47d347d45fc
DEPS gcc-libs
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/gcc-libs-11.2.0-3-x86_64.pkg.tar.zst"
SHA512 be7bb61d1b87eafbb91cf9d0fee3270b9d5e2420c403ea394967941195d52ae248ce4ffde20af41a05310527a920269018f49487be617211a5e340486babd0f8
DEPS msys2-runtime
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/msys/x86_64/msys2-runtime-3.2.0-8-x86_64.pkg.tar.zst"
SHA512 fdd86f4ffa6e274d6fef1676a4987971b1f2e1ec556eee947adcb4240dc562180afc4914c2bdecba284012967d3d3cf4d1a392f798a3b32a3668d6678a86e8d3
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-python-numpy-1.20.3-1-any.pkg.tar.zst"
SHA512 ce73d4270942f61963e8307f6bec945d14e3774455684842b8fde836b19a4e9cbf8efd0663ffb28ad872493db70fa3a4e14bd0b248c2067199f4fee94e80e77e
DEPS mingw-w64-x86_64-openblas mingw-w64-x86_64-python
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-openblas-0.3.19-1-any.pkg.tar.zst"
SHA512 0d18a93d7804d6469b8566cf4ad3a7efbdf8a4a4b05d191b23a30e107586423c6338b9f4a5ea2cc93052e6c0336dc82a43c26189c410263a6e705e6f3ebe261a
DEPS mingw-w64-x86_64-gcc-libgfortran mingw-w64-x86_64-gcc-libs mingw-w64-x86_64-libwinpthread
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-gcc-libgfortran-11.2.0-8-any.pkg.tar.zst"
SHA512 8537b55633bc83d81d528378590e417ffe8c26b6c327d8b6d7ba50a8b5f4e090fbe2dc500deb834120edf25ac3c493055f4de2dc64bde061be23ce0f625a8893
DEPS mingw-w64-x86_64-gcc-libs
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-python-3.8.9-2-any.pkg.tar.zst"
SHA512 8a45b28b2b0471718bd1ab096958872b18ae3b25f06c30718c54d1edaf04214397330a51776f3e4eee556ac47d9e3aa5e1b211c5df0cf6be3046a6f3a79cfa7d
DEPS mingw-w64-x86_64-bzip2 mingw-w64-x86_64-expat mingw-w64-x86_64-gcc-libs mingw-w64-x86_64-libffi mingw-w64-x86_64-mpdecimal mingw-w64-x86_64-ncurses mingw-w64-x86_64-openssl mingw-w64-x86_64-sqlite3 mingw-w64-x86_64-tcl mingw-w64-x86_64-tk mingw-w64-x86_64-xz mingw-w64-x86_64-zlib
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-bzip2-1.0.8-2-any.pkg.tar.zst"
SHA512 4f7ba44189d953d4d00e7bbf5a7697233f759c92847c074f0f2888d2a641c59ce4bd3c39617adac0ad7b53c5836e529f9ffd889f976444016976bb517e5c24a2
DEPS mingw-w64-x86_64-gcc-libs
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-mpdecimal-2.5.1-1-any.pkg.tar.zst"
SHA512 1204c31367f9268ffd6658be04af7687c01f984c9d6be8c7a20ee0ebde1ca9a03b766ef1aeb1fa7aaa97b88a57f7a73afa7f7a7fed9c6b895a032db11e6133bf
DEPS mingw-w64-x86_64-gcc-libs
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-ncurses-6.3-3-any.pkg.tar.zst"
SHA512 888c155d878651dc31c9a01455ab689d7b644cec759521b69b8399c20b6ddc77c90f3ee4ddeed8857084335335b4b30e182d826fb5b78719b704f13a1dfdbd54
DEPS mingw-w64-x86_64-libsystre
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-libsystre-1.0.1-4-any.pkg.tar.xz"
SHA512 6540e896636d00d1ea4782965b3fe4d4ef1e32e689a98d25e2987191295b319eb1de2e56be3a4b524ff94f522a6c3e55f8159c1a6f58c8739e90f8e24e2d40d8
DEPS mingw-w64-x86_64-libtre
)
z_vcpkg_acquire_msys_declare_package(
NAME "mingw-w64-x86_64-libtre"
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-libtre-git-r128.6fb7206-2-any.pkg.tar.xz"
SHA512 d595dbcf3a3b6ed098e46f370533ab86433efcd6b4d3dcf00bbe944ab8c17db7a20f6535b523da43b061f071a3b8aa651700b443ae14ec752ae87500ccc0332d
DEPS mingw-w64-x86_64-gcc-libs mingw-w64-x86_64-gettext
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-openssl-1.1.1.m-1-any.pkg.tar.zst"
SHA512 9471b0e5b01453f6ee5c92be6e259446c6b5be45d1da8985a4735b3e54c835d9b86286b2af126546419bf968df096442bd4f60f30efa1a901316e3c02b98525f
DEPS mingw-w64-x86_64-ca-certificates mingw-w64-x86_64-gcc-libs mingw-w64-x86_64-zlib
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-ca-certificates-20210119-1-any.pkg.tar.zst"
SHA512 5590ca116d73572eb336ad73ea5df9da34286d8ff8f6b162b38564d0057aa23b74a30858153013324516af26671046addd6bcade221e94e7b8ed5e8f886e1c58
DEPS mingw-w64-x86_64-p11-kit
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-p11-kit-0.24.1-1-any.pkg.tar.zst"
SHA512 6437919cd61c8b1a59b346bbd93d960adb7f11206e8c0010311d71d0fe9aa03f950ecf08f19a5555b27f481cc0d61b88650b165ae9336ac1a1a0a9be553239b9
DEPS mingw-w64-x86_64-gettext mingw-w64-x86_64-libffi mingw-w64-x86_64-libtasn1
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-libtasn1-4.18.0-1-any.pkg.tar.zst"
SHA512 2584a6e0bc2b7d145f026487951b8690e3d8e79f475a7b77f95fc27ca9a9f1887fe9303e340ba2635353c4a6f6a2f10a907dd8778e54be7506a15459f616d4a4
DEPS mingw-w64-x86_64-gcc-libs
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-sqlite3-3.37.2-1-any.pkg.tar.zst"
SHA512 0f83f10b0c8f4699a6b84deb6986fcd471cb80b995561ad793e827f9dd66110d555744918ed91982aec8d9743f6064726dd5eba3e695aa9ab5381ea4f8e76dbe
DEPS mingw-w64-x86_64-gcc-libs mingw-w64-x86_64-readline mingw-w64-x86_64-tcl
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-readline-8.1.001-1-any.pkg.tar.zst"
SHA512 b38aef9216ea2ba7edd82ce57a48dbc913b9bdcb44b96b9800342fe097d706ba39c9d5ba08d793d2c3388722479258bb05388ae09d74a1edcaaf9002e9d71853
DEPS mingw-w64-x86_64-gcc-libs mingw-w64-x86_64-termcap
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-termcap-1.3.1-6-any.pkg.tar.zst"
SHA512 602d182ba0f1e20c4c51ae09b327c345bd736e6e4f22cd7d58374ac68c705dd0af97663b9b94d41870457f46bb9110abb29186d182196133618fc460f71d1300
DEPS mingw-w64-x86_64-gcc-libs
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-tk-8.6.11.1-2-any.pkg.tar.zst"
SHA512 15fd4e085fabe2281f33c8f36f4b1b0be132e5b100f6d4eaf54688842791aa2cf4e6d38a855f74f42be3f86c52e20044518f5843f8e9ca13c54a6ea4adb973a8
DEPS mingw-w64-x86_64-tcl
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-tcl-8.6.11-5-any.pkg.tar.zst"
SHA512 9db75ff47260ea3652d1abf60cd44649d0e8cbe5c4d26c316b99a6edb08252fb87ed017c856f151da99bcaa0bd90c0bebae28234035b008c5bd6508511639852
DEPS mingw-w64-x86_64-gcc-libs mingw-w64-x86_64-zlib
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-xz-5.2.5-2-any.pkg.tar.zst"
SHA512 94fcf8b9f9fbc2cfdb2ed53dbe72797806aa3399c4dcfea9c6204702c4504eb4d4204000accd965fcd0680d994bf947eae308bc576e629bbaa3a4cefda3aea52
DEPS mingw-w64-x86_64-gcc-libs mingw-w64-x86_64-gettext
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-gettext-0.21-3-any.pkg.tar.zst"
SHA512 38daa0edd1a2c1efdd56baeb6805d10501a57e0c8ab98942e4a16f8b021908dac315513ea85f5278adf300bce3052a44a3f8b473adb0d5d3656aa4a48fe61081
DEPS mingw-w64-x86_64-expat mingw-w64-x86_64-gcc-libs mingw-w64-x86_64-libiconv
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-gcc-libs-11.2.0-8-any.pkg.tar.zst"
SHA512 2481f7c8db7cca549911bc71715af86ca287ffed6d673c9a6c3a4c792b68899a129dd959214af7067f434e74fc518c43749e7d928cbd2232ab4fbc65880dad98
DEPS mingw-w64-x86_64-gmp mingw-w64-x86_64-libwinpthread mingw-w64-x86_64-mpc mingw-w64-x86_64-mpfr
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-mpc-1.2.1-1-any.pkg.tar.zst"
SHA512 f2c137dbb0b6feea68dde9739c38b44dcb570324e3947adf991028e8f63c9ff50a11f47be15b90279ff40bcac7f320d952cfc14e69ba8d02cf8190c848d976a1
DEPS mingw-w64-x86_64-mpfr
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-mpfr-4.1.0-3-any.pkg.tar.zst"
SHA512 be8ad04e53804f18cfeec5b9cba1877af1516762de60891e115826fcfe95166751a68e24cdf351a021294e3189c31ce3c2db0ebf9c1d4d4ab6fea1468f73ced5
DEPS mingw-w64-x86_64-gmp
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-gmp-6.2.1-3-any.pkg.tar.zst"
SHA512 d0d4ed1a046b64f437e72bbcf722b30311dde5f5e768a520141423fc0a3127b116bd62cfd4b5cf5c01a71ee0f9cf6479fcc31277904652d8f6ddbf16e33e0b72
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-expat-2.4.4-1-any.pkg.tar.zst"
SHA512 479e6591d06eee2686591d7232a60d4092540deb40cf0c2c418de861b1da6b21fb4be82e603dd4a3b88f5a1b1d21cdb4f016780dda8131e32be5c3dec85dfc4d
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-libffi-3.3-4-any.pkg.tar.zst"
SHA512 1d7be396ef132289be0c33792c4e81dea6cb7b1eafa249fb3e8abc0b393d14e5114905c0c0262b6a7aed8f196ae4d7a10fbafd342b08ec76c9196921332747b5
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-libiconv-1.16-2-any.pkg.tar.zst"
SHA512 542ed5d898a57a79d3523458f8f3409669b411f87d0852bb566d66f75c96422433f70628314338993461bcb19d4bfac4dadd9d21390cb4d95ef0445669288658
)
z_vcpkg_acquire_msys_declare_package(
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-zlib-1.2.11-9-any.pkg.tar.zst"
SHA512 f386d3a8d8c169a62a4580af074b7fdc0760ef0fde22ef7020a349382dd374a9e946606c757d12da1c1fe68baf5e2eaf459446e653477035a63e0e20df8f4aa0
)
z_vcpkg_acquire_msys_declare_package(
NAME "mingw-w64-x86_64-libwinpthread"
URL "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-libwinpthread-git-9.0.0.6373.5be8fcd83-1-any.pkg.tar.zst"
SHA512 a2c9e60d23b1310a6cec1fadd2b15a8c07223f3fe90d41b1579e9fc27ee2b0b408456291a55fad54a156e6a247efc20f6fcc247cc567e64fe190938aa3b672e9
)
if(NOT Z_VCPKG_MSYS_PACKAGES STREQUAL "")
message(FATAL_ERROR "Unknown packages were required for vcpkg_acquire_msys(${arg_PACKAGES}): ${packages}
This can be resolved by explicitly passing URL/SHA pairs to DIRECT_PACKAGES.")
endif()
string(SHA512 total_hash "${Z_VCPKG_MSYS_TOTAL_HASH}")
string(SUBSTRING "${total_hash}" 0 16 total_hash)
set(path_to_root "${DOWNLOADS}/tools/msys2/${total_hash}")
if(NOT EXISTS "${path_to_root}")
file(REMOVE_RECURSE "${path_to_root}.tmp")
file(MAKE_DIRECTORY "${path_to_root}.tmp/tmp")
set(index 0)
foreach(archive IN LISTS Z_VCPKG_MSYS_ARCHIVES)
vcpkg_execute_required_process(
ALLOW_IN_DOWNLOAD_MODE
COMMAND "${CMAKE_COMMAND}" -E tar xzf "${archive}"
LOGNAME "msys-${TARGET_TRIPLET}-${index}"
WORKING_DIRECTORY "${path_to_root}.tmp"
)
math(EXPR index "${index} + 1")
endforeach()
file(RENAME "${path_to_root}.tmp" "${path_to_root}")
endif()
# Due to skipping the regular MSYS2 installer,
# some config files need to be established explicitly.
if(NOT EXISTS "${path_to_root}/etc/fstab")
# This fstab entry removes the cygdrive prefix from paths.
file(WRITE "${path_to_root}/etc/fstab" "none / cygdrive binary,posix=0,noacl,user 0 0")
endif()
message(STATUS "Using msys root at ${path_to_root}")
set("${out_msys_root}" "${path_to_root}" PARENT_SCOPE)
endfunction()

View File

@@ -1,10 +0,0 @@
function(vcpkg_add_to_path)
cmake_parse_arguments(PARSE_ARGV 0 "arg" "PREPEND" "" "")
if(arg_PREPEND)
set(operation PREPEND)
else()
set(operation APPEND)
endif()
vcpkg_host_path_list("${operation}" ENV{PATH} ${arg_UNPARSED_ARGUMENTS})
endfunction()

View File

@@ -1,17 +0,0 @@
function(vcpkg_apply_patches)
z_vcpkg_deprecation_message("vcpkg_apply_patches has been deprecated in favor of the `PATCHES` argument to `vcpkg_from_*`.")
cmake_parse_arguments(PARSE_ARGV 0 "arg" "QUIET" "SOURCE_PATH" "PATCHES")
if(arg_QUIET)
set(quiet "QUIET")
else()
set(quiet)
endif()
z_vcpkg_apply_patches(
SOURCE_PATH "${arg_SOURCE_PATH}"
${quiet}
PATCHES ${arg_PATCHES}
)
endfunction()

View File

@@ -1,35 +0,0 @@
function(vcpkg_backup_env_variables)
cmake_parse_arguments(PARSE_ARGV 0 arg "" "" "VARS")
if(NOT DEFINED arg_VARS)
message(FATAL_ERROR "VARS must be defined.")
endif()
if(DEFINED arg_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
endif()
foreach(envvar IN LISTS arg_VARS)
if(DEFINED ENV{${envvar}})
set("z_vcpkg_env_backup_${envvar}" "$ENV{${envvar}}" PARENT_SCOPE)
else()
unset("z_vcpkg_env_backup_${envvar}" PARENT_SCOPE)
endif()
endforeach()
endfunction()
function(vcpkg_restore_env_variables)
cmake_parse_arguments(PARSE_ARGV 0 arg "" "" "VARS")
if(NOT DEFINED arg_VARS)
message(FATAL_ERROR "VARS must be defined.")
endif()
if(DEFINED arg_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
endif()
foreach(envvar IN LISTS arg_VARS)
if(DEFINED z_vcpkg_env_backup_${envvar})
set("ENV{${envvar}}" "${z_vcpkg_env_backup_${envvar}}")
else()
unset("ENV{${envvar}}")
endif()
endforeach()
endfunction()

View File

@@ -1,95 +0,0 @@
function(vcpkg_build_cmake)
cmake_parse_arguments(PARSE_ARGV 0 "arg"
"DISABLE_PARALLEL;ADD_BIN_TO_PATH"
"TARGET;LOGFILE_ROOT"
""
)
if(Z_VCPKG_CMAKE_BUILD_GUARD)
message(FATAL_ERROR "The ${PORT} port already depends on vcpkg-cmake; using both vcpkg-cmake and vcpkg_build_cmake in the same port is unsupported.")
endif()
if(NOT DEFINED arg_LOGFILE_ROOT)
set(arg_LOGFILE_ROOT "build")
endif()
vcpkg_list(SET build_param)
vcpkg_list(SET parallel_param)
vcpkg_list(SET no_parallel_param)
if("${Z_VCPKG_CMAKE_GENERATOR}" STREQUAL "Ninja")
vcpkg_list(SET build_param "-v") # verbose output
vcpkg_list(SET parallel_param "-j${VCPKG_CONCURRENCY}")
vcpkg_list(SET no_parallel_param "-j1")
elseif("${Z_VCPKG_CMAKE_GENERATOR}" MATCHES "^Visual Studio")
vcpkg_list(SET build_param
"/p:VCPkgLocalAppDataDisabled=true"
"/p:UseIntelMKL=No"
)
vcpkg_list(SET parallel_param "/m")
elseif("${Z_VCPKG_CMAKE_GENERATOR}" STREQUAL "NMake Makefiles")
# No options are currently added for nmake builds
elseif(Z_VCPKG_CMAKE_GENERATOR STREQUAL "Unix Makefiles")
vcpkg_list(SET build_args "VERBOSE=1")
vcpkg_list(SET parallel_args "-j${VCPKG_CONCURRENCY}")
vcpkg_list(SET no_parallel_args "")
elseif(Z_VCPKG_CMAKE_GENERATOR STREQUAL "Xcode")
vcpkg_list(SET parallel_args -jobs "${VCPKG_CONCURRENCY}")
vcpkg_list(SET no_parallel_args -jobs 1)
else()
message(FATAL_ERROR "Unrecognized GENERATOR setting from vcpkg_configure_cmake(). Valid generators are: Ninja, Visual Studio, and NMake Makefiles")
endif()
vcpkg_list(SET target_param)
if(arg_TARGET)
vcpkg_list(SET target_param "--target" "${arg_TARGET}")
endif()
foreach(build_type IN ITEMS debug release)
if(NOT DEFINED VCPKG_BUILD_TYPE OR "${VCPKG_BUILD_TYPE}" STREQUAL "${build_type}")
if("${build_type}" STREQUAL "debug")
set(short_build_type "dbg")
set(config "Debug")
else()
set(short_build_type "rel")
set(config "Release")
endif()
message(STATUS "Building ${TARGET_TRIPLET}-${short_build_type}")
if(arg_ADD_BIN_TO_PATH)
vcpkg_backup_env_variables(VARS PATH)
if("${build_type}" STREQUAL "debug")
vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}/debug/bin")
else()
vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}/bin")
endif()
endif()
if(arg_DISABLE_PARALLEL)
vcpkg_execute_build_process(
COMMAND
"${CMAKE_COMMAND}" --build . --config "${config}" ${target_param}
-- ${build_param} ${no_parallel_param}
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${short_build_type}"
LOGNAME "${arg_LOGFILE_ROOT}-${TARGET_TRIPLET}-${short_build_type}"
)
else()
vcpkg_execute_build_process(
COMMAND
"${CMAKE_COMMAND}" --build . --config "${config}" ${target_param}
-- ${build_param} ${parallel_param}
NO_PARALLEL_COMMAND
"${CMAKE_COMMAND}" --build . --config "${config}" ${target_param}
-- ${build_param} ${no_parallel_param}
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${short_build_type}"
LOGNAME "${arg_LOGFILE_ROOT}-${TARGET_TRIPLET}-${short_build_type}"
)
endif()
if(arg_ADD_BIN_TO_PATH)
vcpkg_restore_env_variables(VARS PATH)
endif()
endif()
endforeach()
endfunction()

View File

@@ -1,203 +0,0 @@
function(vcpkg_build_make)
z_vcpkg_get_cmake_vars(cmake_vars_file)
include("${cmake_vars_file}")
# parse parameters such that semicolons in options arguments to COMMAND don't get erased
cmake_parse_arguments(PARSE_ARGV 0 arg
"ADD_BIN_TO_PATH;ENABLE_INSTALL;DISABLE_PARALLEL"
"LOGFILE_ROOT;BUILD_TARGET;SUBPATH;MAKEFILE;INSTALL_TARGET"
"OPTIONS"
)
if(DEFINED arg_UNPARSED_ARGUMENTS)
message(WARNING "vcpkg_make_build was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
endif()
if(NOT DEFINED arg_LOGFILE_ROOT)
set(arg_LOGFILE_ROOT "build")
endif()
if(NOT DEFINED arg_BUILD_TARGET)
set(arg_BUILD_TARGET "all")
endif()
if (NOT DEFINED arg_MAKEFILE)
set(arg_MAKEFILE Makefile)
endif()
if(NOT DEFINED arg_INSTALL_TARGET)
set(arg_INSTALL_TARGET "install")
endif()
if(WIN32)
set(Z_VCPKG_INSTALLED ${CURRENT_INSTALLED_DIR})
else()
string(REPLACE " " "\ " Z_VCPKG_INSTALLED "${CURRENT_INSTALLED_DIR}")
endif()
vcpkg_list(SET make_opts)
vcpkg_list(SET install_opts)
if (CMAKE_HOST_WIN32)
set(path_backup "$ENV{PATH}")
vcpkg_add_to_path(PREPEND "${SCRIPTS}/buildsystems/make_wrapper")
if(NOT DEFINED Z_VCPKG_MAKE)
vcpkg_acquire_msys(MSYS_ROOT)
find_program(Z_VCPKG_MAKE make PATHS "${MSYS_ROOT}/usr/bin" NO_DEFAULT_PATH REQUIRED)
endif()
set(make_command "${Z_VCPKG_MAKE}")
vcpkg_list(SET make_opts ${arg_OPTIONS} ${arg_MAKE_OPTIONS} -j ${VCPKG_CONCURRENCY} --trace -f ${arg_MAKEFILE} ${arg_BUILD_TARGET})
vcpkg_list(SET no_parallel_make_opts ${arg_OPTIONS} ${arg_MAKE_OPTIONS} -j 1 --trace -f ${arg_MAKEFILE} ${arg_BUILD_TARGET})
string(REPLACE " " [[\ ]] vcpkg_package_prefix "${CURRENT_PACKAGES_DIR}")
string(REGEX REPLACE [[([a-zA-Z]):/]] [[/\1/]] vcpkg_package_prefix "${vcpkg_package_prefix}")
vcpkg_list(SET install_opts -j ${VCPKG_CONCURRENCY} --trace -f ${arg_MAKEFILE} ${arg_INSTALL_TARGET} DESTDIR=${vcpkg_package_prefix})
#TODO: optimize for install-data (release) and install-exec (release/debug)
else()
if(VCPKG_HOST_IS_OPENBSD)
find_program(Z_VCPKG_MAKE gmake REQUIRED)
else()
find_program(Z_VCPKG_MAKE make REQUIRED)
endif()
set(make_command "${Z_VCPKG_MAKE}")
vcpkg_list(SET make_opts ${arg_MAKE_OPTIONS} V=1 -j ${VCPKG_CONCURRENCY} -f ${arg_MAKEFILE} ${arg_BUILD_TARGET})
vcpkg_list(SET no_parallel_make_opts ${arg_MAKE_OPTIONS} V=1 -j 1 -f ${arg_MAKEFILE} ${arg_BUILD_TARGET})
vcpkg_list(SET install_opts -j ${VCPKG_CONCURRENCY} -f ${arg_MAKEFILE} ${arg_INSTALL_TARGET} DESTDIR=${CURRENT_PACKAGES_DIR})
endif()
# Since includes are buildtype independent those are setup by vcpkg_configure_make
vcpkg_backup_env_variables(VARS LIB LIBPATH LIBRARY_PATH LD_LIBRARY_PATH CPPFLAGS CFLAGS CXXFLAGS RCFLAGS)
foreach(buildtype IN ITEMS "debug" "release")
if (buildtype STREQUAL "debug" AND _VCPKG_MAKE_NO_DEBUG)
continue()
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "${buildtype}")
if("${buildtype}" STREQUAL "debug")
set(short_buildtype "-dbg")
set(cmake_buildtype "DEBUG")
set(path_suffix "/debug")
else()
# In NO_DEBUG mode, we only use ${TARGET_TRIPLET} directory.
set(short_buildtype "-rel")
set(cmake_buildtype "RELEASE")
set(path_suffix "")
endif()
set(working_directory "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}${short_buildtype}/${arg_SUBPATH}")
message(STATUS "Building ${TARGET_TRIPLET}${short_buildtype}")
z_vcpkg_extract_cpp_flags_and_set_cflags_and_cxxflags("${cmake_buildtype}")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(LINKER_FLAGS_${cmake_buildtype} "${VCPKG_DETECTED_CMAKE_STATIC_LINKER_FLAGS_${cmake_buildtype}}")
else() # dynamic
set(LINKER_FLAGS_${cmake_buildtype} "${VCPKG_DETECTED_CMAKE_SHARED_LINKER_FLAGS_${cmake_buildtype}}")
endif()
set(LDFLAGS_${cmake_buildtype} "")
if(EXISTS "${Z_VCPKG_INSTALLED}${path_suffix}/lib")
string(APPEND LDFLAGS_${cmake_buildtype} " -L${Z_VCPKG_INSTALLED}${path_suffix}/lib")
endif()
if(EXISTS "${Z_VCPKG_INSTALLED}${path_suffix}/lib/manual-link")
string(APPEND LDFLAGS_${cmake_buildtype} " -L${Z_VCPKG_INSTALLED}${path_suffix}/lib/manual-link")
endif()
if (CMAKE_HOST_WIN32 AND VCPKG_DETECTED_CMAKE_C_COMPILER MATCHES "cl.exe")
set(LINK_ENV_${cmake_buildtype} "$ENV{_LINK_} ${LINKER_FLAGS_${cmake_buildtype}}")
else()
string(APPEND LDFLAGS_${cmake_buildtype} " ${LINKER_FLAGS_${cmake_buildtype}}")
endif()
# Setup environment
set(ENV{CPPFLAGS} "${CPPFLAGS_${cmake_buildtype}}")
set(ENV{CFLAGS} "${CFLAGS_${cmake_buildtype}}")
set(ENV{CXXFLAGS} "${CXXFLAGS_${cmake_buildtype}}")
set(ENV{RCFLAGS} "${VCPKG_DETECTED_CMAKE_RC_FLAGS_${cmake_buildtype}}")
set(ENV{LDFLAGS} "${LDFLAGS_${cmake_buildtype}}")
vcpkg_list(APPEND lib_env_vars LIB LIBPATH LIBRARY_PATH) # LD_LIBRARY_PATH)
foreach(lib_env_var IN LISTS lib_env_vars)
if(EXISTS "${Z_VCPKG_INSTALLED}${path_suffix}/lib")
vcpkg_host_path_list(PREPEND ENV{${lib_env_var}} "${Z_VCPKG_INSTALLED}${path_suffix}/lib")
endif()
if(EXISTS "${Z_VCPKG_INSTALLED}${path_suffix}/lib/manual-link")
vcpkg_host_path_list(PREPEND ENV{${lib_env_var}} "${Z_VCPKG_INSTALLED}${path_suffix}/lib/manual-link")
endif()
endforeach()
unset(lib_env_vars)
if(LINK_ENV_${cmake_buildtype})
set(config_link_backup "$ENV{_LINK_}")
set(ENV{_LINK_} "${LINK_ENV_${cmake_buildtype}}")
endif()
if(arg_ADD_BIN_TO_PATH)
set(env_backup_path "$ENV{PATH}")
vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}${path_suffix}/bin")
endif()
vcpkg_list(SET make_cmd_line ${make_command} ${make_opts})
vcpkg_list(SET no_parallel_make_cmd_line ${make_command} ${no_parallel_make_opts})
if (arg_DISABLE_PARALLEL)
vcpkg_execute_build_process(
COMMAND ${no_parallel_make_cmd_line}
WORKING_DIRECTORY "${working_directory}"
LOGNAME "${arg_LOGFILE_ROOT}-${TARGET_TRIPLET}${short_buildtype}"
)
else()
vcpkg_execute_build_process(
COMMAND ${make_cmd_line}
NO_PARALLEL_COMMAND ${no_parallel_make_cmd_line}
WORKING_DIRECTORY "${working_directory}"
LOGNAME "${arg_LOGFILE_ROOT}-${TARGET_TRIPLET}${short_buildtype}"
)
endif()
file(READ "${CURRENT_BUILDTREES_DIR}/${arg_LOGFILE_ROOT}-${TARGET_TRIPLET}${short_buildtype}-out.log" logdata)
if(logdata MATCHES "Warning: linker path does not have real file for library")
message(FATAL_ERROR "libtool could not find a file being linked against!")
endif()
if (arg_ENABLE_INSTALL)
message(STATUS "Installing ${TARGET_TRIPLET}${short_buildtype}")
vcpkg_list(SET make_cmd_line ${make_command} ${install_opts})
vcpkg_execute_build_process(
COMMAND ${make_cmd_line}
WORKING_DIRECTORY "${working_directory}"
LOGNAME "install-${TARGET_TRIPLET}${short_buildtype}"
)
endif()
if(config_link_backup)
set(ENV{_LINK_} "${config_link_backup}")
unset(config_link_backup)
endif()
if(arg_ADD_BIN_TO_PATH)
set(ENV{PATH} "${env_backup_path}")
endif()
endif()
vcpkg_restore_env_variables(VARS LIB LIBPATH LIBRARY_PATH)
endforeach()
if (arg_ENABLE_INSTALL)
string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" Z_VCPKG_INSTALL_PREFIX "${CURRENT_INSTALLED_DIR}")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}_tmp")
file(RENAME "${CURRENT_PACKAGES_DIR}" "${CURRENT_PACKAGES_DIR}_tmp")
file(RENAME "${CURRENT_PACKAGES_DIR}_tmp${Z_VCPKG_INSTALL_PREFIX}" "${CURRENT_PACKAGES_DIR}")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}_tmp")
endif()
# Remove libtool files since they contain absolute paths and are not necessary.
file(GLOB_RECURSE libtool_files "${CURRENT_PACKAGES_DIR}/**/*.la")
if(libtool_files)
file(REMOVE ${libtool_files})
endif()
if (CMAKE_HOST_WIN32)
set(ENV{PATH} "${path_backup}")
endif()
vcpkg_restore_env_variables(VARS LIB LIBPATH LIBRARY_PATH LD_LIBRARY_PATH CPPFLAGS CFLAGS CXXFLAGS RCFLAGS)
unset(_VCPKG_MAKE_NO_DEBUG PARENT_SCOPE)
endfunction()

View File

@@ -1,87 +0,0 @@
function(vcpkg_build_msbuild)
cmake_parse_arguments(
PARSE_ARGV 0
arg
"USE_VCPKG_INTEGRATION"
"PROJECT_PATH;RELEASE_CONFIGURATION;DEBUG_CONFIGURATION;PLATFORM;PLATFORM_TOOLSET;TARGET_PLATFORM_VERSION;TARGET"
"OPTIONS;OPTIONS_RELEASE;OPTIONS_DEBUG"
)
if(DEFINED arg_UNPARSED_ARGUMENTS)
message(WARNING "vcpkg_build_msbuild was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
endif()
if(NOT DEFINED arg_RELEASE_CONFIGURATION)
set(arg_RELEASE_CONFIGURATION Release)
endif()
if(NOT DEFINED arg_DEBUG_CONFIGURATION)
set(arg_DEBUG_CONFIGURATION Debug)
endif()
if(NOT DEFINED arg_PLATFORM)
set(arg_PLATFORM "${TRIPLET_SYSTEM_ARCH}")
endif()
if(NOT DEFINED arg_PLATFORM_TOOLSET)
set(arg_PLATFORM_TOOLSET "${VCPKG_PLATFORM_TOOLSET}")
endif()
if(NOT DEFINED arg_TARGET_PLATFORM_VERSION)
vcpkg_get_windows_sdk(arg_TARGET_PLATFORM_VERSION)
endif()
if(NOT DEFINED arg_TARGET)
set(arg_TARGET Rebuild)
endif()
list(APPEND arg_OPTIONS
"/t:${arg_TARGET}"
"/p:Platform=${arg_PLATFORM}"
"/p:PlatformToolset=${arg_PLATFORM_TOOLSET}"
"/p:VCPkgLocalAppDataDisabled=true"
"/p:UseIntelMKL=No"
"/p:WindowsTargetPlatformVersion=${arg_TARGET_PLATFORM_VERSION}"
"/p:VcpkgManifestInstall=false"
"/p:VcpkgManifestEnabled=false"
"/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 arg_OPTIONS "/p:WholeProgramOptimization=false")
endif()
if(arg_USE_VCPKG_INTEGRATION)
list(
APPEND arg_OPTIONS
"/p:ForceImportBeforeCppTargets=${SCRIPTS}/buildsystems/msbuild/vcpkg.targets"
"/p:VcpkgTriplet=${TARGET_TRIPLET}"
"/p:VcpkgInstalledDir=${_VCPKG_INSTALLED_DIR}"
)
else()
list(APPEND arg_OPTIONS "/p:VcpkgEnabled=false")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
message(STATUS "Building ${arg_PROJECT_PATH} for Release")
file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
vcpkg_execute_required_process(
COMMAND msbuild "${arg_PROJECT_PATH}"
"/p:Configuration=${arg_RELEASE_CONFIGURATION}"
${arg_OPTIONS}
${arg_OPTIONS_RELEASE}
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
LOGNAME "build-${TARGET_TRIPLET}-rel"
)
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
message(STATUS "Building ${arg_PROJECT_PATH} for Debug")
file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
vcpkg_execute_required_process(
COMMAND msbuild "${arg_PROJECT_PATH}"
"/p:Configuration=${arg_DEBUG_CONFIGURATION}"
${arg_OPTIONS}
${arg_OPTIONS_DEBUG}
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg"
LOGNAME "build-${TARGET_TRIPLET}-dbg"
)
endif()
endfunction()

View File

@@ -1,30 +0,0 @@
function(z_vcpkg_build_ninja_build config targets)
message(STATUS "Building (${config})...")
vcpkg_execute_build_process(
COMMAND "${NINJA}" -C "${CURRENT_BUILDTREES_DIR}/${config}" ${targets}
WORKING_DIRECTORY "${SOURCE_PATH}"
LOGNAME "build-${config}"
)
endfunction()
function(vcpkg_build_ninja)
cmake_parse_arguments(PARSE_ARGV 0 arg "" "" "TARGETS")
if(DEFINED arg_UNPARSED_ARGUMENTS)
message(WARNING "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
endif()
if(NOT DEFINED arg_TARGETS)
set(arg_TARGETS "")
endif()
vcpkg_find_acquire_program(NINJA)
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
z_vcpkg_build_ninja_build("${TARGET_TRIPLET}-dbg" "${arg_TARGETS}")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
z_vcpkg_build_ninja_build("${TARGET_TRIPLET}-rel" "${arg_TARGETS}")
endif()
endfunction()

View File

@@ -1,127 +0,0 @@
function(vcpkg_build_nmake)
cmake_parse_arguments(PARSE_ARGV 0 arg
"ADD_BIN_TO_PATH;ENABLE_INSTALL;NO_DEBUG"
"SOURCE_PATH;PROJECT_SUBPATH;PROJECT_NAME;LOGFILE_ROOT"
"OPTIONS;OPTIONS_RELEASE;OPTIONS_DEBUG;PRERUN_SHELL;PRERUN_SHELL_DEBUG;PRERUN_SHELL_RELEASE;TARGET"
)
if(DEFINED arg_UNPARSED_ARGUMENTS)
message(WARNING "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
endif()
if(NOT DEFINED arg_SOURCE_PATH)
message(FATAL_ERROR "SOURCE_PATH must be specified")
endif()
if(arg_NO_DEBUG)
message(WARNING "NO_DEBUG argument to ${CMAKE_CURRENT_FUNCTION} is deprecated")
endif()
if(arg_ADD_BIN_TO_PATH)
message(WARNING "ADD_BIN_TO_PATH argument to ${CMAKE_CURRENT_FUNCTION} is deprecated - it never did anything")
endif()
if(NOT VCPKG_HOST_IS_WINDOWS)
message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} only support windows.")
endif()
if(NOT DEFINED arg_LOGFILE_ROOT)
set(arg_LOGFILE_ROOT "build")
endif()
if(NOT DEFINED arg_PROJECT_NAME)
set(arg_PROJECT_NAME makefile.vc)
endif()
if(NOT DEFINED arg_TARGET)
vcpkg_list(SET arg_TARGET all)
endif()
find_program(NMAKE nmake REQUIRED)
get_filename_component(NMAKE_EXE_PATH ${NMAKE} DIRECTORY)
# Load toolchains
if(NOT VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/windows.cmake")
endif()
include("${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}")
# Set needed env
set(ENV{PATH} "$ENV{PATH};${NMAKE_EXE_PATH}")
set(ENV{INCLUDE} "${CURRENT_INSTALLED_DIR}/include;$ENV{INCLUDE}")
# Set make command and install command
vcpkg_list(SET make_command ${NMAKE} /NOLOGO /G /U)
vcpkg_list(SET make_opts_base -f "${arg_PROJECT_NAME}" ${arg_TARGET})
if(arg_ENABLE_INSTALL)
vcpkg_list(APPEND make_opts_base install)
endif()
# Add subpath to work directory
if(DEFINED arg_PROJECT_SUBPATH)
set(project_subpath "/${arg_PROJECT_SUBPATH}")
else()
set(project_subpath "")
endif()
vcpkg_backup_env_variables(VARS CL)
cmake_path(NATIVE_PATH CURRENT_PACKAGES_DIR NORMALIZE install_dir_native)
foreach(build_type IN ITEMS debug release)
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL build_type)
if(build_type STREQUAL "debug")
# Generate obj dir suffix
set(short_build_type "-dbg")
# Add install command and arguments
set(make_opts "${make_opts_base}")
if (arg_ENABLE_INSTALL)
vcpkg_list(APPEND make_opts "INSTALLDIR=${install_dir_native}\\debug")
endif()
vcpkg_list(APPEND make_opts ${arg_OPTIONS} ${arg_OPTIONS_DEBUG})
set(ENV{CL} "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}")
set(prerun_variable_name arg_PRERUN_SHELL_DEBUG)
else()
set(short_build_type "-rel")
# Add install command and arguments
set(make_opts "${make_opts_base}")
if (arg_ENABLE_INSTALL)
vcpkg_list(APPEND make_opts "INSTALLDIR=${install_dir_native}")
endif()
vcpkg_list(APPEND make_opts ${arg_OPTIONS} ${arg_OPTIONS_RELEASE})
set(ENV{CL} "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}")
set(prerun_variable_name arg_PRERUN_SHELL_RELEASE)
endif()
set(triplet_and_build_type "${TARGET_TRIPLET}${short_build_type}")
set(object_dir "${CURRENT_BUILDTREES_DIR}/${triplet_and_build_type}")
file(REMOVE_RECURSE "${object_dir}")
file(COPY "${arg_SOURCE_PATH}/" DESTINATION "${object_dir}")
if(DEFINED arg_PRERUN_SHELL)
message(STATUS "Prerunning ${triplet_and_build_type}")
vcpkg_execute_required_process(
COMMAND ${arg_PRERUN_SHELL}
WORKING_DIRECTORY "${object_dir}${project_subpath}"
LOGNAME "prerun-${triplet_and_build_type}"
)
endif()
if(DEFINED "${prerun_variable_name}")
message(STATUS "Prerunning ${triplet_and_build_type}")
vcpkg_execute_required_process(
COMMAND ${${prerun_variable_name}}
WORKING_DIRECTORY "${object_dir}${project_subpath}"
LOGNAME "prerun-specific-${triplet_and_build_type}"
)
endif()
if (NOT arg_ENABLE_INSTALL)
message(STATUS "Building ${triplet_and_build_type}")
else()
message(STATUS "Building and installing ${triplet_and_build_type}")
endif()
vcpkg_execute_build_process(
COMMAND ${make_command} ${make_opts}
WORKING_DIRECTORY "${object_dir}${project_subpath}"
LOGNAME "${arg_LOGFILE_ROOT}-${triplet_and_build_type}"
)
vcpkg_restore_env_variables(VARS CL)
endif()
endforeach()
endfunction()

View File

@@ -1,81 +0,0 @@
function(z_run_jom_build invoke_command targets log_prefix log_suffix)
message(STATUS "Package ${log_prefix}-${TARGET_TRIPLET}-${log_suffix}")
vcpkg_execute_build_process(
COMMAND "${invoke_command}" -j ${VCPKG_CONCURRENCY} ${targets}
NO_PARALLEL_COMMAND "${invoke_command}" -j 1 ${targets}
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${log_suffix}"
LOGNAME "package-${log_prefix}-${TARGET_TRIPLET}-${log_suffix}"
)
endfunction()
function(vcpkg_build_qmake)
# parse parameters such that semicolons in options arguments to COMMAND don't get erased
cmake_parse_arguments(PARSE_ARGV 0 arg
"SKIP_MAKEFILES"
"BUILD_LOGNAME"
"TARGETS;RELEASE_TARGETS;DEBUG_TARGETS"
)
# Make sure that the linker finds the libraries used
vcpkg_backup_env_variables(VARS PATH LD_LIBRARY_PATH CL _CL_)
# This fixes issues on machines with default codepages that are not ASCII compatible, such as some CJK encodings
set(ENV{_CL_} "/utf-8")
if(CMAKE_HOST_WIN32)
if (VCPKG_QMAKE_USE_NMAKE)
find_program(NMAKE nmake)
set(invoke_command "${NMAKE}")
get_filename_component(nmake_exe_path "${NMAKE}" DIRECTORY)
vcpkg_host_path_list(APPEND ENV{PATH} "${nmake_exe_path}")
set(ENV{CL} "$ENV{CL} /MP${VCPKG_CONCURRENCY}")
else()
vcpkg_find_acquire_program(JOM)
set(invoke_command "${JOM}")
endif()
else()
find_program(MAKE make)
set(invoke_command "${MAKE}")
endif()
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}" NATIVE_INSTALLED_DIR)
if(NOT DEFINED arg_BUILD_LOGNAME)
set(arg_BUILD_LOGNAME build)
endif()
set(short_name_debug "dbg")
set(path_suffix_debug "/debug")
set(targets_debug "${arg_DEBUG_TARGETS}")
set(short_name_release "rel")
set(path_suffix_release "")
set(targets_release "${arg_RELEASE_TARGETS}")
if(NOT DEFINED VCPKG_BUILD_TYPE)
set(items debug release)
else()
set(items release)
endif()
foreach(build_type IN ITEMS ${items})
set(current_installed_prefix "${CURRENT_INSTALLED_DIR}${path_suffix_${build_type}}")
vcpkg_add_to_path(PREPEND "${current_installed_prefix}/lib" "${current_installed_prefix}/bin")
# We set LD_LIBRARY_PATH ENV variable to allow executing Qt tools (rcc,...) even with dynamic linking
if(CMAKE_HOST_UNIX)
set(ENV{LD_LIBRARY_PATH} "")
vcpkg_host_path_list(APPEND ENV{LD_LIBRARY_PATH} "${current_installed_prefix}/lib" "${current_installed_prefix}/lib/manual-link")
endif()
vcpkg_list(SET targets ${targets_${build_type}} ${arg_TARGETS})
if(NOT arg_SKIP_MAKEFILES)
z_run_jom_build("${invoke_command}" qmake_all makefiles "${short_name_${build_type}}")
endif()
z_run_jom_build("${invoke_command}" "${targets}" "${arg_BUILD_LOGNAME}" "${short_name_${build_type}}")
vcpkg_restore_env_variables(VARS PATH LD_LIBRARY_PATH)
endforeach()
vcpkg_restore_env_variables(VARS CL _CL_)
endfunction()

View File

@@ -1,8 +0,0 @@
function(vcpkg_buildpath_length_warning warning_length)
string(LENGTH "${CURRENT_BUILDTREES_DIR}" buildtrees_path_length)
if(buildtrees_path_length GREATER warning_length AND CMAKE_HOST_WIN32)
message(WARNING "${PORT}'s buildsystem uses very long paths and may fail on your system.\n"
"We recommend moving vcpkg to a short path such as 'C:\\src\\vcpkg' or using the subst command."
)
endif()
endfunction()

View File

@@ -1,95 +0,0 @@
function(z_vcpkg_check_features_last_feature out_var features_name features_list)
list(LENGTH features_list features_length)
math(EXPR features_length_mod_2 "${features_length} % 2")
if(NOT features_length_mod_2 EQUAL 0)
message(FATAL_ERROR "vcpkg_check_features has an incorrect number of arguments to ${features_name}")
endif()
math(EXPR last_feature "${features_length} / 2 - 1")
set("${out_var}" "${last_feature}" PARENT_SCOPE)
endfunction()
function(z_vcpkg_check_features_get_feature idx features_list out_feature_name out_feature_var)
math(EXPR feature_name_idx "${idx} * 2")
math(EXPR feature_var_idx "${feature_name_idx} + 1")
list(GET features_list "${feature_name_idx}" feature_name)
list(GET features_list "${feature_var_idx}" feature_var)
set("${out_feature_name}" "${feature_name}" PARENT_SCOPE)
set("${out_feature_var}" "${feature_var}" PARENT_SCOPE)
endfunction()
function(vcpkg_check_features)
cmake_parse_arguments(
PARSE_ARGV 0 "arg"
""
"OUT_FEATURE_OPTIONS;PREFIX"
"FEATURES;INVERTED_FEATURES"
)
if(NOT DEFINED arg_OUT_FEATURE_OPTIONS)
message(FATAL_ERROR "OUT_FEATURE_OPTIONS must be defined.")
endif()
if(NOT DEFINED arg_PREFIX)
set(prefix "")
else()
set(prefix "${arg_PREFIX}_")
endif()
set(feature_options)
set(feature_variables)
if(NOT DEFINED arg_FEATURES AND NOT DEFINED arg_INVERTED_FEATURES)
message(DEPRECATION
"calling `vcpkg_check_features` without the `FEATURES` keyword has been deprecated.
Please add the `FEATURES` keyword to the call.")
set(arg_FEATURES "${arg_UNPARSED_ARGUMENTS}")
elseif(DEFINED arg_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "vcpkg_check_features called with unknown arguments: ${arg_UNPARSED_ARGUMENTS}")
endif()
z_vcpkg_check_features_last_feature(last_feature "FEATURES" "${arg_FEATURES}")
if(last_feature GREATER_EQUAL 0)
foreach(feature_pair_idx RANGE "${last_feature}")
z_vcpkg_check_features_get_feature("${feature_pair_idx}" "${arg_FEATURES}" feature_name feature_var)
list(APPEND feature_variables "${feature_var}")
if(feature_name IN_LIST FEATURES)
list(APPEND feature_options "-D${feature_var}=ON")
set("${prefix}${feature_var}" ON PARENT_SCOPE)
else()
list(APPEND feature_options "-D${feature_var}=OFF")
set("${prefix}${feature_var}" OFF PARENT_SCOPE)
endif()
endforeach()
endif()
z_vcpkg_check_features_last_feature(last_inverted_feature "INVERTED_FEATURES" "${arg_INVERTED_FEATURES}")
if(last_inverted_feature GREATER_EQUAL 0)
foreach(feature_pair_idx RANGE "${last_inverted_feature}")
z_vcpkg_check_features_get_feature("${feature_pair_idx}" "${arg_INVERTED_FEATURES}" feature_name feature_var)
list(APPEND feature_variables "${feature_var}")
if(feature_name IN_LIST FEATURES)
list(APPEND feature_options "-D${feature_var}=OFF")
set("${prefix}${feature_var}" OFF PARENT_SCOPE)
else()
list(APPEND feature_options "-D${feature_var}=ON")
set("${prefix}${feature_var}" ON PARENT_SCOPE)
endif()
endforeach()
endif()
list(SORT feature_variables)
set(last_variable)
foreach(variable IN LISTS feature_variables)
if(variable STREQUAL last_variable)
message(FATAL_ERROR "vcpkg_check_features passed the same feature variable multiple times: '${variable}'")
endif()
endforeach()
set("${arg_OUT_FEATURE_OPTIONS}" "${feature_options}" PARENT_SCOPE)
endfunction()

View File

@@ -1,36 +0,0 @@
function(vcpkg_check_linkage)
cmake_parse_arguments(PARSE_ARGV 0 arg
"ONLY_STATIC_LIBRARY;ONLY_DYNAMIC_LIBRARY;ONLY_DYNAMIC_CRT;ONLY_STATIC_CRT"
""
""
)
if(DEFINED arg_UNPARSED_ARGUMENTS)
message(WARNING "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
endif()
if(arg_ONLY_STATIC_LIBRARY AND arg_ONLY_DYNAMIC_LIBRARY)
message(FATAL_ERROR "Requesting both ONLY_STATIC_LIBRARY and ONLY_DYNAMIC_LIBRARY; this is an error.")
endif()
if(arg_ONLY_STATIC_CRT AND arg_ONLY_DYNAMIC_CRT)
message(FATAL_ERROR "Requesting both ONLY_STATIC_CRT and ONLY_DYNAMIC_CRT; this is an error.")
endif()
if(arg_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)
elseif(arg_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(arg_ONLY_DYNAMIC_CRT AND "${VCPKG_CRT_LINKAGE}" STREQUAL "static")
message(FATAL_ERROR "${PORT} only supports dynamic crt linkage")
elseif(arg_ONLY_STATIC_CRT AND "${VCPKG_CRT_LINKAGE}" STREQUAL "dynamic")
message(FATAL_ERROR "${PORT} only supports static crt linkage")
endif()
endfunction()

View File

@@ -1,40 +0,0 @@
function(z_vcpkg_clean_executables_in_bin_remove_directory_if_empty directory)
if(NOT EXISTS "${directory}")
return()
endif()
if(NOT IS_DIRECTORY "${directory}")
message(FATAL_ERROR "${directory} must be a directory")
endif()
file(GLOB items "${directory}/*")
if("${items}" STREQUAL "")
file(REMOVE_RECURSE "${directory}")
endif()
endfunction()
function(vcpkg_clean_executables_in_bin)
cmake_parse_arguments(PARSE_ARGV 0 arg "" "" "FILE_NAMES")
if(NOT DEFINED arg_FILE_NAMES)
message(FATAL_ERROR "FILE_NAMES must be specified.")
endif()
if(DEFINED arg_UNPARSED_ARGUMENTS)
message(WARNING "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
endif()
foreach(file_name IN LISTS arg_FILE_NAMES)
file(REMOVE
"${CURRENT_PACKAGES_DIR}/bin/${file_name}${VCPKG_TARGET_EXECUTABLE_SUFFIX}"
"${CURRENT_PACKAGES_DIR}/debug/bin/${file_name}${VCPKG_TARGET_EXECUTABLE_SUFFIX}"
"${CURRENT_PACKAGES_DIR}/bin/${file_name}.pdb"
"${CURRENT_PACKAGES_DIR}/debug/bin/${file_name}.pdb"
)
endforeach()
z_vcpkg_clean_executables_in_bin_remove_directory_if_empty("${CURRENT_PACKAGES_DIR}/bin")
z_vcpkg_clean_executables_in_bin_remove_directory_if_empty("${CURRENT_PACKAGES_DIR}/debug/bin")
endfunction()

View File

@@ -1,9 +0,0 @@
function(vcpkg_clean_msbuild)
if(NOT ARGC EQUAL 0)
message(WARNING "vcpkg_clean_msbuild was passed extra arguments: ${ARGV}")
endif()
file(REMOVE_RECURSE
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg"
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
)
endfunction()

View File

@@ -1,189 +0,0 @@
string(COMPARE NOTEQUAL "${TARGET_TRIPLET}" "${HOST_TRIPLET}" VCPKG_CROSSCOMPILING)
#Helper variable to identify the Target system. VCPKG_TARGET_IS_<targetname>
if (NOT DEFINED VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "")
set(VCPKG_TARGET_IS_WINDOWS ON)
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
set(VCPKG_TARGET_IS_WINDOWS ON)
set(VCPKG_TARGET_IS_UWP ON)
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(VCPKG_TARGET_IS_OSX ON)
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "iOS")
set(VCPKG_TARGET_IS_IOS ON)
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(VCPKG_TARGET_IS_LINUX ON)
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Android")
set(VCPKG_TARGET_IS_ANDROID ON)
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
set(VCPKG_TARGET_IS_FREEBSD ON)
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
set(VCPKG_TARGET_IS_OPENBSD ON)
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "MinGW")
set(VCPKG_TARGET_IS_WINDOWS ON)
set(VCPKG_TARGET_IS_MINGW ON)
endif()
#Helper variables to identify the host system name
if (CMAKE_HOST_WIN32)
set(VCPKG_HOST_IS_WINDOWS ON)
elseif (CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
set(VCPKG_HOST_IS_OSX ON)
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
set(VCPKG_HOST_IS_LINUX ON)
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "FreeBSD")
set(VCPKG_HOST_IS_FREEBSD ON)
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "OpenBSD")
set(VCPKG_HOST_IS_OPENBSD ON)
endif()
#Helper variable to identify the host path separator.
if(CMAKE_HOST_WIN32)
set(VCPKG_HOST_PATH_SEPARATOR ";")
elseif(CMAKE_HOST_UNIX)
set(VCPKG_HOST_PATH_SEPARATOR ":")
endif()
#Helper variables to identify executables on host/target
if(CMAKE_HOST_WIN32)
set(VCPKG_HOST_EXECUTABLE_SUFFIX ".exe")
else()
set(VCPKG_HOST_EXECUTABLE_SUFFIX "")
endif()
#set(CMAKE_EXECUTABLE_SUFFIX ${VCPKG_HOST_EXECUTABLE_SUFFIX}) not required by find_program
if(VCPKG_TARGET_IS_WINDOWS)
set(VCPKG_TARGET_EXECUTABLE_SUFFIX ".exe")
else()
set(VCPKG_TARGET_EXECUTABLE_SUFFIX "")
endif()
#Helper variables to identify bundles on host/target
if(VCPKG_HOST_IS_OSX)
set(VCPKG_HOST_BUNDLE_SUFFIX ".app")
else()
set(VCPKG_HOST_BUNDLE_SUFFIX "")
endif()
if(VCPKG_TARGET_IS_OSX)
set(VCPKG_TARGET_BUNDLE_SUFFIX ".app")
else()
set(VCPKG_TARGET_BUNDLE_SUFFIX "")
endif()
#Helper variables for libraries
if(VCPKG_TARGET_IS_MINGW)
set(VCPKG_TARGET_STATIC_LIBRARY_SUFFIX ".a")
set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX ".dll.a")
set(VCPKG_TARGET_SHARED_LIBRARY_SUFFIX ".dll")
set(VCPKG_TARGET_STATIC_LIBRARY_PREFIX "lib")
set(VCPKG_TARGET_SHARED_LIBRARY_PREFIX "lib")
set(VCPKG_TARGET_IMPORT_LIBRARY_PREFIX "lib")
set(VCPKG_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a" ".lib")
set(VCPKG_FIND_LIBRARY_PREFIXES "lib" "")
elseif(VCPKG_TARGET_IS_WINDOWS)
set(VCPKG_TARGET_STATIC_LIBRARY_SUFFIX ".lib")
set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX ".lib")
set(VCPKG_TARGET_SHARED_LIBRARY_SUFFIX ".dll")
set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX ".lib")
set(VCPKG_TARGET_STATIC_LIBRARY_PREFIX "")
set(VCPKG_TARGET_SHARED_LIBRARY_PREFIX "")
set(VCPKG_TARGET_IMPORT_LIBRARY_PREFIX "")
set(VCPKG_FIND_LIBRARY_SUFFIXES ".lib" ".dll") #This is a slight modification to CMakes value which does not include ".dll".
set(VCPKG_FIND_LIBRARY_PREFIXES "" "lib") #This is a slight modification to CMakes value which does not include "lib".
elseif(VCPKG_TARGET_IS_OSX)
set(VCPKG_TARGET_STATIC_LIBRARY_SUFFIX ".a")
set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX "")
set(VCPKG_TARGET_SHARED_LIBRARY_SUFFIX ".dylib")
set(VCPKG_TARGET_STATIC_LIBRARY_PREFIX "lib")
set(VCPKG_TARGET_SHARED_LIBRARY_PREFIX "lib")
set(VCPKG_FIND_LIBRARY_SUFFIXES ".tbd" ".dylib" ".so" ".a")
set(VCPKG_FIND_LIBRARY_PREFIXES "lib" "")
else()
set(VCPKG_TARGET_STATIC_LIBRARY_SUFFIX ".a")
set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX "")
set(VCPKG_TARGET_SHARED_LIBRARY_SUFFIX ".so")
set(VCPKG_TARGET_STATIC_LIBRARY_PREFIX "lib")
set(VCPKG_TARGET_SHARED_LIBRARY_PREFIX "lib")
set(VCPKG_FIND_LIBRARY_SUFFIXES ".so" ".a")
set(VCPKG_FIND_LIBRARY_PREFIXES "lib" "")
endif()
#Setting these variables allows find_library to work in script mode and thus in portfiles!
#This allows us scale down on hardcoded target dependent paths in portfiles
set(CMAKE_STATIC_LIBRARY_SUFFIX "${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}")
set(CMAKE_SHARED_LIBRARY_SUFFIX "${VCPKG_TARGET_SHARED_LIBRARY_SUFFIX}")
set(CMAKE_IMPORT_LIBRARY_SUFFIX "${VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX}")
set(CMAKE_STATIC_LIBRARY_PREFIX "${VCPKG_TARGET_STATIC_LIBRARY_PREFIX}")
set(CMAKE_SHARED_LIBRARY_PREFIX "${VCPKG_TARGET_SHARED_LIBRARY_PREFIX}")
set(CMAKE_IMPORT_LIBRARY_PREFIX "${VCPKG_TARGET_IMPORT_LIBRARY_PREFIX}")
set(CMAKE_FIND_LIBRARY_SUFFIXES "${VCPKG_FIND_LIBRARY_SUFFIXES}" CACHE INTERNAL "") # Required by find_library
set(CMAKE_FIND_LIBRARY_PREFIXES "${VCPKG_FIND_LIBRARY_PREFIXES}" CACHE INTERNAL "") # Required by find_library
# Append platform libraries to VCPKG_SYSTEM_LIBRARIES
# The variable are just appended to permit to custom triplets define the variable
# Platforms with libdl
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_OSX)
list(APPEND VCPKG_SYSTEM_LIBRARIES dl)
endif()
# Platforms with libm
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_FREEBSD OR VCPKG_TARGET_IS_OPENBSD OR VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_MINGW)
list(APPEND VCPKG_SYSTEM_LIBRARIES m)
endif()
# Platforms with pthread
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_FREEBSD OR VCPKG_TARGET_IS_OPENBSD OR VCPKG_TARGET_IS_MINGW)
list(APPEND VCPKG_SYSTEM_LIBRARIES pthread)
endif()
# Platforms with libstdc++
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_FREEBSD OR VCPKG_TARGET_IS_OPENBSD OR VCPKG_TARGET_IS_MINGW)
list(APPEND VCPKG_SYSTEM_LIBRARIES [[stdc\+\+]])
endif()
# Platforms with libc++
if(VCPKG_TARGET_IS_OSX)
list(APPEND VCPKG_SYSTEM_LIBRARIES [[c\+\+]])
endif()
# Platforms with librt
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_FREEBSD OR VCPKG_TARGET_IS_MINGW)
list(APPEND VCPKG_SYSTEM_LIBRARIES rt)
endif()
# Platforms with GCC libs
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_FREEBSD OR VCPKG_TARGET_IS_OPENBSD OR VCPKG_TARGET_IS_MINGW)
list(APPEND VCPKG_SYSTEM_LIBRARIES gcc)
list(APPEND VCPKG_SYSTEM_LIBRARIES gcc_s)
endif()
# Platforms with system iconv
if(VCPKG_TARGET_IS_OSX)
list(APPEND VCPKG_SYSTEM_LIBRARIES iconv)
endif()
# Windows system libs
if(VCPKG_TARGET_IS_WINDOWS)
list(APPEND VCPKG_SYSTEM_LIBRARIES advapi32)
list(APPEND VCPKG_SYSTEM_LIBRARIES bcrypt)
list(APPEND VCPKG_SYSTEM_LIBRARIES dinput8)
list(APPEND VCPKG_SYSTEM_LIBRARIES gdi32)
list(APPEND VCPKG_SYSTEM_LIBRARIES imm32)
list(APPEND VCPKG_SYSTEM_LIBRARIES oleaut32)
list(APPEND VCPKG_SYSTEM_LIBRARIES ole32)
list(APPEND VCPKG_SYSTEM_LIBRARIES psapi)
list(APPEND VCPKG_SYSTEM_LIBRARIES secur32)
list(APPEND VCPKG_SYSTEM_LIBRARIES setupapi)
list(APPEND VCPKG_SYSTEM_LIBRARIES shell32)
list(APPEND VCPKG_SYSTEM_LIBRARIES shlwapi)
list(APPEND VCPKG_SYSTEM_LIBRARIES strmiids)
list(APPEND VCPKG_SYSTEM_LIBRARIES user32)
list(APPEND VCPKG_SYSTEM_LIBRARIES uuid)
list(APPEND VCPKG_SYSTEM_LIBRARIES version)
list(APPEND VCPKG_SYSTEM_LIBRARIES vfw32)
list(APPEND VCPKG_SYSTEM_LIBRARIES winmm)
list(APPEND VCPKG_SYSTEM_LIBRARIES wsock32)
list(APPEND VCPKG_SYSTEM_LIBRARIES Ws2_32)
list(APPEND VCPKG_SYSTEM_LIBRARIES wldap32)
list(APPEND VCPKG_SYSTEM_LIBRARIES crypt32)
endif()

View File

@@ -1,3 +0,0 @@
# DEPRECATED
message("${Z_VCPKG_BACKCOMPAT_MESSAGE_LEVEL}" "vcpkg_common_functions has been removed and all values are automatically provided in all portfile.cmake invocations. Please remove `include(vcpkg_common_functions)`.")

View File

@@ -1,373 +0,0 @@
function(z_vcpkg_configure_cmake_both_or_neither_set var1 var2)
if(DEFINED "${var1}" AND NOT DEFINED "${var2}")
message(FATAL_ERROR "If ${var1} is set, ${var2} must be set.")
endif()
if(NOT DEFINED "${var1}" AND DEFINED "${var2}")
message(FATAL_ERROR "If ${var2} is set, ${var1} must be set.")
endif()
endfunction()
function(z_vcpkg_configure_cmake_build_cmakecache out_var whereat build_type)
set(line "build ${whereat}/CMakeCache.txt: CreateProcess\n process = cmd /c \"cd ${whereat} &&")
foreach(arg IN LISTS "${build_type}_command")
string(APPEND line " \"${arg}\"")
endforeach()
set("${out_var}" "${${out_var}}${line}\"\n\n" PARENT_SCOPE)
endfunction()
function(z_vcpkg_get_visual_studio_generator)
cmake_parse_arguments(PARSE_ARGV 0 arg "" "OUT_GENERATOR;OUT_ARCH" "")
if (NOT DEFINED arg_OUT_GENERATOR)
message(FATAL_ERROR "OUT_GENERATOR must be defined.")
endif()
if(NOT DEFINED arg_OUT_ARCH)
message(FATAL_ERROR "OUT_ARCH must be defined.")
endif()
if(DEFINED arg_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
endif()
if("${VCPKG_PLATFORM_TOOLSET}" STREQUAL "v120" AND NOT "${VCPKG_TARGET_ARCHITECTURE}" STREQUAL "arm64")
set(generator "Visual Studio 12 2013")
elseif("${VCPKG_PLATFORM_TOOLSET}" STREQUAL "v140" AND NOT "${VCPKG_TARGET_ARCHITECTURE}" STREQUAL "arm64")
set(generator "Visual Studio 14 2015")
elseif("${VCPKG_PLATFORM_TOOLSET}" STREQUAL "v141")
set(generator "Visual Studio 15 2017")
elseif("${VCPKG_PLATFORM_TOOLSET}" STREQUAL "v142")
set(generator "Visual Studio 16 2019")
elseif("${VCPKG_PLATFORM_TOOLSET}" STREQUAL "v143")
set(generator "Visual Studio 17 2022")
endif()
if("${VCPKG_TARGET_ARCHITECTURE}" STREQUAL "x86")
set(generator_arch "Win32")
elseif("${VCPKG_TARGET_ARCHITECTURE}" STREQUAL "x64")
set(generator_arch "x64")
elseif("${VCPKG_TARGET_ARCHITECTURE}" STREQUAL "arm")
set(generator_arch "ARM")
elseif("${VCPKG_TARGET_ARCHITECTURE}" STREQUAL "arm64")
set(generator_arch "ARM64")
endif()
set(${arg_OUT_GENERATOR} "${generator}" PARENT_SCOPE)
set(${arg_OUT_ARCH} "${generator_arch}" PARENT_SCOPE)
endfunction()
function(z_vcpkg_select_default_vcpkg_chainload_toolchain)
# Try avoiding adding more defaults here.
# Set VCPKG_CHAINLOAD_TOOLCHAIN_FILE explicitly in the triplet.
if(DEFINED Z_VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${Z_VCPKG_CHAINLOAD_TOOLCHAIN_FILE}")
elseif(VCPKG_TARGET_IS_MINGW)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/mingw.cmake")
elseif(VCPKG_TARGET_IS_WINDOWS)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/windows.cmake")
elseif(VCPKG_TARGET_IS_LINUX)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/linux.cmake")
elseif(VCPKG_TARGET_IS_ANDROID)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/android.cmake")
elseif(VCPKG_TARGET_IS_OSX)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/osx.cmake")
elseif(VCPKG_TARGET_IS_IOS)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/ios.cmake")
elseif(VCPKG_TARGET_IS_FREEBSD)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/freebsd.cmake")
elseif(VCPKG_TARGET_IS_OPENBSD)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/openbsd.cmake")
endif()
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE ${VCPKG_CHAINLOAD_TOOLCHAIN_FILE} PARENT_SCOPE)
endfunction()
function(vcpkg_configure_cmake)
cmake_parse_arguments(PARSE_ARGV 0 arg
"PREFER_NINJA;DISABLE_PARALLEL_CONFIGURE;NO_CHARSET_FLAG;Z_GET_CMAKE_VARS_USAGE"
"SOURCE_PATH;GENERATOR;LOGNAME"
"OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE;MAYBE_UNUSED_VARIABLES"
)
if(NOT arg_Z_GET_CMAKE_VARS_USAGE AND Z_VCPKG_CMAKE_CONFIGURE_GUARD)
message(FATAL_ERROR "The ${PORT} port already depends on vcpkg-cmake; using both vcpkg-cmake and vcpkg_configure_cmake in the same port is unsupported.")
endif()
if(DEFINED arg_UNPARSED_ARGUMENTS)
message(WARNING "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
endif()
if(NOT DEFINED arg_SOURCE_PATH)
message(FATAL_ERROR "SOURCE_PATH must be specified")
endif()
if(NOT DEFINED arg_LOGNAME)
set(arg_LOGNAME "config-${TARGET_TRIPLET}")
endif()
vcpkg_list(SET manually_specified_variables)
if(arg_Z_GET_CMAKE_VARS_USAGE)
set(configuring_message "Getting CMake variables for ${TARGET_TRIPLET}")
else()
set(configuring_message "Configuring ${TARGET_TRIPLET}")
foreach(option IN LISTS arg_OPTIONS arg_OPTIONS_RELEASE arg_OPTIONS_DEBUG)
if("${option}" MATCHES "^-D([^:=]*)[:=]")
vcpkg_list(APPEND manually_specified_variables "${CMAKE_MATCH_1}")
endif()
endforeach()
vcpkg_list(REMOVE_DUPLICATES manually_specified_variables)
foreach(maybe_unused_var IN LISTS arg_MAYBE_UNUSED_VARIABLES)
vcpkg_list(REMOVE_ITEM manually_specified_variables "${maybe_unused_var}")
endforeach()
debug_message("manually specified variables: ${manually_specified_variables}")
endif()
set(ninja_can_be_used ON) # Ninja as generator
set(ninja_host ON) # Ninja as parallel configurator
if(NOT arg_PREFER_NINJA AND VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
set(ninja_can_be_used OFF)
endif()
if(VCPKG_HOST_IS_WINDOWS)
if(DEFINED ENV{PROCESSOR_ARCHITEW6432})
set(host_arch "$ENV{PROCESSOR_ARCHITEW6432}")
else()
set(host_arch "$ENV{PROCESSOR_ARCHITECTURE}")
endif()
if("${host_arch}" STREQUAL "x86")
# Prebuilt ninja binaries are only provided for x64 hosts
set(ninja_can_be_used OFF)
set(ninja_host OFF)
endif()
endif()
set(generator "Ninja") # the default generator is always ninja!
set(generator_arch "")
if(DEFINED arg_GENERATOR)
set(generator "${arg_GENERATOR}")
elseif(NOT ninja_can_be_used)
set(generator "")
z_vcpkg_get_visual_studio_generator(OUT_GENERATOR generator OUT_ARCH generator_arch)
if("${generator}" STREQUAL "" OR "${generator_arch}" STREQUAL "")
message(FATAL_ERROR
"Unable to determine appropriate generator for triplet ${TARGET_TRIPLET}:
platform toolset: ${VCPKG_PLATFORM_TOOLSET}
architecture : ${VCPKG_TARGET_ARCHITECTURE}")
endif()
endif()
# If we use Ninja, make sure it's on PATH
if("${generator}" STREQUAL "Ninja" AND NOT DEFINED ENV{VCPKG_FORCE_SYSTEM_BINARIES})
vcpkg_find_acquire_program(NINJA)
get_filename_component(ninja_path "${NINJA}" DIRECTORY)
vcpkg_add_to_path("${ninja_path}")
vcpkg_list(APPEND arg_OPTIONS "-DCMAKE_MAKE_PROGRAM=${NINJA}")
endif()
file(REMOVE_RECURSE
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
if(DEFINED VCPKG_CMAKE_SYSTEM_NAME)
vcpkg_list(APPEND arg_OPTIONS "-DCMAKE_SYSTEM_NAME=${VCPKG_CMAKE_SYSTEM_NAME}")
if(VCPKG_TARGET_IS_UWP AND NOT DEFINED VCPKG_CMAKE_SYSTEM_VERSION)
set(VCPKG_CMAKE_SYSTEM_VERSION 10.0)
elseif(VCPKG_TARGET_IS_ANDROID AND NOT DEFINED VCPKG_CMAKE_SYSTEM_VERSION)
set(VCPKG_CMAKE_SYSTEM_VERSION 21)
endif()
endif()
if(DEFINED VCPKG_CMAKE_SYSTEM_VERSION)
vcpkg_list(APPEND arg_OPTIONS "-DCMAKE_SYSTEM_VERSION=${VCPKG_CMAKE_SYSTEM_VERSION}")
endif()
if("${VCPKG_LIBRARY_LINKAGE}" STREQUAL "dynamic")
vcpkg_list(APPEND arg_OPTIONS -DBUILD_SHARED_LIBS=ON)
elseif("${VCPKG_LIBRARY_LINKAGE}" STREQUAL "static")
vcpkg_list(APPEND arg_OPTIONS -DBUILD_SHARED_LIBS=OFF)
else()
message(FATAL_ERROR
"Invalid setting for VCPKG_LIBRARY_LINKAGE: \"${VCPKG_LIBRARY_LINKAGE}\".
It must be \"static\" or \"dynamic\"")
endif()
z_vcpkg_configure_cmake_both_or_neither_set(VCPKG_CXX_FLAGS_DEBUG VCPKG_C_FLAGS_DEBUG)
z_vcpkg_configure_cmake_both_or_neither_set(VCPKG_CXX_FLAGS_RELEASE VCPKG_C_FLAGS_RELEASE)
z_vcpkg_configure_cmake_both_or_neither_set(VCPKG_CXX_FLAGS VCPKG_C_FLAGS)
set(vcpkg_set_charset_flag ON)
if(arg_NO_CHARSET_FLAG)
set(vcpkg_set_charset_flag OFF)
endif()
if(NOT VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
z_vcpkg_select_default_vcpkg_chainload_toolchain()
endif()
vcpkg_list(APPEND arg_OPTIONS
"-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}"
"-DVCPKG_TARGET_TRIPLET=${TARGET_TRIPLET}"
"-DVCPKG_SET_CHARSET_FLAG=${vcpkg_set_charset_flag}"
"-DVCPKG_PLATFORM_TOOLSET=${VCPKG_PLATFORM_TOOLSET}"
"-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON"
"-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON"
"-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON"
"-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE"
"-DCMAKE_VERBOSE_MAKEFILE=ON"
"-DVCPKG_APPLOCAL_DEPS=OFF"
"-DCMAKE_TOOLCHAIN_FILE=${SCRIPTS}/buildsystems/vcpkg.cmake"
"-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON"
"-DVCPKG_CXX_FLAGS=${VCPKG_CXX_FLAGS}"
"-DVCPKG_CXX_FLAGS_RELEASE=${VCPKG_CXX_FLAGS_RELEASE}"
"-DVCPKG_CXX_FLAGS_DEBUG=${VCPKG_CXX_FLAGS_DEBUG}"
"-DVCPKG_C_FLAGS=${VCPKG_C_FLAGS}"
"-DVCPKG_C_FLAGS_RELEASE=${VCPKG_C_FLAGS_RELEASE}"
"-DVCPKG_C_FLAGS_DEBUG=${VCPKG_C_FLAGS_DEBUG}"
"-DVCPKG_CRT_LINKAGE=${VCPKG_CRT_LINKAGE}"
"-DVCPKG_LINKER_FLAGS=${VCPKG_LINKER_FLAGS}"
"-DVCPKG_LINKER_FLAGS_RELEASE=${VCPKG_LINKER_FLAGS_RELEASE}"
"-DVCPKG_LINKER_FLAGS_DEBUG=${VCPKG_LINKER_FLAGS_DEBUG}"
"-DVCPKG_TARGET_ARCHITECTURE=${VCPKG_TARGET_ARCHITECTURE}"
"-DCMAKE_INSTALL_LIBDIR:STRING=lib"
"-DCMAKE_INSTALL_BINDIR:STRING=bin"
"-D_VCPKG_ROOT_DIR=${VCPKG_ROOT_DIR}"
"-DZ_VCPKG_ROOT_DIR=${VCPKG_ROOT_DIR}"
"-D_VCPKG_INSTALLED_DIR=${_VCPKG_INSTALLED_DIR}"
"-DVCPKG_MANIFEST_INSTALL=OFF"
)
if(NOT "${generator_arch}" STREQUAL "")
vcpkg_list(APPEND arg_OPTIONS "-A${generator_arch}")
endif()
# Sets configuration variables for macOS builds
foreach(config_var IN ITEMS INSTALL_NAME_DIR OSX_DEPLOYMENT_TARGET OSX_SYSROOT OSX_ARCHITECTURES)
if(DEFINED "VCPKG_${config_var}")
vcpkg_list(APPEND arg_OPTIONS "-DCMAKE_${config_var}=${VCPKG_${config_var}}")
endif()
endforeach()
# Allow overrides / additional configuration variables from triplets
if(DEFINED VCPKG_CMAKE_CONFIGURE_OPTIONS)
vcpkg_list(APPEND arg_OPTIONS "${VCPKG_CMAKE_CONFIGURE_OPTIONS}")
endif()
if(DEFINED VCPKG_CMAKE_CONFIGURE_OPTIONS_RELEASE)
vcpkg_list(APPEND arg_OPTIONS_RELEASE "${VCPKG_CMAKE_CONFIGURE_OPTIONS_RELEASE}")
endif()
if(DEFINED VCPKG_CMAKE_CONFIGURE_OPTIONS_DEBUG)
vcpkg_list(APPEND arg_OPTIONS_DEBUG "${VCPKG_CMAKE_CONFIGURE_OPTIONS_DEBUG}")
endif()
vcpkg_list(SET rel_command
"${CMAKE_COMMAND}" "${arg_SOURCE_PATH}"
-G "${generator}"
"-DCMAKE_BUILD_TYPE=Release"
"-DCMAKE_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR}"
${arg_OPTIONS} ${arg_OPTIONS_RELEASE})
vcpkg_list(SET dbg_command
"${CMAKE_COMMAND}" "${arg_SOURCE_PATH}"
-G "${generator}"
"-DCMAKE_BUILD_TYPE=Debug"
"-DCMAKE_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR}/debug"
${arg_OPTIONS} ${arg_OPTIONS_DEBUG})
if(ninja_host AND CMAKE_HOST_WIN32 AND NOT arg_DISABLE_PARALLEL_CONFIGURE)
vcpkg_list(APPEND arg_OPTIONS "-DCMAKE_DISABLE_SOURCE_CHANGES=ON")
vcpkg_find_acquire_program(NINJA)
if(NOT DEFINED ninja_path)
# if ninja_path was defined above, we've already done this
get_filename_component(ninja_path "${NINJA}" DIRECTORY)
vcpkg_add_to_path("${ninja_path}")
endif()
#parallelize the configure step
set(ninja_configure_contents
"rule CreateProcess\n command = \$process\n\n"
)
if(NOT DEFINED VCPKG_BUILD_TYPE OR "${VCPKG_BUILD_TYPE}" STREQUAL "release")
z_vcpkg_configure_cmake_build_cmakecache(ninja_configure_contents ".." "rel")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR "${VCPKG_BUILD_TYPE}" STREQUAL "debug")
z_vcpkg_configure_cmake_build_cmakecache(ninja_configure_contents "../../${TARGET_TRIPLET}-dbg" "dbg")
endif()
file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vcpkg-parallel-configure")
file(WRITE
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vcpkg-parallel-configure/build.ninja"
"${ninja_configure_contents}")
message(STATUS "${configuring_message}")
vcpkg_execute_required_process(
COMMAND "${NINJA}" -v
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vcpkg-parallel-configure"
LOGNAME "${arg_LOGNAME}"
)
vcpkg_list(APPEND config_logs
"${CURRENT_BUILDTREES_DIR}/${arg_LOGNAME}-out.log"
"${CURRENT_BUILDTREES_DIR}/${arg_LOGNAME}-err.log")
else()
if(NOT DEFINED VCPKG_BUILD_TYPE OR "${VCPKG_BUILD_TYPE}" STREQUAL "debug")
message(STATUS "${configuring_message}-dbg")
file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
vcpkg_execute_required_process(
COMMAND ${dbg_command}
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg"
LOGNAME "${arg_LOGNAME}-dbg"
)
vcpkg_list(APPEND config_logs
"${CURRENT_BUILDTREES_DIR}/${arg_LOGNAME}-dbg-out.log"
"${CURRENT_BUILDTREES_DIR}/${arg_LOGNAME}-dbg-err.log")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR "${VCPKG_BUILD_TYPE}" STREQUAL "release")
message(STATUS "${configuring_message}-rel")
file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
vcpkg_execute_required_process(
COMMAND ${rel_command}
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
LOGNAME "${arg_LOGNAME}-rel"
)
vcpkg_list(APPEND config_logs
"${CURRENT_BUILDTREES_DIR}/${arg_LOGNAME}-rel-out.log"
"${CURRENT_BUILDTREES_DIR}/${arg_LOGNAME}-rel-err.log")
endif()
endif()
# Check unused variables
vcpkg_list(SET all_unused_variables)
foreach(config_log IN LISTS config_logs)
if(NOT EXISTS "${config_log}")
continue()
endif()
file(READ "${config_log}" log_contents)
debug_message("Reading configure log ${config_log}...")
if(NOT "${log_contents}" MATCHES "Manually-specified variables were not used by the project:\n\n(( [^\n]*\n)*)")
continue()
endif()
string(STRIP "${CMAKE_MATCH_1}" unused_variables) # remove leading ` ` and trailing `\n`
string(REPLACE "\n " ";" unused_variables "${unused_variables}")
debug_message("unused variables: ${unused_variables}")
foreach(unused_variable IN LISTS unused_variables)
if("${unused_variable}" IN_LIST manually_specified_variables)
debug_message("manually specified unused variable: ${unused_variable}")
vcpkg_list(APPEND all_unused_variables "${unused_variable}")
else()
debug_message("unused variable (not manually specified): ${unused_variable}")
endif()
endforeach()
endforeach()
if(NOT "${all_unused_variables}" STREQUAL "")
vcpkg_list(REMOVE_DUPLICATES all_unused_variables)
vcpkg_list(JOIN all_unused_variables "\n " all_unused_variables)
message(WARNING "The following variables are not used in CMakeLists.txt:
${all_unused_variables}
Please recheck them and remove the unnecessary options from the `vcpkg_configure_cmake` call.
If these options should still be passed for whatever reason, please use the `MAYBE_UNUSED_VARIABLES` argument.")
endif()
if(NOT arg_Z_GET_CMAKE_VARS_USAGE)
set(Z_VCPKG_CMAKE_GENERATOR "${generator}" PARENT_SCOPE)
endif()
endfunction()

View File

@@ -1,49 +0,0 @@
function(z_vcpkg_configure_gn_generate)
cmake_parse_arguments(PARSE_ARGV 0 "arg" "" "SOURCE_PATH;CONFIG;ARGS" "")
if(DEFINED arg_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "Internal error: generate was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
endif()
message(STATUS "Generating build (${arg_CONFIG})...")
vcpkg_execute_required_process(
COMMAND "${GN}" gen "${CURRENT_BUILDTREES_DIR}/${arg_CONFIG}" "${arg_ARGS}"
WORKING_DIRECTORY "${arg_SOURCE_PATH}"
LOGNAME "generate-${arg_CONFIG}"
)
endfunction()
function(vcpkg_configure_gn)
if(Z_VCPKG_GN_CONFIGURE_GUARD)
message(FATAL_ERROR "The ${PORT} port already depends on vcpkg-gn; using both vcpkg-gn and vcpkg_configure_gn in the same port is unsupported.")
endif()
cmake_parse_arguments(PARSE_ARGV 0 "arg" "" "SOURCE_PATH;OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE" "")
if(DEFINED arg_UNPARSED_ARGUMENTS)
message(WARNING "vcpkg_configure_gn was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
endif()
if(NOT DEFINED arg_SOURCE_PATH)
message(FATAL_ERROR "SOURCE_PATH must be specified.")
endif()
vcpkg_find_acquire_program(PYTHON3)
get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY)
vcpkg_add_to_path(PREPEND "${PYTHON3_DIR}")
vcpkg_find_acquire_program(GN)
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
z_vcpkg_configure_gn_generate(
SOURCE_PATH "${arg_SOURCE_PATH}"
CONFIG "${TARGET_TRIPLET}-dbg"
ARGS "--args=${arg_OPTIONS} ${arg_OPTIONS_DEBUG}"
)
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
z_vcpkg_configure_gn_generate(
SOURCE_PATH "${arg_SOURCE_PATH}"
CONFIG "${TARGET_TRIPLET}-rel"
ARGS "--args=${arg_OPTIONS} ${arg_OPTIONS_RELEASE}"
)
endif()
endfunction()

View File

@@ -1,760 +0,0 @@
macro(z_vcpkg_determine_host_mingw out_var)
if(DEFINED ENV{PROCESSOR_ARCHITEW6432})
set(host_arch $ENV{PROCESSOR_ARCHITEW6432})
else()
set(host_arch $ENV{PROCESSOR_ARCHITECTURE})
endif()
if(host_arch MATCHES "(amd|AMD)64")
set(${out_var} mingw64)
elseif(host_arch MATCHES "(x|X)86")
set(${out_var} mingw32)
else()
message(FATAL_ERROR "Unsupported mingw architecture ${host_arch} in z_vcpkg_determine_autotools_host_cpu!" )
endif()
unset(host_arch)
endmacro()
macro(z_vcpkg_determine_autotools_host_cpu out_var)
# TODO: the host system processor architecture can differ from the host triplet target architecture
if(DEFINED ENV{PROCESSOR_ARCHITEW6432})
set(host_arch $ENV{PROCESSOR_ARCHITEW6432})
elseif(DEFINED ENV{PROCESSOR_ARCHITECTURE})
set(host_arch $ENV{PROCESSOR_ARCHITECTURE})
else()
set(host_arch "${VCPKG_DETECTED_CMAKE_HOST_SYSTEM_PROCESSOR}")
endif()
if(host_arch MATCHES "(amd|AMD)64")
set(${out_var} x86_64)
elseif(host_arch MATCHES "(x|X)86")
set(${out_var} i686)
elseif(host_arch MATCHES "^(ARM|arm)64$")
set(${out_var} aarch64)
elseif(host_arch MATCHES "^(ARM|arm)$")
set(${out_var} arm)
else()
message(FATAL_ERROR "Unsupported host architecture ${host_arch} in z_vcpkg_determine_autotools_host_cpu!" )
endif()
unset(host_arch)
endmacro()
macro(z_vcpkg_determine_autotools_target_cpu out_var)
if(VCPKG_TARGET_ARCHITECTURE MATCHES "(x|X)64")
set(${out_var} x86_64)
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "(x|X)86")
set(${out_var} i686)
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "^(ARM|arm)64$")
set(${out_var} aarch64)
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "^(ARM|arm)$")
set(${out_var} arm)
else()
message(FATAL_ERROR "Unsupported VCPKG_TARGET_ARCHITECTURE architecture ${VCPKG_TARGET_ARCHITECTURE} in z_vcpkg_determine_autotools_target_cpu!" )
endif()
endmacro()
macro(z_vcpkg_determine_autotools_host_arch_mac out_var)
set(${out_var} "${VCPKG_DETECTED_CMAKE_HOST_SYSTEM_PROCESSOR}")
endmacro()
macro(z_vcpkg_determine_autotools_target_arch_mac out_var)
list(LENGTH VCPKG_OSX_ARCHITECTURES osx_archs_num)
if(osx_archs_num EQUAL 0)
set(${out_var} "${VCPKG_DETECTED_CMAKE_HOST_SYSTEM_PROCESSOR}")
elseif(osx_archs_num GREATER_EQUAL 2)
set(${out_var} "universal")
else()
# Better match the arch behavior of config.guess
# See: https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
if(VCPKG_OSX_ARCHITECTURES MATCHES "^(ARM|arm)64$")
set(${out_var} "aarch64")
else()
set(${out_var} "${VCPKG_OSX_ARCHITECTURES}")
endif()
endif()
unset(osx_archs_num)
endmacro()
macro(z_vcpkg_extract_cpp_flags_and_set_cflags_and_cxxflags flag_suffix)
string(REGEX MATCHALL "( |^)-D[^ ]+" CPPFLAGS_${flag_suffix} "${VCPKG_DETECTED_CMAKE_C_FLAGS_${flag_suffix}}")
string(REGEX MATCHALL "( |^)-D[^ ]+" CXXPPFLAGS_${flag_suffix} "${VCPKG_DETECTED_CMAKE_CXX_FLAGS_${flag_suffix}}")
list(JOIN CXXPPFLAGS_${flag_suffix} "|" CXXREGEX)
if(CXXREGEX)
list(FILTER CPPFLAGS_${flag_suffix} INCLUDE REGEX "(${CXXREGEX})")
else()
set(CPPFLAGS_${flag_suffix})
endif()
list(JOIN CPPFLAGS_${flag_suffix} "|" CPPREGEX)
list(JOIN CPPFLAGS_${flag_suffix} " " CPPFLAGS_${flag_suffix})
set(CPPFLAGS_${flag_suffix} "${CPPFLAGS_${flag_suffix}}")
if(CPPREGEX)
string(REGEX REPLACE "(${CPPREGEX})" "" CFLAGS_${flag_suffix} "${VCPKG_DETECTED_CMAKE_C_FLAGS_${flag_suffix}}")
string(REGEX REPLACE "(${CPPREGEX})" "" CXXFLAGS_${flag_suffix} "${VCPKG_DETECTED_CMAKE_CXX_FLAGS_${flag_suffix}}")
else()
set(CFLAGS_${flag_suffix} "${VCPKG_DETECTED_CMAKE_C_FLAGS_${flag_suffix}}")
set(CXXFLAGS_${flag_suffix} "${VCPKG_DETECTED_CMAKE_CXX_FLAGS_${flag_suffix}}")
endif()
string(REGEX REPLACE " +" " " CPPFLAGS_${flag_suffix} "${CPPFLAGS_${flag_suffix}}")
string(REGEX REPLACE " +" " " CFLAGS_${flag_suffix} "${CFLAGS_${flag_suffix}}")
string(REGEX REPLACE " +" " " CXXFLAGS_${flag_suffix} "${CXXFLAGS_${flag_suffix}}")
# libtool has and -R option so we need to guard against -RTC by using -Xcompiler
# while configuring there might be a lot of unknown compiler option warnings due to that
# just ignore them.
string(REGEX REPLACE "((-|/)RTC[^ ]+)" "-Xcompiler \\1" CFLAGS_${flag_suffix} "${CFLAGS_${flag_suffix}}")
string(REGEX REPLACE "((-|/)RTC[^ ]+)" "-Xcompiler \\1" CXXFLAGS_${flag_suffix} "${CXXFLAGS_${flag_suffix}}")
string(STRIP "${CPPFLAGS_${flag_suffix}}" CPPFLAGS_${flag_suffix})
string(STRIP "${CFLAGS_${flag_suffix}}" CFLAGS_${flag_suffix})
string(STRIP "${CXXFLAGS_${flag_suffix}}" CXXFLAGS_${flag_suffix})
debug_message("CPPFLAGS_${flag_suffix}: ${CPPFLAGS_${flag_suffix}}")
debug_message("CFLAGS_${flag_suffix}: ${CFLAGS_${flag_suffix}}")
debug_message("CXXFLAGS_${flag_suffix}: ${CXXFLAGS_${flag_suffix}}")
endmacro()
macro(z_vcpkg_append_to_configure_environment inoutstring var defaultval)
# Allows to overwrite settings in custom triplets via the environment on windows
if(CMAKE_HOST_WIN32 AND DEFINED ENV{${var}})
string(APPEND ${inoutstring} " ${var}='$ENV{${var}}'")
else()
string(APPEND ${inoutstring} " ${var}='${defaultval}'")
endif()
endmacro()
macro(z_convert_to_list input output)
string(REGEX MATCHALL "(( +|^ *)[^ ]+)" ${output} "${${input}}")
endmacro()
function(vcpkg_configure_make)
# parse parameters such that semicolons in options arguments to COMMAND don't get erased
cmake_parse_arguments(PARSE_ARGV 0 arg
"AUTOCONFIG;SKIP_CONFIGURE;COPY_SOURCE;DISABLE_VERBOSE_FLAGS;NO_ADDITIONAL_PATHS;ADD_BIN_TO_PATH;NO_DEBUG;USE_WRAPPERS;DETERMINE_BUILD_TRIPLET"
"SOURCE_PATH;PROJECT_SUBPATH;PRERUN_SHELL;BUILD_TRIPLET"
"OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE;CONFIGURE_ENVIRONMENT_VARIABLES;CONFIG_DEPENDENT_ENVIRONMENT;ADDITIONAL_MSYS_PACKAGES"
)
if(DEFINED arg_UNPARSED_ARGUMENTS)
message(WARNING "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
endif()
z_vcpkg_get_cmake_vars(cmake_vars_file)
debug_message("Including cmake vars from: ${cmake_vars_file}")
include("${cmake_vars_file}")
if(DEFINED VCPKG_MAKE_BUILD_TRIPLET)
set(arg_BUILD_TRIPLET ${VCPKG_MAKE_BUILD_TRIPLET}) # Triplet overwrite for crosscompiling
endif()
set(src_dir "${arg_SOURCE_PATH}/${arg_PROJECT_SUBPATH}")
set(requires_autogen OFF) # use autogen.sh
set(requires_autoconfig OFF) # use autotools and configure.ac
if(EXISTS "${src_dir}/configure" AND "${src_dir}/configure.ac") # remove configure; rerun autoconf
if(NOT VCPKG_MAINTAINER_SKIP_AUTOCONFIG) # If fixing bugs skipping autoconfig saves a lot of time
set(requires_autoconfig ON)
file(REMOVE "${SRC_DIR}/configure") # remove possible autodated configure scripts
set(arg_AUTOCONFIG ON)
endif()
elseif(EXISTS "${src_dir}/configure" AND NOT arg_SKIP_CONFIGURE) # run normally; no autoconf or autogen required
elseif(EXISTS "${src_dir}/configure.ac") # Run autoconfig
set(requires_autoconfig ON)
set(arg_AUTOCONFIG ON)
elseif(EXISTS "${src_dir}/autogen.sh") # Run autogen
set(requires_autogen ON)
else()
message(FATAL_ERROR "Could not determine method to configure make")
endif()
debug_message("requires_autogen:${requires_autogen}")
debug_message("requires_autoconfig:${requires_autoconfig}")
if(CMAKE_HOST_WIN32 AND VCPKG_DETECTED_CMAKE_C_COMPILER MATCHES "cl.exe") #only applies to windows (clang-)cl and lib
if(arg_AUTOCONFIG)
set(arg_USE_WRAPPERS ON)
else()
# Keep the setting from portfiles.
# Without autotools we assume a custom configure script which correctly handles cl and lib.
# Otherwise the port needs to set CC|CXX|AR and probably CPP.
endif()
else()
set(arg_USE_WRAPPERS OFF)
endif()
# Backup environment variables
# CCAS CC C CPP CXX FC FF GC LD LF LIBTOOL OBJC OBJCXX R UPC Y
set(cm_FLAGS AS CCAS CC C CPP CXX FC FF GC LD LF LIBTOOL OBJC OBJXX R UPC Y RC)
list(TRANSFORM cm_FLAGS APPEND "FLAGS")
vcpkg_backup_env_variables(VARS ${cm_FLAGS})
# FC fotran compiler | FF Fortran 77 compiler
# LDFLAGS -> pass -L flags
# LIBS -> pass -l flags
#Used by gcc/linux
vcpkg_backup_env_variables(VARS C_INCLUDE_PATH CPLUS_INCLUDE_PATH LIBRARY_PATH LD_LIBRARY_PATH)
#Used by cl
vcpkg_backup_env_variables(VARS INCLUDE LIB LIBPATH)
set(vcm_paths_with_spaces OFF)
if(CURRENT_PACKAGES_DIR MATCHES " " OR CURRENT_INSTALLED_DIR MATCHES " ")
# Don't bother with whitespace. The tools will probably fail and I tried very hard trying to make it work (no success so far)!
message(WARNING "Detected whitespace in root directory. Please move the path to one without whitespaces! The required tools do not handle whitespaces correctly and the build will most likely fail")
set(vcm_paths_with_spaces ON)
endif()
set(configure_env "V=1")
# Pre-processing windows configure requirements
if (VCPKG_TARGET_IS_WINDOWS)
if(CMAKE_HOST_WIN32)
list(APPEND msys_require_packages binutils libtool autoconf automake-wrapper automake1.16 m4)
vcpkg_acquire_msys(MSYS_ROOT PACKAGES ${msys_require_packages} ${arg_ADDITIONAL_MSYS_PACKAGES})
endif()
if (arg_DETERMINE_BUILD_TRIPLET OR NOT arg_BUILD_TRIPLET)
z_vcpkg_determine_autotools_host_cpu(BUILD_ARCH) # VCPKG_HOST => machine you are building on => --build=
z_vcpkg_determine_autotools_target_cpu(TARGET_ARCH)
# --build: the machine you are building on
# --host: the machine you are building for
# --target: the machine that CC will produce binaries for
# https://stackoverflow.com/questions/21990021/how-to-determine-host-value-for-configure-when-using-cross-compiler
# Only for ports using autotools so we can assume that they follow the common conventions for build/target/host
if(CMAKE_HOST_WIN32)
set(arg_BUILD_TRIPLET "--build=${BUILD_ARCH}-pc-mingw32") # This is required since we are running in a msys
# shell which will be otherwise identified as ${BUILD_ARCH}-pc-msys
endif()
if(NOT TARGET_ARCH MATCHES "${BUILD_ARCH}" OR NOT CMAKE_HOST_WIN32) # we don't need to specify the additional flags if we build nativly, this does not hold when we are not on windows
string(APPEND arg_BUILD_TRIPLET " --host=${TARGET_ARCH}-pc-mingw32") # (Host activates crosscompilation; The name given here is just the prefix of the host tools for the target)
endif()
if(VCPKG_TARGET_IS_UWP AND NOT arg_BUILD_TRIPLET MATCHES "--host")
# Needs to be different from --build to enable cross builds.
string(APPEND arg_BUILD_TRIPLET " --host=${TARGET_ARCH}-unknown-mingw32")
endif()
debug_message("Using make triplet: ${arg_BUILD_TRIPLET}")
endif()
if(CMAKE_HOST_WIN32)
set(append_env)
if(arg_USE_WRAPPERS)
set(append_env ";${MSYS_ROOT}/usr/share/automake-1.16")
string(APPEND append_env ";${SCRIPTS}/buildsystems/make_wrapper") # Other required wrappers are also located there
endif()
# This inserts msys before system32 (which masks sort.exe and find.exe) but after MSVC (which avoids masking link.exe)
string(REPLACE ";$ENV{SystemRoot}\\System32;" "${append_env};${MSYS_ROOT}/usr/bin;$ENV{SystemRoot}\\System32;" NEWPATH "$ENV{PATH}")
string(REPLACE ";$ENV{SystemRoot}\\system32;" "${append_env};${MSYS_ROOT}/usr/bin;$ENV{SystemRoot}\\system32;" NEWPATH "$ENV{PATH}")
set(ENV{PATH} "${NEWPATH}")
set(bash_executable "${MSYS_ROOT}/usr/bin/bash.exe")
endif()
# Remove full filepaths due to spaces and prepend filepaths to PATH (cross-compiling tools are unlikely on path by default)
set(progs VCPKG_DETECTED_CMAKE_C_COMPILER VCPKG_DETECTED_CMAKE_CXX_COMPILER VCPKG_DETECTED_CMAKE_AR
VCPKG_DETECTED_CMAKE_LINKER VCPKG_DETECTED_CMAKE_RANLIB VCPKG_DETECTED_CMAKE_OBJDUMP
VCPKG_DETECTED_CMAKE_STRIP VCPKG_DETECTED_CMAKE_NM VCPKG_DETECTED_CMAKE_DLLTOOL VCPKG_DETECTED_CMAKE_RC_COMPILER)
foreach(prog IN LISTS progs)
if(${prog})
set(path "${${prog}}")
unset(prog_found CACHE)
get_filename_component(${prog} "${${prog}}" NAME)
find_program(prog_found ${${prog}} PATHS ENV PATH NO_DEFAULT_PATH)
if(NOT path STREQUAL prog_found)
get_filename_component(path "${path}" DIRECTORY)
vcpkg_add_to_path(PREPEND ${path})
endif()
endif()
endforeach()
if (arg_USE_WRAPPERS)
z_vcpkg_append_to_configure_environment(configure_env CPP "compile ${VCPKG_DETECTED_CMAKE_C_COMPILER} -E")
z_vcpkg_append_to_configure_environment(configure_env CC "compile ${VCPKG_DETECTED_CMAKE_C_COMPILER}")
z_vcpkg_append_to_configure_environment(configure_env CC_FOR_BUILD "compile ${VCPKG_DETECTED_CMAKE_C_COMPILER}")
z_vcpkg_append_to_configure_environment(configure_env CXX "compile ${VCPKG_DETECTED_CMAKE_CXX_COMPILER}")
z_vcpkg_append_to_configure_environment(configure_env RC "windres-rc ${VCPKG_DETECTED_CMAKE_RC_COMPILER}")
z_vcpkg_append_to_configure_environment(configure_env WINDRES "windres-rc ${VCPKG_DETECTED_CMAKE_RC_COMPILER}")
if(VCPKG_DETECTED_CMAKE_AR)
z_vcpkg_append_to_configure_environment(configure_env AR "ar-lib ${VCPKG_DETECTED_CMAKE_AR}")
else()
z_vcpkg_append_to_configure_environment(configure_env AR "ar-lib lib.exe -verbose")
endif()
else()
z_vcpkg_append_to_configure_environment(configure_env CPP "${VCPKG_DETECTED_CMAKE_C_COMPILER} -E")
z_vcpkg_append_to_configure_environment(configure_env CC "${VCPKG_DETECTED_CMAKE_C_COMPILER}")
z_vcpkg_append_to_configure_environment(configure_env CC_FOR_BUILD "${VCPKG_DETECTED_CMAKE_C_COMPILER}")
z_vcpkg_append_to_configure_environment(configure_env CXX "${VCPKG_DETECTED_CMAKE_CXX_COMPILER}")
z_vcpkg_append_to_configure_environment(configure_env RC "${VCPKG_DETECTED_CMAKE_RC_COMPILER}")
z_vcpkg_append_to_configure_environment(configure_env WINDRES "${VCPKG_DETECTED_CMAKE_RC_COMPILER}")
if(VCPKG_DETECTED_CMAKE_AR)
z_vcpkg_append_to_configure_environment(configure_env AR "${VCPKG_DETECTED_CMAKE_AR}")
else()
z_vcpkg_append_to_configure_environment(configure_env AR "lib.exe -verbose")
endif()
endif()
z_vcpkg_append_to_configure_environment(configure_env LD "${VCPKG_DETECTED_CMAKE_LINKER} -verbose")
if(VCPKG_DETECTED_CMAKE_RANLIB)
z_vcpkg_append_to_configure_environment(configure_env RANLIB "${VCPKG_DETECTED_CMAKE_RANLIB}") # Trick to ignore the RANLIB call
else()
z_vcpkg_append_to_configure_environment(configure_env RANLIB ":")
endif()
if(VCPKG_DETECTED_CMAKE_OBJDUMP) #Objdump is required to make shared libraries. Otherwise define lt_cv_deplibs_check_method=pass_all
z_vcpkg_append_to_configure_environment(configure_env OBJDUMP "${VCPKG_DETECTED_CMAKE_OBJDUMP}") # Trick to ignore the RANLIB call
endif()
if(VCPKG_DETECTED_CMAKE_STRIP) # If required set the ENV variable STRIP in the portfile correctly
z_vcpkg_append_to_configure_environment(configure_env STRIP "${VCPKG_DETECTED_CMAKE_STRIP}")
else()
z_vcpkg_append_to_configure_environment(configure_env STRIP ":")
list(APPEND arg_OPTIONS ac_cv_prog_ac_ct_STRIP=:)
endif()
if(VCPKG_DETECTED_CMAKE_NM) # If required set the ENV variable NM in the portfile correctly
z_vcpkg_append_to_configure_environment(configure_env NM "${VCPKG_DETECTED_CMAKE_NM}")
else()
# Would be better to have a true nm here! Some symbols (mainly exported variables) get not properly imported with dumpbin as nm
# and require __declspec(dllimport) for some reason (same problem CMake has with WINDOWS_EXPORT_ALL_SYMBOLS)
z_vcpkg_append_to_configure_environment(configure_env NM "dumpbin.exe -symbols -headers")
endif()
if(VCPKG_DETECTED_CMAKE_DLLTOOL) # If required set the ENV variable DLLTOOL in the portfile correctly
z_vcpkg_append_to_configure_environment(configure_env DLLTOOL "${VCPKG_DETECTED_CMAKE_DLLTOOL}")
else()
z_vcpkg_append_to_configure_environment(configure_env DLLTOOL "link.exe -verbose -dll")
endif()
z_vcpkg_append_to_configure_environment(configure_env CCAS ":") # If required set the ENV variable CCAS in the portfile correctly
z_vcpkg_append_to_configure_environment(configure_env AS ":") # If required set the ENV variable AS in the portfile correctly
foreach(_env IN LISTS arg_CONFIGURE_ENVIRONMENT_VARIABLES)
z_vcpkg_append_to_configure_environment(configure_env ${_env} "${${_env}}")
endforeach()
debug_message("configure_env: '${configure_env}'")
# Other maybe interesting variables to control
# COMPILE This is the command used to actually compile a C source file. The file name is appended to form the complete command line.
# LINK This is the command used to actually link a C program.
# CXXCOMPILE The command used to actually compile a C++ source file. The file name is appended to form the complete command line.
# CXXLINK The command used to actually link a C++ program.
# Variables not correctly detected by configure. In release builds.
list(APPEND arg_OPTIONS gl_cv_double_slash_root=yes
ac_cv_func_memmove=yes)
#list(APPEND arg_OPTIONS lt_cv_deplibs_check_method=pass_all) # Just ignore libtool checks
if(VCPKG_TARGET_ARCHITECTURE MATCHES "^[Aa][Rr][Mm]64$")
list(APPEND arg_OPTIONS gl_cv_host_cpu_c_abi=no)
# Currently needed for arm64 because objdump yields: "unrecognised machine type (0xaa64) in Import Library Format archive"
list(APPEND arg_OPTIONS lt_cv_deplibs_check_method=pass_all)
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "^[Aa][Rr][Mm]$")
# Currently needed for arm because objdump yields: "unrecognised machine type (0x1c4) in Import Library Format archive"
list(APPEND arg_OPTIONS lt_cv_deplibs_check_method=pass_all)
endif()
endif()
# Some PATH handling for dealing with spaces....some tools will still fail with that!
# In particular, the libtool install command is unable to install correctly to paths with spaces.
# CURRENT_INSTALLED_DIR: Pristine native path (unprotected spaces, Windows drive letters)
# z_vcpkg_installed_path: Native path with escaped space characters
# z_vcpkg_prefix_path: Path with unprotected spaces, but drive letters transformed for mingw/msys
string(REPLACE " " "\\ " z_vcpkg_installed_path "${CURRENT_INSTALLED_DIR}")
if(CMAKE_HOST_WIN32)
string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" z_vcpkg_prefix_path "${CURRENT_INSTALLED_DIR}")
else()
set(z_vcpkg_prefix_path "${CURRENT_INSTALLED_DIR}")
endif()
# macOS - cross-compiling support
if(VCPKG_TARGET_IS_OSX)
if (requires_autoconfig AND NOT arg_BUILD_TRIPLET OR arg_DETERMINE_BUILD_TRIPLET)
z_vcpkg_determine_autotools_host_arch_mac(BUILD_ARCH) # machine you are building on => --build=
z_vcpkg_determine_autotools_target_arch_mac(TARGET_ARCH)
# --build: the machine you are building on
# --host: the machine you are building for
# --target: the machine that CC will produce binaries for
# https://stackoverflow.com/questions/21990021/how-to-determine-host-value-for-configure-when-using-cross-compiler
# Only for ports using autotools so we can assume that they follow the common conventions for build/target/host
if(NOT "${TARGET_ARCH}" STREQUAL "${BUILD_ARCH}") # we don't need to specify the additional flags if we build natively.
set(arg_BUILD_TRIPLET "--host=${TARGET_ARCH}-apple-darwin") # (Host activates crosscompilation; The name given here is just the prefix of the host tools for the target)
endif()
debug_message("Using make triplet: ${arg_BUILD_TRIPLET}")
endif()
endif()
# Linux - cross-compiling support
if(VCPKG_TARGET_IS_LINUX)
if (requires_autoconfig AND NOT arg_BUILD_TRIPLET OR arg_DETERMINE_BUILD_TRIPLET)
# The regex below takes the prefix from the resulting CMAKE_C_COMPILER variable eg. arm-linux-gnueabihf-gcc
# set in the common toolchains/linux.cmake
# This is used via --host as a prefix for all other bin tools as well.
# Setting the compiler directly via CC=arm-linux-gnueabihf-gcc does not work acording to:
# https://www.gnu.org/software/autoconf/manual/autoconf-2.65/html_node/Specifying-Target-Triplets.html
if(VCPKG_DETECTED_CMAKE_C_COMPILER MATCHES "([^\/]*)-gcc$" AND CMAKE_MATCH_1)
set(arg_BUILD_TRIPLET "--host=${CMAKE_MATCH_1}") # (Host activates crosscompilation; The name given here is just the prefix of the host tools for the target)
endif()
debug_message("Using make triplet: ${arg_BUILD_TRIPLET}")
endif()
endif()
# Cleanup previous build dirs
file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg"
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}")
# Set configure paths
set(arg_OPTIONS_RELEASE ${arg_OPTIONS_RELEASE} "--prefix=${z_vcpkg_prefix_path}")
set(arg_OPTIONS_DEBUG ${arg_OPTIONS_DEBUG} "--prefix=${z_vcpkg_prefix_path}/debug")
if(NOT arg_NO_ADDITIONAL_PATHS)
# ${prefix} has an extra backslash to prevent early expansion when calling `bash -c configure "..."`.
set(arg_OPTIONS_RELEASE ${arg_OPTIONS_RELEASE}
# Important: These should all be relative to prefix!
"--bindir=\\\${prefix}/tools/${PORT}/bin"
"--sbindir=\\\${prefix}/tools/${PORT}/sbin"
"--libdir=\\\${prefix}/lib" # On some Linux distributions lib64 is the default
#"--includedir='\${prefix}'/include" # already the default!
"--mandir=\\\${prefix}/share/${PORT}"
"--docdir=\\\${prefix}/share/${PORT}"
"--datarootdir=\\\${prefix}/share/${PORT}")
set(arg_OPTIONS_DEBUG ${arg_OPTIONS_DEBUG}
# Important: These should all be relative to prefix!
"--bindir=\\\${prefix}/../tools/${PORT}/debug/bin"
"--sbindir=\\\${prefix}/../tools/${PORT}/debug/sbin"
"--libdir=\\\${prefix}/lib" # On some Linux distributions lib64 is the default
"--includedir=\\\${prefix}/../include"
"--datarootdir=\\\${prefix}/share/${PORT}")
endif()
# Setup common options
if(NOT arg_DISABLE_VERBOSE_FLAGS)
list(APPEND arg_OPTIONS --disable-silent-rules --verbose)
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
list(APPEND arg_OPTIONS --enable-shared --disable-static)
else()
list(APPEND arg_OPTIONS --disable-shared --enable-static)
endif()
# Can be set in the triplet to append options for configure
if(DEFINED VCPKG_CONFIGURE_MAKE_OPTIONS)
list(APPEND arg_OPTIONS ${VCPKG_CONFIGURE_MAKE_OPTIONS})
endif()
if(DEFINED VCPKG_CONFIGURE_MAKE_OPTIONS_RELEASE)
list(APPEND arg_OPTIONS_RELEASE ${VCPKG_CONFIGURE_MAKE_OPTIONS_RELEASE})
endif()
if(DEFINED VCPKG_CONFIGURE_MAKE_OPTIONS_DEBUG)
list(APPEND arg_OPTIONS_DEBUG ${VCPKG_CONFIGURE_MAKE_OPTIONS_DEBUG})
endif()
file(RELATIVE_PATH relative_build_path "${CURRENT_BUILDTREES_DIR}" "${arg_SOURCE_PATH}/${arg_PROJECT_SUBPATH}")
set(base_cmd)
if(CMAKE_HOST_WIN32)
set(base_cmd ${bash_executable} --noprofile --norc --debug)
else()
find_program(base_cmd bash REQUIRED)
endif()
# Used by CL
vcpkg_host_path_list(PREPEND ENV{INCLUDE} "${CURRENT_INSTALLED_DIR}/include")
# Used by GCC
vcpkg_host_path_list(PREPEND ENV{C_INCLUDE_PATH} "${CURRENT_INSTALLED_DIR}/include")
vcpkg_host_path_list(PREPEND ENV{CPLUS_INCLUDE_PATH} "${CURRENT_INSTALLED_DIR}/include")
# Flags should be set in the toolchain instead (Setting this up correctly requires a function named vcpkg_determined_cmake_compiler_flags which can also be used to setup CC and CXX etc.)
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_backup_env_variables(VARS _CL_ _LINK_)
# TODO: Should be CPP flags instead -> rewrite when vcpkg_determined_cmake_compiler_flags defined
if(VCPKG_TARGET_IS_UWP)
# Be aware that configure thinks it is crosscompiling due to:
# error while loading shared libraries: VCRUNTIME140D_APP.dll:
# cannot open shared object file: No such file or directory
# IMPORTANT: The only way to pass linker flags through libtool AND the compile wrapper
# is to use the CL and LINK environment variables !!!
# (This is due to libtool and compiler wrapper using the same set of options to pass those variables around)
file(TO_CMAKE_PATH "$ENV{VCToolsInstallDir}" VCToolsInstallDir)
set(_replacement -FU\"${VCToolsInstallDir}/lib/x86/store/references/platform.winmd\")
string(REPLACE "${_replacement}" "" VCPKG_DETECTED_CMAKE_CXX_FLAGS_DEBUG "${VCPKG_DETECTED_CMAKE_CXX_FLAGS_DEBUG}")
string(REPLACE "${_replacement}" "" VCPKG_DETECTED_CMAKE_C_FLAGS_DEBUG "${VCPKG_DETECTED_CMAKE_C_FLAGS_DEBUG}")
string(REPLACE "${_replacement}" "" VCPKG_DETECTED_CMAKE_CXX_FLAGS_RELEASE "${VCPKG_DETECTED_CMAKE_CXX_FLAGS_RELEASE}")
string(REPLACE "${_replacement}" "" VCPKG_DETECTED_CMAKE_C_FLAGS_RELEASE "${VCPKG_DETECTED_CMAKE_C_FLAGS_RELEASE}")
# Can somebody please check if CMake's compiler flags for UWP are correct?
set(ENV{_CL_} "$ENV{_CL_} -FU\"${VCToolsInstallDir}/lib/x86/store/references/platform.winmd\"")
set(ENV{_LINK_} "$ENV{_LINK_} ${VCPKG_DETECTED_CMAKE_C_STANDARD_LIBRARIES} ${VCPKG_DETECTED_CMAKE_CXX_STANDARD_LIBRARIES}")
endif()
endif()
z_convert_to_list(VCPKG_DETECTED_CMAKE_C_STANDARD_LIBRARIES c_libs_list)
z_convert_to_list(VCPKG_DETECTED_CMAKE_CXX_STANDARD_LIBRARIES cxx_libs_list)
set(all_libs_list ${c_libs_list} ${cxx_libs_list})
list(REMOVE_DUPLICATES all_libs_list)
list(TRANSFORM all_libs_list STRIP)
#Do lib list transformation from name.lib to -lname if necessary
set(x_vcpkg_transform_libs ON)
if(VCPKG_TARGET_IS_UWP)
set(x_vcpkg_transform_libs OFF)
# Avoid libtool choke: "Warning: linker path does not have real file for library -lWindowsApp."
# The problem with the choke is that libtool always falls back to built a static library even if a dynamic was requested.
# Note: Env LIBPATH;LIB are on the search path for libtool by default on windows.
# It even does unix/dos-short/unix transformation with the path to get rid of spaces.
endif()
set(l_prefix)
if(x_vcpkg_transform_libs)
set(l_prefix "-l")
list(TRANSFORM all_libs_list REPLACE "(.dll.lib|.lib|.a|.so)$" "")
if(VCPKG_TARGET_IS_WINDOWS)
list(REMOVE_ITEM all_libs_list "uuid")
endif()
list(TRANSFORM all_libs_list REPLACE "^(${l_prefix})" "")
endif()
list(JOIN all_libs_list " ${l_prefix}" all_libs_string)
if(VCPKG_TARGET_IS_MINGW AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
# libtool must be told explicitly that there is no dynamic linkage for uuid.
# The "-Wl,..." syntax is understood by libtool and gcc, but no by ld.
string(REPLACE " -luuid" " -Wl,-Bstatic,-luuid,-Bdynamic" all_libs_string "${all_libs_string}")
endif()
if(all_libs_string)
set(all_libs_string "${l_prefix}${all_libs_string}")
if(DEFINED ENV{LIBS})
set(ENV{LIBS} "$ENV{LIBS} ${all_libs_string}")
else()
set(ENV{LIBS} "${all_libs_string}")
endif()
endif()
debug_message("ENV{LIBS}:$ENV{LIBS}")
# Run autoconf if necessary
if (arg_AUTOCONFIG OR requires_autoconfig)
find_program(AUTORECONF autoreconf)
if(NOT AUTORECONF)
message(FATAL_ERROR "${PORT} requires autoconf from the system package manager (example: \"sudo apt-get install autoconf\")")
endif()
message(STATUS "Generating configure for ${TARGET_TRIPLET}")
if (CMAKE_HOST_WIN32)
vcpkg_execute_required_process(
COMMAND ${base_cmd} -c "autoreconf -vfi"
WORKING_DIRECTORY "${src_dir}"
LOGNAME "autoconf-${TARGET_TRIPLET}"
)
else()
vcpkg_execute_required_process(
COMMAND "${AUTORECONF}" -vfi
WORKING_DIRECTORY "${src_dir}"
LOGNAME "autoconf-${TARGET_TRIPLET}"
)
endif()
message(STATUS "Finished generating configure for ${TARGET_TRIPLET}")
endif()
if(requires_autogen)
message(STATUS "Generating configure for ${TARGET_TRIPLET} via autogen.sh")
if (CMAKE_HOST_WIN32)
vcpkg_execute_required_process(
COMMAND ${base_cmd} -c "./autogen.sh"
WORKING_DIRECTORY "${src_dir}"
LOGNAME "autoconf-${TARGET_TRIPLET}"
)
else()
vcpkg_execute_required_process(
COMMAND "./autogen.sh"
WORKING_DIRECTORY "${src_dir}"
LOGNAME "autoconf-${TARGET_TRIPLET}"
)
endif()
message(STATUS "Finished generating configure for ${TARGET_TRIPLET}")
endif()
if (arg_PRERUN_SHELL)
message(STATUS "Prerun shell with ${TARGET_TRIPLET}")
if (CMAKE_HOST_WIN32)
vcpkg_execute_required_process(
COMMAND ${base_cmd} -c "${arg_PRERUN_SHELL}"
WORKING_DIRECTORY "${src_dir}"
LOGNAME "prerun-${TARGET_TRIPLET}"
)
else()
vcpkg_execute_required_process(
COMMAND "${base_cmd}" -c "${arg_PRERUN_SHELL}"
WORKING_DIRECTORY "${src_dir}"
LOGNAME "prerun-${TARGET_TRIPLET}"
)
endif()
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug" AND NOT arg_NO_DEBUG)
set(var_suffix DEBUG)
set(path_suffix_${var_suffix} "/debug")
set(short_name_${var_suffix} "dbg")
list(APPEND all_buildtypes ${var_suffix})
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(LINKER_FLAGS_${var_suffix} "${VCPKG_DETECTED_CMAKE_STATIC_LINKER_FLAGS_${var_suffix}}")
else() # dynamic
set(LINKER_FLAGS_${var_suffix} "${VCPKG_DETECTED_CMAKE_SHARED_LINKER_FLAGS_${var_suffix}}")
endif()
z_vcpkg_extract_cpp_flags_and_set_cflags_and_cxxflags(${var_suffix})
if (CMAKE_HOST_WIN32 AND VCPKG_DETECTED_CMAKE_C_COMPILER MATCHES "cl.exe")
if(NOT vcm_paths_with_spaces)
set(LDFLAGS_${var_suffix} "-L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib -L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib/manual-link")
endif()
if(DEFINED ENV{_LINK_})
set(LINK_ENV_${var_suffix} "$ENV{_LINK_} ${LINKER_FLAGS_${var_suffix}}")
else()
set(LINK_ENV_${var_suffix} "${LINKER_FLAGS_${var_suffix}}")
endif()
else()
set(link_required_dirs)
if(EXISTS "${CURRENT_INSTALLED_DIR}${path_suffix_${var_suffix}}/lib")
set(link_required_dirs "-L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib")
endif()
if(EXISTS "{CURRENT_INSTALLED_DIR}${path_suffix_${var_suffix}}/lib/manual-link")
set(link_required_dirs "${link_required_dirs} -L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib/manual-link")
endif()
string(STRIP "${link_required_dirs}" link_required_dirs)
set(LDFLAGS_${var_suffix} "${link_required_dirs} ${LINKER_FLAGS_${var_suffix}}")
endif()
unset(var_suffix)
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
set(var_suffix RELEASE)
set(path_suffix_${var_suffix} "")
set(short_name_${var_suffix} "rel")
list(APPEND all_buildtypes ${var_suffix})
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(LINKER_FLAGS_${var_suffix} "${VCPKG_DETECTED_CMAKE_STATIC_LINKER_FLAGS_${var_suffix}}")
else() # dynamic
set(LINKER_FLAGS_${var_suffix} "${VCPKG_DETECTED_CMAKE_SHARED_LINKER_FLAGS_${var_suffix}}")
endif()
z_vcpkg_extract_cpp_flags_and_set_cflags_and_cxxflags(${var_suffix})
if (CMAKE_HOST_WIN32 AND VCPKG_DETECTED_CMAKE_C_COMPILER MATCHES "cl.exe")
if(NOT vcm_paths_with_spaces)
set(LDFLAGS_${var_suffix} "-L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib -L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib/manual-link")
endif()
if(DEFINED ENV{_LINK_})
set(LINK_ENV_${var_suffix} "$ENV{_LINK_} ${LINKER_FLAGS_${var_suffix}}")
else()
set(LINK_ENV_${var_suffix} "${LINKER_FLAGS_${var_suffix}}")
endif()
else()
set(link_required_dirs "")
if(EXISTS "${CURRENT_INSTALLED_DIR}${path_suffix_${var_suffix}}/lib")
set(link_required_dirs "-L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib")
endif()
if(EXISTS "${CURRENT_INSTALLED_DIR}${path_suffix_${var_suffix}}/lib/manual-link")
set(link_required_dirs "${link_required_dirs} -L${z_vcpkg_installed_path}${path_suffix_${var_suffix}}/lib/manual-link")
endif()
string(STRIP "${link_required_dirs}" link_required_dirs)
set(LDFLAGS_${var_suffix} "${link_required_dirs} ${LINKER_FLAGS_${var_suffix}}")
endif()
unset(var_suffix)
endif()
foreach(var IN ITEMS arg_OPTIONS arg_OPTIONS_RELEASE arg_OPTIONS_DEBUG)
vcpkg_list(SET tmp)
foreach(element IN LISTS "${var}")
string(REPLACE [["]] [[\"]] element "${element}")
vcpkg_list(APPEND tmp "\"${element}\"")
endforeach()
vcpkg_list(JOIN tmp " " "${var}")
endforeach()
foreach(current_buildtype IN LISTS all_buildtypes)
foreach(ENV_VAR ${arg_CONFIG_DEPENDENT_ENVIRONMENT})
if(DEFINED ENV{${ENV_VAR}})
set(backup_config_${ENV_VAR} "$ENV{${ENV_VAR}}")
endif()
set(ENV{${ENV_VAR}} "${${ENV_VAR}_${current_buildtype}}")
endforeach()
set(target_dir "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${short_name_${current_buildtype}}")
file(MAKE_DIRECTORY "${target_dir}")
file(RELATIVE_PATH relative_build_path "${target_dir}" "${src_dir}")
if(arg_COPY_SOURCE)
file(COPY "${src_dir}/" DESTINATION "${target_dir}")
set(relative_build_path .)
endif()
# Setup PKG_CONFIG_PATH
if ("${current_buildtype}" STREQUAL "DEBUG")
z_vcpkg_setup_pkgconfig_path(BASE_DIRS "${CURRENT_INSTALLED_DIR}/debug")
else()
z_vcpkg_setup_pkgconfig_path(BASE_DIRS "${CURRENT_INSTALLED_DIR}")
endif()
# Setup environment
set(ENV{CPPFLAGS} "${CPPFLAGS_${current_buildtype}}")
set(ENV{CFLAGS} "${CFLAGS_${current_buildtype}}")
set(ENV{CXXFLAGS} "${CXXFLAGS_${current_buildtype}}")
set(ENV{RCFLAGS} "${VCPKG_DETECTED_CMAKE_RC_FLAGS_${current_buildtype}}")
set(ENV{LDFLAGS} "${LDFLAGS_${current_buildtype}}")
# https://www.gnu.org/software/libtool/manual/html_node/Link-mode.html
# -avoid-version is handled specially by libtool link mode, this flag is not forwarded to linker,
# and libtool tries to avoid versioning for shared libraries and no symbolic links are created.
if(VCPKG_TARGET_IS_ANDROID)
set(ENV{LDFLAGS} "-avoid-version $ENV{LDFLAGS}")
endif()
if(LINK_ENV_${current_buildtype})
set(link_config_backup "$ENV{_LINK_}")
set(ENV{_LINK_} "${LINK_ENV_${current_buildtype}}")
endif()
vcpkg_list(APPEND lib_env_vars LIB LIBPATH LIBRARY_PATH) # LD_LIBRARY_PATH)
foreach(lib_env_var IN LISTS lib_env_vars)
if(EXISTS "${CURRENT_INSTALLED_DIR}${path_suffix_${current_buildtype}}/lib")
vcpkg_host_path_list(PREPEND ENV{${lib_env_var}} "${CURRENT_INSTALLED_DIR}${path_suffix_${current_buildtype}}/lib")
endif()
if(EXISTS "${CURRENT_INSTALLED_DIR}${path_suffix_${current_buildtype}}/lib/manual-link")
vcpkg_host_path_list(PREPEND ENV{${lib_env_var}} "${CURRENT_INSTALLED_DIR}${path_suffix_${current_buildtype}}/lib/manual-link")
endif()
endforeach()
unset(lib_env_vars)
set(command "${base_cmd}" -c "${configure_env} ./${relative_build_path}/configure ${arg_BUILD_TRIPLET} ${arg_OPTIONS} ${arg_OPTIONS_${current_buildtype}}")
if(arg_ADD_BIN_TO_PATH)
set(path_backup $ENV{PATH})
vcpkg_add_to_path("${CURRENT_INSTALLED_DIR}${path_suffix_${current_buildtype}}/bin")
endif()
debug_message("Configure command:'${command}'")
if (NOT arg_SKIP_CONFIGURE)
message(STATUS "Configuring ${TARGET_TRIPLET}-${short_name_${current_buildtype}}")
vcpkg_execute_required_process(
COMMAND ${command}
WORKING_DIRECTORY "${target_dir}"
LOGNAME "config-${TARGET_TRIPLET}-${short_name_${current_buildtype}}"
)
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW AND VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
file(GLOB_RECURSE libtool_files "${target_dir}*/libtool")
foreach(lt_file IN LISTS libtool_files)
file(READ "${lt_file}" _contents)
string(REPLACE ".dll.lib" ".lib" _contents "${_contents}")
file(WRITE "${lt_file}" "${_contents}")
endforeach()
endif()
if(EXISTS "${target_dir}/config.log")
file(RENAME "${target_dir}/config.log" "${CURRENT_BUILDTREES_DIR}/config.log-${TARGET_TRIPLET}-${short_name_${current_buildtype}}.log")
endif()
endif()
z_vcpkg_restore_pkgconfig_path()
if(link_config_backup)
set(ENV{_LINK_} "${link_config_backup}")
unset(link_config_backup)
endif()
if(arg_ADD_BIN_TO_PATH)
set(ENV{PATH} "${path_backup}")
endif()
# Restore environment (config dependent)
foreach(ENV_VAR IN LISTS ${arg_CONFIG_DEPENDENT_ENVIRONMENT})
if(backup_config_${ENV_VAR})
set(ENV{${ENV_VAR}} "${backup_config_${ENV_VAR}}")
else()
unset(ENV{${ENV_VAR}})
endif()
endforeach()
endforeach()
# Export matching make program for vcpkg_build_make (cache variable)
if(CMAKE_HOST_WIN32 AND MSYS_ROOT)
find_program(Z_VCPKG_MAKE make PATHS "${MSYS_ROOT}/usr/bin" NO_DEFAULT_PATH REQUIRED)
elseif(VCPKG_HOST_IS_OPENBSD)
find_program(Z_VCPKG_MAKE gmake REQUIRED)
else()
find_program(Z_VCPKG_MAKE make REQUIRED)
endif()
# Restore environment
vcpkg_restore_env_variables(VARS ${cm_FLAGS} LIB LIBPATH LIBRARY_PATH LD_LIBRARY_PATH)
set(_VCPKG_PROJECT_SOURCE_PATH ${arg_SOURCE_PATH} PARENT_SCOPE)
set(_VCPKG_PROJECT_SUBPATH ${arg_PROJECT_SUBPATH} PARENT_SCOPE)
set(_VCPKG_MAKE_NO_DEBUG ${arg_NO_DEBUG} PARENT_SCOPE)
endfunction()

View File

@@ -1,455 +0,0 @@
function(z_vcpkg_append_proglist var_to_append additional_binaries)
string(APPEND "${var_to_append}" "[binaries]\n")
if(VCPKG_TARGET_IS_WINDOWS)
set(proglist MT AR)
else()
set(proglist AR RANLIB STRIP NM OBJDUMP DLLTOOL MT)
endif()
foreach(prog IN LISTS proglist)
if(VCPKG_DETECTED_CMAKE_${prog})
if(meson_${prog})
string(APPEND "${var_to_append}" "${meson_${prog}} = '${VCPKG_DETECTED_CMAKE_${prog}}'\n")
else()
string(TOLOWER "${prog}" proglower)
string(APPEND "${var_to_append}" "${proglower} = '${VCPKG_DETECTED_CMAKE_${prog}}'\n")
endif()
endif()
endforeach()
set(programs C CXX RC)
set(meson_RC windres)
set(meson_CXX cpp)
foreach(prog IN LISTS programs)
if(VCPKG_DETECTED_CMAKE_${prog}_COMPILER)
if(meson_${prog})
string(APPEND "${var_to_append}" "${meson_${prog}} = '${VCPKG_DETECTED_CMAKE_${prog}_COMPILER}'\n")
else()
string(TOLOWER "${prog}" proglower)
string(APPEND "${var_to_append}" "${proglower} = '${VCPKG_DETECTED_CMAKE_${prog}_COMPILER}'\n")
endif()
endif()
endforeach()
if(VCPKG_DETECTED_CMAKE_LINKER AND VCPKG_TARGET_IS_WINDOWS)
# for gcc and icc the linker flag -fuse-ld is used. See https://github.com/mesonbuild/meson/issues/8647#issuecomment-878673456
if (NOT VCPKG_DETECTED_CMAKE_C_COMPILER_ID MATCHES "^(GNU|Intel)$")
string(APPEND "${var_to_append}" "c_ld = '${VCPKG_DETECTED_CMAKE_LINKER}'\n")
endif()
endif()
if(VCPKG_DETECTED_CMAKE_LINKER AND VCPKG_TARGET_IS_WINDOWS)
# for gcc and icc the linker flag -fuse-ld is used. See https://github.com/mesonbuild/meson/issues/8647#issuecomment-878673456
if (NOT VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Intel)$")
string(APPEND "${var_to_append}" "cpp_ld = '${VCPKG_DETECTED_CMAKE_LINKER}'\n")
endif()
endif()
get_filename_component(CMAKE_PATH "${CMAKE_COMMAND}" DIRECTORY)
vcpkg_add_to_path("${CMAKE_PATH}" PREPEND) # Make CMake invokeable for Meson
string(APPEND "${var_to_append}" "cmake = '${CMAKE_COMMAND}'\n")
vcpkg_find_acquire_program(PYTHON3)
get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY)
vcpkg_add_to_path("${PYTHON3_DIR}")
string(APPEND "${var_to_append}" "python = '${PYTHON3}'\n")
vcpkg_find_acquire_program(NINJA)
get_filename_component(NINJA_PATH ${NINJA} DIRECTORY)
vcpkg_add_to_path(PREPEND "${NINJA_PATH}") # Prepend to use the correct ninja.
# string(APPEND "${var_to_append}" "ninja = '${NINJA}'\n") # This does not work due to meson issues
foreach(additional_binary IN LISTS additional_binaries)
string(APPEND "${var_to_append}" "${additional_binary}\n")
endforeach()
set("${var_to_append}" "${${var_to_append}}" PARENT_SCOPE)
endfunction()
function(z_vcpkg_meson_generate_native_file additional_binaries) #https://mesonbuild.com/Native-environments.html
set(native_config "")
z_vcpkg_append_proglist(native_config "${additional_binaries}")
string(APPEND native_config "[built-in options]\n") #https://mesonbuild.com/Builtin-options.html
if(VCPKG_DETECTED_CMAKE_C_COMPILER MATCHES "cl.exe")
# This is currently wrongly documented in the meson docs or buggy. The docs say: 'none' = no flags
# In reality however 'none' tries to deactivate eh and meson passes the flags for it resulting in a lot of warnings
# about overriden flags. Until this is fixed in meson vcpkg should not pass this here.
# string(APPEND native_config "cpp_eh='none'\n") # To make sure meson is not adding eh flags by itself using msvc
endif()
if(VCPKG_TARGET_IS_WINDOWS)
set(c_winlibs "${VCPKG_DETECTED_CMAKE_C_STANDARD_LIBRARIES}")
set(cpp_winlibs "${VCPKG_DETECTED_CMAKE_CXX_STANDARD_LIBRARIES}")
foreach(libvar IN ITEMS c_winlibs cpp_winlibs)
string(REGEX REPLACE "( |^)(-|/)" [[;\2]] "${libvar}" "${${libvar}}")
string(REPLACE ".lib " ".lib;" "${libvar}" "${${libvar}}")
vcpkg_list(REMOVE_ITEM "${libvar}" "")
vcpkg_list(JOIN "${libvar}" "', '" "${libvar}")
string(APPEND native_config "${libvar} = ['${${libvar}}']\n")
endforeach()
endif()
set(native_config_name "${CURRENT_BUILDTREES_DIR}/meson-native-${TARGET_TRIPLET}.log")
set(vcpkg_meson_native_file "${native_config_name}" PARENT_SCOPE)
file(WRITE "${native_config_name}" "${native_config}")
endfunction()
function(z_vcpkg_meson_convert_compiler_flags_to_list out_var compiler_flags)
string(REPLACE ";" [[\;]] tmp_var "${compiler_flags}")
string(REGEX REPLACE [=[( +|^)((\"(\\"|[^"])+"|\\"|\\ |[^ ])+)]=] ";\\2" tmp_var "${tmp_var}")
vcpkg_list(POP_FRONT tmp_var) # The first element is always empty due to the above replacement
list(TRANSFORM tmp_var STRIP) # Strip leading trailing whitespaces from each element in the list.
set("${out_var}" "${tmp_var}" PARENT_SCOPE)
endfunction()
function(z_vcpkg_meson_convert_list_to_python_array out_var)
z_vcpkg_function_arguments(flag_list 1)
vcpkg_list(REMOVE_ITEM flag_list "") # remove empty elements if any
vcpkg_list(JOIN flag_list "', '" flag_list)
set("${out_var}" "['${flag_list}']" PARENT_SCOPE)
endfunction()
# Generates the required compiler properties for meson
function(z_vcpkg_meson_generate_flags_properties_string out_var config_type)
set(result "")
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
set(libpath_flag /LIBPATH:)
else()
set(libpath_flag -L)
endif()
if(config_type STREQUAL "DEBUG")
set(path_suffix "/debug")
else()
set(path_suffix "")
endif()
set(libpath "${libpath_flag}${CURRENT_INSTALLED_DIR}${path_suffix}/lib")
z_vcpkg_meson_convert_compiler_flags_to_list(cflags "${VCPKG_DETECTED_CMAKE_C_FLAGS_${config_type}}")
vcpkg_list(APPEND cflags "-I${CURRENT_INSTALLED_DIR}/include")
z_vcpkg_meson_convert_list_to_python_array(cflags ${cflags})
string(APPEND result "c_args = ${cflags}\n")
z_vcpkg_meson_convert_compiler_flags_to_list(cxxflags "${VCPKG_DETECTED_CMAKE_CXX_FLAGS_${config_type}}")
vcpkg_list(APPEND cxxflags "-I${CURRENT_INSTALLED_DIR}/include")
z_vcpkg_meson_convert_list_to_python_array(cxxflags ${cxxflags})
string(APPEND result "cpp_args = ${cxxflags}\n")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(linker_flags "${VCPKG_DETECTED_CMAKE_SHARED_LINKER_FLAGS_${config_type}}")
else()
set(linker_flags "${VCPKG_DETECTED_CMAKE_STATIC_LINKER_FLAGS_${config_type}}")
endif()
z_vcpkg_meson_convert_compiler_flags_to_list(linker_flags "${linker_flags}")
if(VCPKG_TARGET_IS_OSX)
# macOS - append arch and isysroot if cross-compiling
if(NOT "${VCPKG_OSX_ARCHITECTURES}" STREQUAL "${VCPKG_DETECTED_CMAKE_HOST_SYSTEM_PROCESSOR}")
foreach(arch IN LISTS VCPKG_OSX_ARCHITECTURES)
vcpkg_list(APPEND linker_flags -arch "${arch}")
endforeach()
endif()
if(VCPKG_DETECTED_CMAKE_OSX_SYSROOT)
vcpkg_list(APPEND linker_flags -isysroot "${VCPKG_DETECTED_CMAKE_OSX_SYSROOT}")
endif()
endif()
vcpkg_list(APPEND linker_flags "${libpath}")
z_vcpkg_meson_convert_list_to_python_array(linker_flags ${linker_flags})
string(APPEND result "c_link_args = ${linker_flags}\n")
string(APPEND result "cpp_link_args = ${linker_flags}\n")
set("${out_var}" "${result}" PARENT_SCOPE)
endfunction()
function(z_vcpkg_meson_generate_native_file_config config_type) #https://mesonbuild.com/Native-environments.html
set(native_file "[properties]\n") #https://mesonbuild.com/Builtin-options.html
#Setup CMake properties
string(APPEND native_file "cmake_toolchain_file = '${SCRIPTS}/buildsystems/vcpkg.cmake'\n")
string(APPEND native_file "[cmake]\n")
if(NOT VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
z_vcpkg_select_default_vcpkg_chainload_toolchain()
endif()
string(APPEND native_file "VCPKG_TARGET_TRIPLET = '${TARGET_TRIPLET}'\n")
string(APPEND native_file "VCPKG_CHAINLOAD_TOOLCHAIN_FILE = '${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}'\n")
string(APPEND native_file "VCPKG_CRT_LINKAGE = '${VCPKG_CRT_LINKAGE}'\n")
string(APPEND native_file "[built-in options]\n")
z_vcpkg_meson_generate_flags_properties_string(native_properties "${config_type}")
string(APPEND native_file "${native_properties}")
if(VCPKG_TARGET_IS_WINDOWS)
if(VCPKG_CRT_LINKAGE STREQUAL "static")
set(crt_type mt)
else()
set(crt_type md)
endif()
if("${config_type}" STREQUAL "DEBUG")
string(APPEND crt_type "d")
endif()
string(APPEND native_file "b_vscrt = '${crt_type}'\n")
endif()
string(TOLOWER "${config_type}" lowerconfig)
set(native_config_name "${CURRENT_BUILDTREES_DIR}/meson-native-${TARGET_TRIPLET}-${lowerconfig}.log")
file(WRITE "${native_config_name}" "${native_file}")
set("vcpkg_meson_native_file_${config_type}" "${native_config_name}" PARENT_SCOPE)
endfunction()
function(z_vcpkg_meson_generate_cross_file additional_binaries) #https://mesonbuild.com/Cross-compilation.html
if(CMAKE_HOST_WIN32)
if(DEFINED ENV{PROCESSOR_ARCHITEW6432})
set(build_arch $ENV{PROCESSOR_ARCHITEW6432})
else()
set(build_arch $ENV{PROCESSOR_ARCHITECTURE})
endif()
if(build_arch MATCHES "(amd|AMD)64")
set(build_cpu_fam x86_64)
set(build_cpu x86_64)
elseif(build_arch MATCHES "(x|X)86")
set(build_cpu_fam x86)
set(build_cpu i686)
elseif(build_arch MATCHES "^(ARM|arm)64$")
set(build_cpu_fam aarch64)
set(build_cpu armv8)
elseif(build_arch MATCHES "^(ARM|arm)$")
set(build_cpu_fam arm)
set(build_cpu armv7hl)
else()
message(FATAL_ERROR "Unsupported host architecture ${build_arch}!")
endif()
elseif(CMAKE_HOST_UNIX)
# at this stage, CMAKE_HOST_SYSTEM_PROCESSOR is not defined
execute_process(
COMMAND uname -m
OUTPUT_VARIABLE MACHINE
COMMAND_ERROR_IS_FATAL ANY)
# Show real machine architecture to visually understand whether we are in a native Apple Silicon terminal or running under Rosetta emulation
debug_message("Machine: ${MACHINE}")
if(MACHINE MATCHES "arm64|aarch64")
set(build_cpu_fam aarch64)
set(build_cpu armv8)
elseif(MACHINE MATCHES "x86_64|amd64")
set(build_cpu_fam x86_64)
set(build_cpu x86_64)
elseif(MACHINE MATCHES "x86|i686")
set(build_cpu_fam x86)
set(build_cpu i686)
elseif(MACHINE MATCHES "i386")
set(build_cpu_fam x86)
set(build_cpu i386)
else()
# https://github.com/mesonbuild/meson/blob/master/docs/markdown/Reference-tables.md#cpu-families
message(FATAL_ERROR "Unhandled machine: ${MACHINE}")
endif()
else()
message(FATAL_ERROR "Failed to detect the host architecture!")
endif()
if(VCPKG_TARGET_ARCHITECTURE MATCHES "(amd|AMD|x|X)64")
set(host_cpu_fam x86_64)
set(host_cpu x86_64)
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "(x|X)86")
set(host_cpu_fam x86)
set(host_cpu i686)
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "^(ARM|arm)64$")
set(host_cpu_fam aarch64)
set(host_cpu armv8)
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "^(ARM|arm)$")
set(host_cpu_fam arm)
set(host_cpu armv7hl)
else()
message(FATAL_ERROR "Unsupported target architecture ${VCPKG_TARGET_ARCHITECTURE}!" )
endif()
set(cross_file "")
z_vcpkg_append_proglist(cross_file "${additional_binaries}")
string(APPEND cross_file "[properties]\n")
string(APPEND cross_file "[host_machine]\n")
string(APPEND cross_file "endian = 'little'\n")
if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_TARGET_IS_MINGW)
set(meson_system_name "windows")
else()
string(TOLOWER "${VCPKG_CMAKE_SYSTEM_NAME}" meson_system_name)
endif()
string(APPEND cross_file "system = '${meson_system_name}'\n")
string(APPEND cross_file "cpu_family = '${host_cpu_fam}'\n")
string(APPEND cross_file "cpu = '${host_cpu}'\n")
string(APPEND cross_file "[build_machine]\n")
string(APPEND cross_file "endian = 'little'\n")
if(WIN32)
string(APPEND cross_file "system = 'windows'\n")
elseif(DARWIN)
string(APPEND cross_file "system = 'darwin'\n")
else()
string(APPEND cross_file "system = 'linux'\n")
endif()
if(DEFINED build_cpu_fam)
string(APPEND cross_file "cpu_family = '${build_cpu_fam}'\n")
endif()
if(DEFINED build_cpu)
string(APPEND cross_file "cpu = '${build_cpu}'\n")
endif()
if(NOT build_cpu_fam MATCHES "${host_cpu_fam}"
OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_IOS OR VCPKG_TARGET_IS_UWP
OR (VCPKG_TARGET_IS_MINGW AND NOT WIN32))
set(native_config_name "${CURRENT_BUILDTREES_DIR}/meson-cross-${TARGET_TRIPLET}.log")
set(vcpkg_meson_cross_file "${native_config_name}" PARENT_SCOPE)
file(WRITE "${native_config_name}" "${cross_file}")
endif()
endfunction()
function(z_vcpkg_meson_generate_cross_file_config config_type) #https://mesonbuild.com/Native-environments.html
set(cross_${config_type}_log "[properties]\n") #https://mesonbuild.com/Builtin-options.html
string(APPEND cross_${config_type}_log "[built-in options]\n")
z_vcpkg_meson_generate_flags_properties_string(cross_properties ${config_type})
string(APPEND cross_${config_type}_log "${cross_properties}")
if(VCPKG_TARGET_IS_WINDOWS)
if(VCPKG_CRT_LINKAGE STREQUAL "static")
set(crt_type mt)
else()
set(crt_type md)
endif()
if(${config_type} STREQUAL "DEBUG")
set(crt_type ${crt_type}d)
endif()
string(APPEND cross_${config_type}_log "b_vscrt = '${crt_type}'\n")
endif()
string(TOLOWER "${config_type}" lowerconfig)
set(native_config_name "${CURRENT_BUILDTREES_DIR}/meson-cross-${TARGET_TRIPLET}-${lowerconfig}.log")
set(VCPKG_MESON_CROSS_FILE_${config_type} "${native_config_name}" PARENT_SCOPE)
file(WRITE "${native_config_name}" "${cross_${config_type}_log}")
endfunction()
function(vcpkg_configure_meson)
# parse parameters such that semicolons in options arguments to COMMAND don't get erased
cmake_parse_arguments(PARSE_ARGV 0 arg
"NO_PKG_CONFIG"
"SOURCE_PATH"
"OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE;ADDITIONAL_NATIVE_BINARIES;ADDITIONAL_CROSS_BINARIES"
)
file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
z_vcpkg_get_cmake_vars(cmake_vars_file)
debug_message("Including cmake vars from: ${cmake_vars_file}")
include("${cmake_vars_file}")
vcpkg_find_acquire_program(MESON)
vcpkg_list(APPEND arg_OPTIONS --buildtype plain --backend ninja --wrap-mode nodownload)
if(NOT vcpkg_meson_cross_file)
z_vcpkg_meson_generate_cross_file("${arg_ADDITIONAL_CROSS_BINARIES}")
endif()
# We must use uppercase `DEBUG` and `RELEASE` here because they matches the configuration data
if(NOT VCPKG_MESON_CROSS_FILE_DEBUG AND vcpkg_meson_cross_file)
z_vcpkg_meson_generate_cross_file_config(DEBUG)
endif()
if(NOT VCPKG_MESON_CROSS_FILE_RELEASE AND vcpkg_meson_cross_file)
z_vcpkg_meson_generate_cross_file_config(RELEASE)
endif()
if(vcpkg_meson_cross_file)
vcpkg_list(APPEND arg_OPTIONS --cross "${vcpkg_meson_cross_file}")
endif()
if(VCPKG_MESON_CROSS_FILE_DEBUG)
vcpkg_list(APPEND arg_OPTIONS_DEBUG --cross "${VCPKG_MESON_CROSS_FILE_DEBUG}")
endif()
if(VCPKG_MESON_CROSS_FILE_RELEASE)
vcpkg_list(APPEND arg_OPTIONS_RELEASE --cross "${VCPKG_MESON_CROSS_FILE_RELEASE}")
endif()
if(NOT vcpkg_meson_native_file AND NOT vcpkg_meson_cross_file)
z_vcpkg_meson_generate_native_file("${arg_ADDITIONAL_NATIVE_BINARIES}")
endif()
if(NOT vcpkg_meson_native_file_DEBUG AND NOT vcpkg_meson_cross_file)
z_vcpkg_meson_generate_native_file_config(DEBUG)
endif()
if(NOT vcpkg_meson_native_file_RELEASE AND NOT vcpkg_meson_cross_file)
z_vcpkg_meson_generate_native_file_config(RELEASE)
endif()
if(vcpkg_meson_native_file AND NOT vcpkg_meson_cross_file)
vcpkg_list(APPEND arg_OPTIONS --native "${vcpkg_meson_native_file}")
vcpkg_list(APPEND arg_OPTIONS_DEBUG --native "${vcpkg_meson_native_file_DEBUG}")
vcpkg_list(APPEND arg_OPTIONS_RELEASE --native "${vcpkg_meson_native_file_RELEASE}")
else()
vcpkg_list(APPEND arg_OPTIONS --native "${SCRIPTS}/buildsystems/meson/none.txt")
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
vcpkg_list(APPEND arg_OPTIONS --default-library shared)
else()
vcpkg_list(APPEND arg_OPTIONS --default-library static)
endif()
vcpkg_list(APPEND arg_OPTIONS --libdir lib) # else meson install into an architecture describing folder
vcpkg_list(APPEND arg_OPTIONS_DEBUG -Ddebug=true --prefix "${CURRENT_PACKAGES_DIR}/debug" --includedir ../include)
vcpkg_list(APPEND arg_OPTIONS_RELEASE -Ddebug=false --prefix "${CURRENT_PACKAGES_DIR}")
# select meson cmd-line options
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_list(APPEND arg_OPTIONS_DEBUG "-Dcmake_prefix_path=['${CURRENT_INSTALLED_DIR}/debug','${CURRENT_INSTALLED_DIR}','${CURRENT_INSTALLED_DIR}/share']")
vcpkg_list(APPEND arg_OPTIONS_RELEASE "-Dcmake_prefix_path=['${CURRENT_INSTALLED_DIR}','${CURRENT_INSTALLED_DIR}/debug','${CURRENT_INSTALLED_DIR}/share']")
else()
vcpkg_list(APPEND arg_OPTIONS_DEBUG "-Dcmake_prefix_path=['${CURRENT_INSTALLED_DIR}/debug','${CURRENT_INSTALLED_DIR}']")
vcpkg_list(APPEND arg_OPTIONS_RELEASE "-Dcmake_prefix_path=['${CURRENT_INSTALLED_DIR}','${CURRENT_INSTALLED_DIR}/debug']")
endif()
set(buildtypes)
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
set(buildname "DEBUG")
vcpkg_list(APPEND buildtypes ${buildname})
set(path_suffix_${buildname} "debug/")
set(suffix_${buildname} "dbg")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
set(buildname "RELEASE")
vcpkg_list(APPEND buildtypes ${buildname})
set(path_suffix_${buildname} "")
set(suffix_${buildname} "rel")
endif()
vcpkg_backup_env_variables(VARS INCLUDE)
vcpkg_host_path_list(APPEND ENV{INCLUDE} "${CURRENT_INSTALLED_DIR}/include")
# configure build
foreach(buildtype IN LISTS buildtypes)
message(STATUS "Configuring ${TARGET_TRIPLET}-${suffix_${buildtype}}")
file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${suffix_${buildtype}}")
#setting up PKGCONFIG
if(NOT arg_NO_PKG_CONFIG)
if ("${buildtype}" STREQUAL "DEBUG")
z_vcpkg_setup_pkgconfig_path(BASE_DIRS "${CURRENT_INSTALLED_DIR}/debug")
else()
z_vcpkg_setup_pkgconfig_path(BASE_DIRS "${CURRENT_INSTALLED_DIR}")
endif()
endif()
vcpkg_execute_required_process(
COMMAND ${MESON} ${arg_OPTIONS} ${arg_OPTIONS_${buildtype}} ${arg_SOURCE_PATH}
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${suffix_${buildtype}}"
LOGNAME config-${TARGET_TRIPLET}-${suffix_${buildtype}}
)
#Copy meson log files into buildtree for CI
if(EXISTS "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${suffix_${buildtype}}/meson-logs/meson-log.txt")
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${suffix_${buildtype}}/meson-logs/meson-log.txt" DESTINATION "${CURRENT_BUILDTREES_DIR}")
file(RENAME "${CURRENT_BUILDTREES_DIR}/meson-log.txt" "${CURRENT_BUILDTREES_DIR}/meson-log-${suffix_${buildtype}}.log")
endif()
if(EXISTS "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${suffix_${buildtype}}/meson-info/intro-dependencies.json")
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${suffix_${buildtype}}/meson-info/intro-dependencies.json" DESTINATION "${CURRENT_BUILDTREES_DIR}")
file(RENAME "${CURRENT_BUILDTREES_DIR}/intro-dependencies.json" "${CURRENT_BUILDTREES_DIR}/intro-dependencies-${suffix_${buildtype}}.log")
endif()
if(EXISTS "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${suffix_${buildtype}}/meson-logs/install-log.txt")
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${suffix_${buildtype}}/meson-logs/install-log.txt" DESTINATION "${CURRENT_BUILDTREES_DIR}")
file(RENAME "${CURRENT_BUILDTREES_DIR}/install-log.txt" "${CURRENT_BUILDTREES_DIR}/install-log-${suffix_${buildtype}}.log")
endif()
message(STATUS "Configuring ${TARGET_TRIPLET}-${suffix_${buildtype}} done")
if(NOT arg_NO_PKG_CONFIG)
z_vcpkg_restore_pkgconfig_path()
endif()
endforeach()
vcpkg_restore_env_variables(VARS INCLUDE)
endfunction()

View File

@@ -1,100 +0,0 @@
function(vcpkg_configure_qmake)
# parse parameters such that semicolons in options arguments to COMMAND don't get erased
cmake_parse_arguments(PARSE_ARGV 0 arg
""
"SOURCE_PATH"
"OPTIONS;OPTIONS_RELEASE;OPTIONS_DEBUG;BUILD_OPTIONS;BUILD_OPTIONS_RELEASE;BUILD_OPTIONS_DEBUG"
)
# Find qmake executable
find_program(qmake_executable NAMES qmake PATHS "${CURRENT_HOST_INSTALLED_DIR}/tools/qt5/bin" NO_DEFAULT_PATH)
if(NOT qmake_executable)
message(FATAL_ERROR "vcpkg_configure_qmake: unable to find qmake.")
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
vcpkg_list(APPEND arg_OPTIONS "CONFIG-=shared" "CONFIG*=static")
else()
vcpkg_list(APPEND arg_OPTIONS "CONFIG-=static" "CONFIG*=shared")
vcpkg_list(APPEND arg_OPTIONS_DEBUG "CONFIG*=separate_debug_info")
endif()
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_CRT_LINKAGE STREQUAL "static")
vcpkg_list(APPEND arg_OPTIONS "CONFIG*=static-runtime")
endif()
if(DEFINED VCPKG_OSX_DEPLOYMENT_TARGET)
set(ENV{QMAKE_MACOSX_DEPLOYMENT_TARGET} ${VCPKG_OSX_DEPLOYMENT_TARGET})
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
z_vcpkg_setup_pkgconfig_path(BASE_DIRS "${CURRENT_INSTALLED_DIR}" "${CURRENT_PACKAGES_DIR}")
set(current_binary_dir "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
# Cleanup build directories
file(REMOVE_RECURSE "${current_binary_dir}")
configure_file("${CURRENT_INSTALLED_DIR}/tools/qt5/qt_release.conf" "${current_binary_dir}/qt.conf")
message(STATUS "Configuring ${TARGET_TRIPLET}-rel")
file(MAKE_DIRECTORY "${current_binary_dir}")
vcpkg_list(SET build_opt_param)
if(DEFINED arg_BUILD_OPTIONS OR DEFINED arg_BUILD_OPTIONS_RELEASE)
vcpkg_list(SET build_opt_param -- ${arg_BUILD_OPTIONS} ${arg_BUILD_OPTIONS_RELEASE})
endif()
vcpkg_execute_required_process(
COMMAND "${qmake_executable}" CONFIG-=debug CONFIG+=release
${arg_OPTIONS} ${arg_OPTIONS_RELEASE} ${arg_SOURCE_PATH}
-qtconf "${current_binary_dir}/qt.conf"
${build_opt_param}
WORKING_DIRECTORY "${current_binary_dir}"
LOGNAME "config-${TARGET_TRIPLET}-rel"
)
message(STATUS "Configuring ${TARGET_TRIPLET}-rel done")
if(EXISTS "${current_binary_dir}/config.log")
file(REMOVE "${CURRENT_BUILDTREES_DIR}/internal-config-${TARGET_TRIPLET}-rel.log")
file(RENAME "${current_binary_dir}/config.log" "${CURRENT_BUILDTREES_DIR}/internal-config-${TARGET_TRIPLET}-rel.log")
endif()
z_vcpkg_restore_pkgconfig_path()
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
z_vcpkg_setup_pkgconfig_path(BASE_DIRS "${CURRENT_INSTALLED_DIR}/debug" "${CURRENT_PACKAGES_DIR}/debug")
set(current_binary_dir "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
# Cleanup build directories
file(REMOVE_RECURSE "${current_binary_dir}")
configure_file("${CURRENT_INSTALLED_DIR}/tools/qt5/qt_debug.conf" "${current_binary_dir}/qt.conf")
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg")
file(MAKE_DIRECTORY "${current_binary_dir}")
vcpkg_list(SET build_opt_param)
if(DEFINED arg_BUILD_OPTIONS OR DEFINED arg_BUILD_OPTIONS_DEBUG)
vcpkg_list(SET build_opt_param -- ${arg_BUILD_OPTIONS} ${arg_BUILD_OPTIONS_DEBUG})
endif()
vcpkg_execute_required_process(
COMMAND "${qmake_executable}" CONFIG-=release CONFIG+=debug
${arg_OPTIONS} ${arg_OPTIONS_DEBUG} ${arg_SOURCE_PATH}
-qtconf "${current_binary_dir}/qt.conf"
${build_opt_param}
WORKING_DIRECTORY "${current_binary_dir}"
LOGNAME "config-${TARGET_TRIPLET}-dbg"
)
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg done")
if(EXISTS "${current_binary_dir}/config.log")
file(REMOVE "${CURRENT_BUILDTREES_DIR}/internal-config-${TARGET_TRIPLET}-dbg.log")
file(RENAME "${current_binary_dir}/config.log" "${CURRENT_BUILDTREES_DIR}/internal-config-${TARGET_TRIPLET}-dbg.log")
endif()
z_vcpkg_restore_pkgconfig_path()
endif()
endfunction()

View File

@@ -1,49 +0,0 @@
function(vcpkg_copy_pdbs)
cmake_parse_arguments(PARSE_ARGV 0 "arg" "" "" "BUILD_PATHS")
if(DEFINED arg_UNPARSED_ARGUMENTS)
message(WARNING "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
endif()
if(NOT DEFINED arg_BUILD_PATHS)
set(arg_BUILD_PATHS
"${CURRENT_PACKAGES_DIR}/bin/*.dll"
"${CURRENT_PACKAGES_DIR}/debug/bin/*.dll"
)
endif()
set(dlls_without_matching_pdbs "")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic" AND VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
file(GLOB_RECURSE dlls ${arg_BUILD_PATHS})
set(vslang_backup "$ENV{VSLANG}")
set(ENV{VSLANG} 1033)
foreach(dll IN LISTS dlls)
execute_process(COMMAND dumpbin /PDBPATH "${dll}"
COMMAND findstr PDB
OUTPUT_VARIABLE pdb_line
ERROR_QUIET
RESULT_VARIABLE error_code
)
if(error_code EQUAL "0" AND pdb_line MATCHES "PDB file found at.*'(.*)'")
set(pdb_path "${CMAKE_MATCH_1}")
cmake_path(GET dll PARENT_PATH dll_dir)
file(COPY "${pdb_path}" DESTINATION "${dll_dir}")
else()
list(APPEND dlls_without_matching_pdbs "${dll}")
endif()
endforeach()
set(ENV{VSLANG} "${vslang_backup}")
if(NOT dlls_without_matching_pdbs STREQUAL "")
list(JOIN dlls_without_matching_pdbs "\n " message)
message(WARNING "Could not find a matching pdb file for:
${message}\n")
endif()
endif()
endfunction()

View File

@@ -1,45 +0,0 @@
function(z_vcpkg_copy_tool_dependencies_search tool_dir path_to_search)
if(DEFINED Z_VCPKG_COPY_TOOL_DEPENDENCIES_COUNT)
set(count ${Z_VCPKG_COPY_TOOL_DEPENDENCIES_COUNT})
else()
set(count 0)
endif()
file(GLOB tools "${tool_dir}/*.exe" "${tool_dir}/*.dll" "${tool_dir}/*.pyd")
foreach(tool IN LISTS tools)
vcpkg_execute_required_process(
COMMAND "${Z_VCPKG_POWERSHELL_CORE}" -noprofile -executionpolicy Bypass -nologo
-file "${SCRIPTS}/buildsystems/msbuild/applocal.ps1"
-targetBinary "${tool}"
-installedDir "${path_to_search}"
-verbose
WORKING_DIRECTORY "${VCPKG_ROOT_DIR}"
LOGNAME copy-tool-dependencies-${count}
)
math(EXPR count "${count} + 1")
endforeach()
set(Z_VCPKG_COPY_TOOL_DEPENDENCIES_COUNT ${count} CACHE INTERNAL "")
endfunction()
function(vcpkg_copy_tool_dependencies tool_dir)
if(ARGC GREATER 1)
message(WARNING "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${ARGN}")
endif()
if(VCPKG_TARGET_IS_WINDOWS)
find_program(Z_VCPKG_POWERSHELL_CORE pwsh)
if (NOT Z_VCPKG_POWERSHELL_CORE)
message(FATAL_ERROR "Could not find PowerShell Core; please open an issue to report this.")
endif()
cmake_path(RELATIVE_PATH tool_dir
BASE_DIRECTORY "${CURRENT_PACKAGES_DIR}"
OUTPUT_VARIABLE relative_tool_dir
)
if(relative_tool_dir MATCHES "/debug/")
z_vcpkg_copy_tool_dependencies_search("${tool_dir}" "${CURRENT_PACKAGES_DIR}/debug/bin")
z_vcpkg_copy_tool_dependencies_search("${tool_dir}" "${CURRENT_INSTALLED_DIR}/debug/bin")
else()
z_vcpkg_copy_tool_dependencies_search("${tool_dir}" "${CURRENT_PACKAGES_DIR}/bin")
z_vcpkg_copy_tool_dependencies_search("${tool_dir}" "${CURRENT_INSTALLED_DIR}/bin")
endif()
endif()
endfunction()

View File

@@ -1,49 +0,0 @@
function(vcpkg_copy_tools)
cmake_parse_arguments(PARSE_ARGV 0 arg "AUTO_CLEAN" "SEARCH_DIR;DESTINATION" "TOOL_NAMES")
if(DEFINED arg_UNPARSED_ARGUMENTS)
message(WARNING "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
endif()
if(NOT DEFINED arg_TOOL_NAMES)
message(FATAL_ERROR "TOOL_NAMES must be specified.")
endif()
if(NOT DEFINED arg_DESTINATION)
set(arg_DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
endif()
if(NOT DEFINED arg_SEARCH_DIR)
set(arg_SEARCH_DIR "${CURRENT_PACKAGES_DIR}/bin")
elseif(NOT IS_DIRECTORY "${arg_SEARCH_DIR}")
message(FATAL_ERROR "SEARCH_DIR (${arg_SEARCH_DIR}) must be a directory")
endif()
foreach(tool_name IN LISTS arg_TOOL_NAMES)
set(tool_path "${arg_SEARCH_DIR}/${tool_name}${VCPKG_TARGET_EXECUTABLE_SUFFIX}")
set(tool_pdb "${arg_SEARCH_DIR}/${tool_name}.pdb")
if(EXISTS "${tool_path}")
file(COPY "${tool_path}" DESTINATION "${arg_DESTINATION}")
elseif(NOT "${VCPKG_TARGET_BUNDLE_SUFFIX}" STREQUAL "" AND NOT "${VCPKG_TARGET_BUNDLE_SUFFIX}" STREQUAL "${VCPKG_TARGET_EXECUTABLE_SUFFIX}")
set(bundle_path "${arg_SEARCH_DIR}/${tool_name}${VCPKG_TARGET_BUNDLE_SUFFIX}")
if(EXISTS "${bundle_path}")
file(COPY "${bundle_path}" DESTINATION "${arg_DESTINATION}")
else()
message(FATAL_ERROR "Couldn't find tool \"${tool_name}\":
neither \"${tool_path}\" nor \"${bundle_path}\" exists")
endif()
else()
message(FATAL_ERROR "Couldn't find tool \"${tool_name}\":
\"${tool_path}\" does not exist")
endif()
if(EXISTS "${tool_pdb}")
file(COPY "${tool_pdb}" DESTINATION "${arg_DESTINATION}")
endif()
endforeach()
if(arg_AUTO_CLEAN)
vcpkg_clean_executables_in_bin(FILE_NAMES ${arg_TOOL_NAMES})
endif()
vcpkg_copy_tool_dependencies("${arg_DESTINATION}")
endfunction()

View File

@@ -1,254 +0,0 @@
function(z_vcpkg_download_distfile_test_hash file_path kind error_advice sha512 skip_sha512)
if(_VCPKG_INTERNAL_NO_HASH_CHECK)
# When using the internal hash skip, do not output an explicit message.
return()
endif()
if(skip_sha512)
message(STATUS "Skipping hash check for ${file_path}.")
return()
endif()
file(SHA512 "${file_path}" file_hash)
string(TOLOWER "${sha512}" sha512_lower)
if(NOT "${file_hash}" STREQUAL "${sha512_lower}")
message(FATAL_ERROR
"\nFile does not have expected hash:\n"
" File path: [ ${file_path} ]\n"
" Expected hash: [ ${sha512} ]\n"
" Actual hash: [ ${file_hash} ]\n"
"${error_advice}\n")
endif()
endfunction()
function(z_vcpkg_download_distfile_show_proxy_and_fail error_code)
message(FATAL_ERROR
" \n"
" Failed to download file with error: ${error_code}\n"
" If you use a proxy, please check your proxy setting. Possible causes are:\n"
" \n"
" 1. You are actually using an HTTP proxy, but setting HTTPS_PROXY variable\n"
" to `https://address:port`. This is not correct, because `https://` prefix\n"
" claims the proxy is an HTTPS proxy, while your proxy (v2ray, shadowsocksr\n"
" , etc..) is an HTTP proxy. Try setting `http://address:port` to both\n"
" HTTP_PROXY and HTTPS_PROXY instead.\n"
" \n"
" 2. You are using Fiddler. Currently a bug (https://github.com/microsoft/vcpkg/issues/17752)\n"
" will set HTTPS_PROXY to `https://fiddler_address:port` which lead to problem 1 above.\n"
" Workaround is open Windows 10 Settings App, and search for Proxy Configuration page,\n"
" Change `http=address:port;https=address:port` to `address`, and fill the port number.\n"
" \n"
" 3. Your proxy's remote server is out of service.\n"
" \n"
" In future vcpkg releases, if you are using Windows, you no longer need to set\n"
" HTTP(S)_PROXY environment variables. Vcpkg will simply apply Windows IE Proxy\n"
" Settings set by your proxy software. See (https://github.com/microsoft/vcpkg-tool/pull/49)\n"
" and (https://github.com/microsoft/vcpkg-tool/pull/77)\n"
" \n"
" Otherwise, please submit an issue at https://github.com/Microsoft/vcpkg/issues\n")
endfunction()
function(z_vcpkg_download_distfile_via_aria)
cmake_parse_arguments(PARSE_ARGV 1 arg
"SKIP_SHA512"
"FILENAME;SHA512"
"URLS;HEADERS"
)
message(STATUS "Downloading ${arg_FILENAME}...")
vcpkg_list(SET headers_param)
foreach(header IN LISTS arg_HEADERS)
vcpkg_list(APPEND headers_param "--header=${header}")
endforeach()
foreach(URL IN LISTS arg_URLS)
debug_message("Download Command: ${ARIA2} ${URL} -o temp/${filename} -l download-${filename}-detailed.log ${headers_param}")
vcpkg_execute_in_download_mode(
COMMAND ${ARIA2} ${URL}
-o temp/${arg_FILENAME}
-l download-${arg_FILENAME}-detailed.log
${headers_param}
OUTPUT_FILE download-${arg_FILENAME}-out.log
ERROR_FILE download-${arg_FILENAME}-err.log
RESULT_VARIABLE error_code
WORKING_DIRECTORY "${DOWNLOADS}"
)
if ("${error_code}" STREQUAL "0")
break()
endif()
endforeach()
if (NOT "${error_code}" STREQUAL "0")
message(STATUS
"Downloading ${arg_FILENAME}... Failed.\n"
" Exit Code: ${error_code}\n"
" See logs for more information:\n"
" ${DOWNLOADS}/download-${arg_FILENAME}-out.log\n"
" ${DOWNLOADS}/download-${arg_FILENAME}-err.log\n"
" ${DOWNLOADS}/download-${arg_FILENAME}-detailed.log\n"
)
z_vcpkg_download_distfile_show_proxy_and_fail("${error_code}")
else()
z_vcpkg_download_distfile_test_hash(
"${DOWNLOADS}/temp/${arg_FILENAME}"
"downloaded file"
"The file may have been corrupted in transit."
"${arg_SHA512}"
${arg_SKIP_SHA512}
)
file(REMOVE
${DOWNLOADS}/download-${arg_FILENAME}-out.log
${DOWNLOADS}/download-${arg_FILENAME}-err.log
${DOWNLOADS}/download-${arg_FILENAME}-detailed.log
)
get_filename_component(downloaded_file_dir "${downloaded_file_path}" DIRECTORY)
file(MAKE_DIRECTORY "${downloaded_file_dir}")
file(RENAME "${DOWNLOADS}/temp/${arg_FILENAME}" "${downloaded_file_path}")
endif()
endfunction()
function(vcpkg_download_distfile out_var)
cmake_parse_arguments(PARSE_ARGV 1 arg
"SKIP_SHA512;SILENT_EXIT;QUIET;ALWAYS_REDOWNLOAD"
"FILENAME;SHA512"
"URLS;HEADERS"
)
if(NOT DEFINED arg_URLS)
message(FATAL_ERROR "vcpkg_download_distfile requires a URLS argument.")
endif()
if(NOT DEFINED arg_FILENAME)
message(FATAL_ERROR "vcpkg_download_distfile requires a FILENAME argument.")
endif()
if(arg_SILENT_EXIT)
message(WARNING "SILENT_EXIT has been deprecated as an argument to vcpkg_download_distfile -- remove the argument to resolve this warning")
endif()
if(arg_ALWAYS_REDOWNLOAD AND NOT arg_SKIP_SHA512)
message(FATAL_ERROR "ALWAYS_REDOWNLOAD option requires SKIP_SHA512 as well")
endif()
if(NOT arg_SKIP_SHA512 AND NOT DEFINED arg_SHA512)
message(FATAL_ERROR "vcpkg_download_distfile requires a SHA512 argument.
If you do not know the SHA512, add it as 'SHA512 0' and re-run this command.")
elseif(arg_SKIP_SHA512 AND DEFINED arg_SHA512)
message(FATAL_ERROR "vcpkg_download_distfile must not be passed both SHA512 and SKIP_SHA512.")
endif()
if(_VCPKG_INTERNAL_NO_HASH_CHECK)
set(arg_SKIP_SHA512 1)
endif()
if(NOT arg_SKIP_SHA512)
if("${arg_SHA512}" STREQUAL "0")
string(REPEAT 0 128 arg_SHA512)
else()
string(LENGTH "${arg_SHA512}" arg_SHA512_length)
if(NOT "${arg_SHA512_length}" EQUAL "128" OR NOT "${arg_SHA512}" MATCHES "^[a-zA-Z0-9]*$")
message(FATAL_ERROR "Invalid SHA512: ${arg_SHA512}.
If you do not know the file's SHA512, set this to \"0\".")
endif()
endif()
endif()
set(downloaded_file_path "${DOWNLOADS}/${arg_FILENAME}")
set(download_file_path_part "${DOWNLOADS}/temp/${arg_FILENAME}")
# Works around issue #3399
# Delete "temp0" directory created by the old version of vcpkg
file(REMOVE_RECURSE "${DOWNLOADS}/temp0")
file(REMOVE_RECURSE "${DOWNLOADS}/temp")
file(MAKE_DIRECTORY "${DOWNLOADS}/temp")
# check if file with same name already exists in downloads
if(EXISTS "${downloaded_file_path}")
set(advice_message "The cached file SHA512 doesn't match. The file may have been corrupted.")
if(_VCPKG_NO_DOWNLOADS)
string(APPEND advice_message " Downloads are disabled please provide a valid file at path ${downloaded_file_path} and retry.")
else()
string(APPEND advice_message " To re-download this file please delete cached file at path ${downloaded_file_path} and retry.")
endif()
z_vcpkg_download_distfile_test_hash(
"${downloaded_file_path}"
"cached file"
"${advice_message}"
"${arg_SHA512}"
"${arg_SKIP_SHA512}"
)
if(NOT vcpkg_download_distfile_QUIET)
message(STATUS "Using cached ${arg_FILENAME}.")
endif()
# Suppress the "Downloading ${arg_URLS} -> ${arg_FILENAME}..." message
set(vcpkg_download_distfile_QUIET TRUE)
endif()
# vcpkg_download_distfile_ALWAYS_REDOWNLOAD only triggers when NOT _VCPKG_NO_DOWNLOADS
# this could be de-morgan'd out but it's more clear this way
if(_VCPKG_NO_DOWNLOADS)
if(NOT EXISTS "${downloaded_file_path}")
message(FATAL_ERROR "Downloads are disabled, but '${downloaded_file_path}' does not exist.")
endif()
set("${out_var}" "${downloaded_file_path}" PARENT_SCOPE)
return()
endif()
if(NOT arg_DISABLE_ARIA2 AND _VCPKG_DOWNLOAD_TOOL STREQUAL "ARIA2" AND NOT EXISTS "${downloaded_file_path}")
if (arg_SKIP_SHA512)
set(OPTION_SKIP_SHA512 "SKIP_SHA512")
endif()
z_vcpkg_download_distfile_via_aria(
"${OPTION_SKIP_SHA512}"
FILENAME "${arg_FILENAME}"
SHA512 "${arg_SHA512}"
URLS "${arg_URLS}"
HEADERS "${arg_HEADERS}"
)
set("${out_var}" "${downloaded_file_path}" PARENT_SCOPE)
return()
endif()
vcpkg_list(SET urls_param)
foreach(url IN LISTS arg_URLS)
vcpkg_list(APPEND urls_param "--url=${url}")
endforeach()
if(NOT vcpkg_download_distfile_QUIET)
message(STATUS "Downloading ${arg_URLS} -> ${arg_FILENAME}...")
endif()
vcpkg_list(SET headers_param)
foreach(header IN LISTS arg_HEADERS)
list(APPEND headers_param "--header=${header}")
endforeach()
if(arg_SKIP_SHA512)
vcpkg_list(SET sha512_param "--skip-sha512")
else()
vcpkg_list(SET sha512_param "--sha512=${arg_SHA512}")
endif()
if(NOT EXISTS "${downloaded_file_path}" OR arg_ALWAYS_REDOWNLOAD)
vcpkg_execute_in_download_mode(
COMMAND "$ENV{VCPKG_COMMAND}" x-download
"${downloaded_file_path}"
${sha512_param}
${urls_param}
${headers_param}
--debug
--feature-flags=-manifests # there's a bug in vcpkg x-download when it finds a manifest-root
OUTPUT_VARIABLE output
ERROR_VARIABLE output
RESULT_VARIABLE error_code
WORKING_DIRECTORY "${DOWNLOADS}"
)
if(NOT "${error_code}" EQUAL "0")
message("${output}")
z_vcpkg_download_distfile_show_proxy_and_fail("${error_code}")
endif()
endif()
set("${out_var}" "${downloaded_file_path}" PARENT_SCOPE)
endfunction()

Some files were not shown because too many files have changed in this diff Show More