early-access version 2853

This commit is contained in:
pineappleEA
2022-07-23 03:01:36 +02:00
parent 1f2b5081b5
commit 1f111bb69c
8955 changed files with 418777 additions and 999 deletions

View File

@@ -0,0 +1,104 @@
#!/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

@@ -0,0 +1,128 @@
#! /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

@@ -0,0 +1,19 @@
# 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

@@ -0,0 +1,378 @@
[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/0I6uoDwj0NJOo1KrVQqO7ggRXccklyTrWL4xMShjIou2I
# sbYnF67wXzVAq5Om4oe+LfzSD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F68aMrdSGvI
# e4eO5pJEHRGkimm9Mm44QCLrxx0zbQIU16GBOWbSyD/oy54MkOreoiIuWhCVS6lN
# oJrOEaFbCsrUVMcGAc13YgcLbCw0V/YZNRLMakT9sbjYqfn4xRE3DO8PmyHlzDw8
# g6CzIZQExAVkyxY+ZHXf8HcR5n3DHfLGMxCu7o4O7+os0axGBrdSmHJBVuSF+0Q3
# 0OaF2MDIrMNYfhlQt5DxB2sw8EnyLctrW2Ve7wuq02gBM+BT2Ln66a9wzNK7HPKs
# rSkQg2stGl0hoCRPZ9geSm++3pbtFhzUMosPpfA9mirBELDpWg5YRF9gftRdUfJZ
# bLYStWVOB5OFNv2LpxoOdvVzqiigK3+LRrnlcWxPt6/6QqlC5EIFYOkMUw==
# SIG # End signature block

View File

@@ -0,0 +1,80 @@
<?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

@@ -0,0 +1,21 @@
<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

@@ -0,0 +1,210 @@
<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

@@ -0,0 +1,425 @@
#!/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

@@ -0,0 +1,861 @@
# 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)