diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/scripts/buildsystems | |
Diffstat (limited to 'vcpkg/scripts/buildsystems')
| -rw-r--r-- | vcpkg/scripts/buildsystems/make_wrapper/cl_cpp_wrapper | 99 | ||||
| -rwxr-xr-x | vcpkg/scripts/buildsystems/make_wrapper/windres-rc | 133 | ||||
| -rw-r--r-- | vcpkg/scripts/buildsystems/meson/meson.template.in | 42 | ||||
| -rw-r--r-- | vcpkg/scripts/buildsystems/meson/none.txt | 19 | ||||
| -rw-r--r-- | vcpkg/scripts/buildsystems/msbuild/applocal.ps1 | 381 | ||||
| -rw-r--r-- | vcpkg/scripts/buildsystems/msbuild/vcpkg-general.xml | 97 | ||||
| -rw-r--r-- | vcpkg/scripts/buildsystems/msbuild/vcpkg.props | 47 | ||||
| -rw-r--r-- | vcpkg/scripts/buildsystems/msbuild/vcpkg.targets | 259 | ||||
| -rw-r--r-- | vcpkg/scripts/buildsystems/osx/applocal.py | 425 | ||||
| -rw-r--r-- | vcpkg/scripts/buildsystems/vcpkg.cmake | 952 |
10 files changed, 2454 insertions, 0 deletions
diff --git a/vcpkg/scripts/buildsystems/make_wrapper/cl_cpp_wrapper b/vcpkg/scripts/buildsystems/make_wrapper/cl_cpp_wrapper new file mode 100644 index 0000000..a9ec77f --- /dev/null +++ b/vcpkg/scripts/buildsystems/make_wrapper/cl_cpp_wrapper @@ -0,0 +1,99 @@ +#!/usr/bin/bash + +# cl_cpp_wrapper +# Wrapper around MS's cl.exe to make it act more like Unix cpp, +# in particular process stdin + +PATH="$PATH:/usr/bin" + +msys2_dll="$(test -f /usr/bin/msys-2.0.dll && echo yes)" + +case $msys2_dll,$MACHTYPE in + *-msys | yes,*-cygwin) + 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 + # CL does not support reading from STDIN so it is wrapped here. + tmpout=cpp_wrapper_$RANDOM.h + /usr/bin/cp $input_file $tmpout + exec $prog ${cppopt[@]} $tmpout + rm -f $tmpout +else + exec $prog ${cppopt[@]} $input_file +fi + diff --git a/vcpkg/scripts/buildsystems/make_wrapper/windres-rc b/vcpkg/scripts/buildsystems/make_wrapper/windres-rc new file mode 100755 index 0000000..9d20158 --- /dev/null +++ b/vcpkg/scripts/buildsystems/make_wrapper/windres-rc @@ -0,0 +1,133 @@ +#! /bin/sh +# Wrapper for windres to rc which do not understand '-i -o --output-format'. +# cvtres is invoked by the linker +scriptversion=2022-08-24.12; # 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 + bin= + in= + out= + + for arg + do + if test -z "$bin"; then + bin=$1 + elif test -n "$eat"; then + eat= + else + case $1 in + --output-format=*) + ;; + --define*) + eat=1 + set -- "$@" "-d $2" + ;; + --include-dir*) + eat=1 + func_file_conv "$2" + set -- "$@" "-I $file" + ;; + -o) + eat=1 + func_file_conv "$2" + out="$file" + echo "OUTPUT:$file" + ;; + *.obj) + func_file_conv "$1" + out="$file" + echo "OUTPUT:$file" + ;; + -i) + eat=1 + func_file_conv "$2" mingw + in="$file" + echo "INPUT:$file" + ;; + -*) + set -- "$@" "${1//\\\"/\"}" + ;; + *) + # libtool reorders arguments; save unqualified one as input + func_file_conv "$1" + in="$file" + echo "INPUT:$file" + ;; + esac + fi + shift + done + echo "$bin" "$@" -fo "$out" "$in" + exec "$bin" "$@" -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: diff --git a/vcpkg/scripts/buildsystems/meson/meson.template.in b/vcpkg/scripts/buildsystems/meson/meson.template.in new file mode 100644 index 0000000..995d39b --- /dev/null +++ b/vcpkg/scripts/buildsystems/meson/meson.template.in @@ -0,0 +1,42 @@ +[binaries]
+cmake = ['@CMAKE_COMMAND@']
+python = ['@PYTHON3@']
+ninja = ['@NINJA@']
+pkgconfig= ['@PKGCONFIG@']
+@MESON_MT@
+@MESON_AR@
+@MESON_RC@
+@MESON_C@
+@MESON_C_LD@
+@MESON_CXX@
+@MESON_CXX_LD@
+@MESON_OBJC@
+@MESON_OBJC_LD@
+@MESON_OBJCPP@
+@MESON_OBJCPP_LD@
+@MESON_FC@
+@MESON_FC_LD@
+@MESON_WINDRES@
+@MESON_ADDITIONAL_BINARIES@
+[properties]
+cmake_toolchain_file = '@SCRIPTS@/buildsystems/vcpkg.cmake'
+[cmake]
+VCPKG_TARGET_TRIPLET = '@TARGET_TRIPLET@'
+VCPKG_HOST_TRIPLET = '@_HOST_TRIPLET@'
+VCPKG_CHAINLOAD_TOOLCHAIN_FILE = '@VCPKG_CHAINLOAD_TOOLCHAIN_FILE@'
+VCPKG_CRT_LINKAGE = '@VCPKG_CRT_LINKAGE@'
+_VCPKG_INSTALLED_DIR = '@_VCPKG_INSTALLED_DIR@'
+@MESON_HOST_MACHINE@
+@MESON_BUILD_MACHINE@
+[built-in options]
+default_library = '@MESON_DEFAULT_LIBRARY@'
+werror = false
+@MESON_CFLAGS@
+@MESON_CXXFLAGS@
+@MESON_FCFLAGS@
+@MESON_OBJCFLAGS@
+@MESON_OBJCPPFLAGS@
+# b_vscrt
+@MESON_VSCRT_LINKAGE@
+# c_winlibs/cpp_winlibs
+@MESON_WINLIBS@
\ No newline at end of file diff --git a/vcpkg/scripts/buildsystems/meson/none.txt b/vcpkg/scripts/buildsystems/meson/none.txt new file mode 100644 index 0000000..6dafc80 --- /dev/null +++ b/vcpkg/scripts/buildsystems/meson/none.txt @@ -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']
\ No newline at end of file diff --git a/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 b/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 new file mode 100644 index 0000000..7b6ad10 --- /dev/null +++ b/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 @@ -0,0 +1,381 @@ +[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 $targetBinaryPath| ? { $_ -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
+# MIIoKgYJKoZIhvcNAQcCoIIoGzCCKBcCAQExDzANBglghkgBZQMEAgEFADB5Bgor
+# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
+# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCAPCoxRgOsQwKYR
+# diNJ8SfHF59GyFkX1iNO/sW50AoVpaCCDXYwggX0MIID3KADAgECAhMzAAAEBGx0
+# Bv9XKydyAAAAAAQEMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMRMwEQYD
+# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy
+# b3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMTH01pY3Jvc29mdCBDb2RlIFNpZ25p
+# bmcgUENBIDIwMTEwHhcNMjQwOTEyMjAxMTE0WhcNMjUwOTExMjAxMTE0WjB0MQsw
+# CQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9u
+# ZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMR4wHAYDVQQDExVNaWNy
+# b3NvZnQgQ29ycG9yYXRpb24wggEiMA0GCSqGSI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CQGA1UEAxMdTWljcm9zb2Z0IFRpbWUtU3RhbXAgUENBIDIw
+# MTACEzMAAAHr4BhstbbvOO0AAQAAAeswIgQgFL25G8cMbJo721Nr6Ya+Eu/TrhUP
+# fOiM1q5E8puXODswDQYJKoZIhvcNAQELBQAEggIAu9ymfRN7+ESWl0DWxVsUO5Nz
+# rZ9UNElXdTANL4CxzKjBsRaj7MAQyVPF9u8UjIHBenar8tO2QQozooAc48oahV5d
+# V8wmdxFOOXRrG7Hm2Bth5ETeUlagCD8avZ4mCiCWCR94IHWVZX0WrtHBs60nn/Ou
+# mL7FelZmzUBkqpwJuBH3KcLx6oix4REGMGzSRMzY01tQGWFu6M83O4bV0OIdZ7qD
+# m5xvRybREJIkV995bmNFoIbjei3VNs8xWaAo3UN3MWfX+qujqmIkO3DhQwSkACG0
+# aH1svjAVA6CMpCkWWddeaFXnCgMpr1MzGXuzCJH8DHY8MnlXnX4A1lVc6DQmRf2a
+# gfi1K37c7ktfsM1CZ6XYUJp19p1QgeaHNSHJusPhOzkN6bx13vgzODppmpPf94D0
+# 1v9YL+enSq6ePTZfe9bxkCaDB8MwEEC9nFy/3mTHacBniqgY81ymW8kCNgqDFsME
+# qdcoelRLY2MkJxPutT+CteNNHPP9X04Goy7X8UDFKqlgJEFai7psevUMiZ2F6hz/
+# lxv5nsbWDOl1OOisXcuwbAcFmKUdiNAz7AaP5LJ9OvjKg5SsYrhSgyqi5x5mGW8R
+# rjcZiCT+RSjLidBLbkW3gSmApmr7muRY4/yP7EREoXEQvH3vaukHBEyPxDe095TK
+# tIl2kFAoHb2cc1Cmr+A=
+# SIG # End signature block
diff --git a/vcpkg/scripts/buildsystems/msbuild/vcpkg-general.xml b/vcpkg/scripts/buildsystems/msbuild/vcpkg-general.xml new file mode 100644 index 0000000..af45f5c --- /dev/null +++ b/vcpkg/scripts/buildsystems/msbuild/vcpkg-general.xml @@ -0,0 +1,97 @@ +<?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> + + <BoolProperty Name="VcpkgApplocalDeps" DisplayName="App-locally deploy DLLs" Category="General" Default="true" + Description="Copies DLL dependencies from the vcpkg installed tree to the project output directory."> + <BoolProperty.DataSource> + <DataSource Persistence="ProjectFile" Label="Vcpkg" HasConfigurationCondition="false" /> + </BoolProperty.DataSource> + </BoolProperty> + + <BoolProperty Name="VcpkgXUseBuiltInApplocalDeps" DisplayName="Use built-in app-local deployment" Category="General" Default="false" + Description="(experimental) When copying DLL dependencies, use built-in-to-vcpkg implementation rather than PowerShell script."> + <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." /> + + <BoolProperty Name="VcpkgUseMD" DisplayName="Use Dynamic CRT" Category="Conditional" Default="false" + Description="Only effective if 'Use Static Libraries' is selected. Vcpkg can build static libraries compiled against MSVC runtime (e.g. x64-windows-static-md). This options changes the default triplet to use these static libraries by appending -md 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' or '-static-md' suffixes that may be added by the 'Use static libraries' and 'Use Dynamic CRT' flags." /> + + <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> diff --git a/vcpkg/scripts/buildsystems/msbuild/vcpkg.props b/vcpkg/scripts/buildsystems/msbuild/vcpkg.props new file mode 100644 index 0000000..a2f8adc --- /dev/null +++ b/vcpkg/scripts/buildsystems/msbuild/vcpkg.props @@ -0,0 +1,47 @@ +<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>
+ </PropertyGroup>
+
+ <!-- Set the default value of $(VcpkgConfiguration) according to $(UseDebugLibraries) and $(Configuration) -->
+ <Choose>
+ <When Condition="'$(VcpkgConfiguration)' != ''" />
+ <When Condition="'$(UseDebugLibraries)' == ''">
+ <PropertyGroup>
+ <VcpkgConfiguration>$(Configuration)</VcpkgConfiguration>
+ </PropertyGroup>
+ </When>
+ <When Condition="'$(UseDebugLibraries)' == 'true'">
+ <PropertyGroup>
+ <VcpkgConfiguration>Debug</VcpkgConfiguration>
+ </PropertyGroup>
+ </When>
+ <Otherwise>
+ <PropertyGroup>
+ <VcpkgConfiguration>Release</VcpkgConfiguration>
+ </PropertyGroup>
+ </Otherwise>
+ </Choose>
+
+ <PropertyGroup>
+ <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' OR '$(PlatformToolset.ToLower())' == 'clangcl'">false</VcpkgAutoLink>
+ <VcpkgApplocalDeps Condition="'$(VcpkgApplocalDeps)' == ''">true</VcpkgApplocalDeps>
+ <VcpkgXUseBuiltInApplocalDeps Condition="'$(VcpkgXUseBuiltInApplocalDeps)' == ''">false</VcpkgXUseBuiltInApplocalDeps>
+
+ <!-- Classic Mode: The following line is edited by the mint standalone bundle script to be false for standlone copies -->
+ <VcpkgEnableClassic Condition="'$(VcpkgEnableClassic)' == ''">true</VcpkgEnableClassic>
+
+ <!-- Manifest files -->
+ <VcpkgEnableManifest Condition="'$(VcpkgEnableManifest)' == ''">false</VcpkgEnableManifest>
+ <VcpkgManifestInstall Condition="'$(VcpkgManifestInstall)' == ''">true</VcpkgManifestInstall>
+ <VcpkgManifestRoot Condition="'$(VcpkgManifestRoot)' == ''">$([MSbuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), vcpkg.json))</VcpkgManifestRoot>
+ </PropertyGroup>
+</Project>
diff --git a/vcpkg/scripts/buildsystems/msbuild/vcpkg.targets b/vcpkg/scripts/buildsystems/msbuild/vcpkg.targets new file mode 100644 index 0000000..23ddb19 --- /dev/null +++ b/vcpkg/scripts/buildsystems/msbuild/vcpkg.targets @@ -0,0 +1,259 @@ +<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> + + <PropertyGroup> + <_ZVcpkgClassicOrManifest Condition="'$(VcpkgEnabled)' == 'true' And ('$(VcpkgEnableClassic)' == 'true' Or '$(VcpkgEnableManifest)' == 'true')">true</_ZVcpkgClassicOrManifest> + <_ZVcpkgClassicOrManifest Condition="'$(_ZVcpkgClassicOrManifest)' == ''">false</_ZVcpkgClassicOrManifest> + </PropertyGroup> + + <!-- Special-case custom MSBuild platforms defined in the Microsoft GDK. See https://aka.ms/gdk and https://aka.ms/gdkx --> + <PropertyGroup Condition="'$(VcpkgOSTarget)' == '' AND '$(VcpkgPlatformTarget)' == '' AND '$(Platform)'=='Gaming.Desktop.x64'"> + <VcpkgOSTarget>windows</VcpkgOSTarget> + <VcpkgPlatformTarget>x64</VcpkgPlatformTarget> + <VcpkgUseMD>true</VcpkgUseMD> + </PropertyGroup> + <PropertyGroup Condition="'$(VcpkgOSTarget)' == '' AND '$(VcpkgPlatformTarget)' == '' AND '$(Platform)'=='Gaming.Xbox.Scarlett.x64'"> + <VcpkgOSTarget>xbox-scarlett</VcpkgOSTarget> + <VcpkgPlatformTarget>x64</VcpkgPlatformTarget> + <VcpkgUseMD>false</VcpkgUseMD> + </PropertyGroup> + <PropertyGroup Condition="'$(VcpkgOSTarget)' == '' AND '$(VcpkgPlatformTarget)' == '' AND '$(Platform)'=='Gaming.Xbox.XboxOne.x64'"> + <VcpkgOSTarget>xbox-xboxone</VcpkgOSTarget> + <VcpkgPlatformTarget>x64</VcpkgPlatformTarget> + <VcpkgUseMD>false</VcpkgUseMD> + </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.ToLower())</VcpkgPlatformTarget> + <VcpkgPlatformTarget Condition="'$(VcpkgPlatformTarget)' == 'win32'">x86</VcpkgPlatformTarget> + </PropertyGroup> + + <PropertyGroup> + <_ZVcpkgLinkage /> + <_ZVcpkgLinkage Condition="'$(VcpkgUseStatic)' == 'true'">-static</_ZVcpkgLinkage> + <_ZVcpkgLinkageMD /> + <_ZVcpkgLinkageMD Condition="'$(VcpkgUseStatic)' == 'true' and '$(VcpkgUseMD)' == 'true'">-md</_ZVcpkgLinkageMD> + <VcpkgTriplet Condition="'$(VcpkgTriplet)' == ''">$(VcpkgPlatformTarget)-$(VcpkgOSTarget)$(_ZVcpkgLinkage)$(_ZVcpkgLinkageMD)</VcpkgTriplet> + <VcpkgTriplet Condition="!$(VcpkgTriplet.EndsWith($(_ZVcpkgLinkage)$(_ZVcpkgLinkageMD)))">$(VcpkgTriplet)$(_ZVcpkgLinkage)$(_ZVcpkgLinkageMD)</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 Condition="'$(_ZVcpkgClassicOrManifest)' == 'true'">$(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="'$(_ZVcpkgClassicOrManifest)' == '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" Condition="'$(_ZVcpkgClassicOrManifest)' == 'true'"> + <Message Text="Using triplet "$(VcpkgTriplet)" from "$(_ZVcpkgCurrentInstalledDir)"" + Importance="Normal" Condition="'$(VcpkgEnabled)' == 'true'"/> + <Message Text="Using normalized configuration "$(_ZVcpkgNormalizedConfiguration)"" + Importance="Normal" Condition="'$(VcpkgEnabled)' == 'true'"/> + <Message Text="Not using Vcpkg because VcpkgEnabled is "$(VcpkgEnabled)"" + 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' and '$(VcpkgEnableManifest)' == 'true' and '$(VcpkgManifestInstall)' == '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" + StandardErrorImportance="High" + UseUtf8Encoding="Always" + StdOutEncoding="utf-8" + StdErrEncoding="utf-8" + UseCommandProcessor="false" + /> + <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="'$(_ZVcpkgClassicOrManifest)' == 'true' and '$(VcpkgApplocalDeps)' == 'true' and '$(LinkSkippedExecution)' != 'true' and '@(Link)' != ''"> + <Message Text="[vcpkg] Starting VcpkgApplocalDeps" Importance="low" /> + <PropertyGroup> + <_ZVcpkgApplocalInstalledBinDir>$(_ZVcpkgCurrentInstalledDir)$(_ZVcpkgConfigSubdir)bin</_ZVcpkgApplocalInstalledBinDir> + <_ZVcpkgApplocalTLogPath>$(TLogLocation)$(ProjectName).write.1u.tlog</_ZVcpkgApplocalTLogPath> + <_ZVcpkgApplocalCopiedFilesLogPath>$(IntDir)vcpkg.applocal.log</_ZVcpkgApplocalCopiedFilesLogPath> + <_ZVcpkgApplocalBuiltinArguments>--target-binary="$(TargetPath)" --installed-bin-dir="$(_ZVcpkgApplocalInstalledBinDir)" --tlog-file="$(_ZVcpkgApplocalTLogPath)" --copied-files-log="$(_ZVcpkgApplocalCopiedFilesLogPath)"</_ZVcpkgApplocalBuiltinArguments> + <_ZVcpkgAppLocalPowerShellCommonArguments>-ExecutionPolicy Bypass -noprofile -File "$(MSBuildThisFileDirectory)applocal.ps1" "$(TargetPath)" "$(_ZVcpkgApplocalInstalledBinDir)" "$(_ZVcpkgApplocalTLogPath)" "$(_ZVcpkgApplocalCopiedFilesLogPath)"</_ZVcpkgAppLocalPowerShellCommonArguments> + </PropertyGroup> + <Exec + Condition="'$(VcpkgXUseBuiltInApplocalDeps)' == 'true'" + Command="%22$(_ZVcpkgExecutable)%22 z-applocal $(_ZVcpkgApplocalBuiltinArguments)" + UseUtf8Encoding="Always" + StdOutEncoding="utf-8" + StdErrEncoding="utf-8" + UseCommandProcessor="false" + IgnoreExitCode="true"> + <Output TaskParameter="ExitCode" + PropertyName="_ZVcpkgAppLocalExitCode" /> + </Exec> + <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. Builtin arguments: $(_ZVcpkgApplocalBuiltinArguments)" + Condition="$(_ZVcpkgAppLocalExitCode) != 0 and '$(VcpkgXUseBuiltInApplocalDeps)' == 'true'"/> + + <!-- Search %PATH% for pwsh.exe if it is available. --> + <Exec + Condition="'$(VcpkgXUseBuiltInApplocalDeps)' != 'true'" + Command="pwsh.exe $(_ZVcpkgAppLocalPowerShellCommonArguments)" + 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)" + IgnoreExitCode="true" + UseCommandProcessor="false" + Condition="$(_ZVcpkgAppLocalExitCode) == 9009 and '$(VcpkgXUseBuiltInApplocalDeps)' != 'true'"> + <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 and '$(VcpkgXUseBuiltInApplocalDeps)' != 'true'"/> + + <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> diff --git a/vcpkg/scripts/buildsystems/osx/applocal.py b/vcpkg/scripts/buildsystems/osx/applocal.py new file mode 100644 index 0000000..5237f1f --- /dev/null +++ b/vcpkg/scripts/buildsystems/osx/applocal.py @@ -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() diff --git a/vcpkg/scripts/buildsystems/vcpkg.cmake b/vcpkg/scripts/buildsystems/vcpkg.cmake new file mode 100644 index 0000000..38f87f9 --- /dev/null +++ b/vcpkg/scripts/buildsystems/vcpkg.cmake @@ -0,0 +1,952 @@ +# 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.16) + +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) +if(VCPKG_PREFER_SYSTEM_LIBS) + message(WARNING "VCPKG_PREFER_SYSTEM_LIBS has been deprecated. Use empty overlay ports instead.") +endif() + +# Manifest options and settings +set(Z_VCPKG_MANIFEST_DIR_INITIAL_VALUE "${VCPKG_MANIFEST_DIR}") +if(NOT DEFINED VCPKG_MANIFEST_DIR) + if(EXISTS "${CMAKE_SOURCE_DIR}/vcpkg.json") + set(Z_VCPKG_MANIFEST_DIR_INITIAL_VALUE "${CMAKE_SOURCE_DIR}") + endif() +endif() +set(VCPKG_MANIFEST_DIR "${Z_VCPKG_MANIFEST_DIR_INITIAL_VALUE}" + 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") + if(z_vcpkg_function_arguments_LAST_ARG GREATER_EQUAL 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) + 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;None;") + if(VCPKG_VERBOSE) + message(STATUS "VCPKG-Info: CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL set to MinSizeRel;Release;None;") + endif() +endif() +if(NOT DEFINED CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO) + set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO "RelWithDebInfo;Release;None;") + if(VCPKG_VERBOSE) + message(STATUS "VCPKG-Info: CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO set to RelWithDebInfo;Release;None;") + 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" AND CMAKE_VS_PLATFORM_NAME_DEFAULT STREQUAL "ARM64") + set(Z_VCPKG_TARGET_TRIPLET_ARCH arm64) + elseif(CMAKE_GENERATOR STREQUAL "Visual Studio 16 2019") + set(Z_VCPKG_TARGET_TRIPLET_ARCH x64) + elseif(CMAKE_GENERATOR STREQUAL "Visual Studio 17 2022" AND CMAKE_VS_PLATFORM_NAME_DEFAULT STREQUAL "ARM64") + set(Z_VCPKG_TARGET_TRIPLET_ARCH arm64) + elseif(CMAKE_GENERATOR STREQUAL "Visual Studio 17 2022") + set(Z_VCPKG_TARGET_TRIPLET_ARCH x64) + elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin" AND DEFINED CMAKE_OSX_ARCHITECTURES) + 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() + 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_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|ARM64)$") + set(Z_VCPKG_TARGET_TRIPLET_ARCH arm64) + elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "riscv32") + set(Z_VCPKG_TARGET_TRIPLET_ARCH riscv32) + elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "riscv64") + set(Z_VCPKG_TARGET_TRIPLET_ARCH riscv64) + elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "loongarch32") + set(Z_VCPKG_TARGET_TRIPLET_ARCH loongarch32) + elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "loongarch64") + set(Z_VCPKG_TARGET_TRIPLET_ARCH loongarch64) + 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(CMAKE_SYSTEM_NAME STREQUAL "watchOS") + set(Z_VCPKG_TARGET_TRIPLET_PLAT watchos) +elseif(CMAKE_SYSTEM_NAME STREQUAL "tvOS") + set(Z_VCPKG_TARGET_TRIPLET_PLAT tvos) +elseif(CMAKE_SYSTEM_NAME STREQUAL "visionOS") + set(Z_VCPKG_TARGET_TRIPLET_PLAT visionos) +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")) + if(XBOX_CONSOLE_TARGET STREQUAL "scarlett") + set(Z_VCPKG_TARGET_TRIPLET_PLAT xbox-scarlett) + elseif(XBOX_CONSOLE_TARGET STREQUAL "xboxone") + set(Z_VCPKG_TARGET_TRIPLET_PLAT xbox-xboxone) + else() + set(Z_VCPKG_TARGET_TRIPLET_PLAT windows) + endif() +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) +elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" OR (NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "OpenBSD")) + set(Z_VCPKG_TARGET_TRIPLET_PLAT openbsd) +elseif(CMAKE_SYSTEM_NAME STREQUAL "NetBSD" OR (NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "NetBSD")) + set(Z_VCPKG_TARGET_TRIPLET_PLAT netbsd) +elseif(CMAKE_SYSTEM_NAME STREQUAL "SunOS" OR (NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "SunOS")) + set(Z_VCPKG_TARGET_TRIPLET_PLAT solaris) +elseif(CMAKE_SYSTEM_NAME STREQUAL "Android" OR (NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Android")) + set(Z_VCPKG_TARGET_TRIPLET_PLAT android) +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) + set(Z_VCPKG_INSTALLED_DIR_INITIAL_VALUE "${VCPKG_INSTALLED_DIR}") +elseif(DEFINED _VCPKG_INSTALLED_DIR) + set(Z_VCPKG_INSTALLED_DIR_INITIAL_VALUE "${_VCPKG_INSTALLED_DIR}") +elseif(VCPKG_MANIFEST_MODE) + set(Z_VCPKG_INSTALLED_DIR_INITIAL_VALUE "${CMAKE_BINARY_DIR}/vcpkg_installed") +else() + set(Z_VCPKG_INSTALLED_DIR_INITIAL_VALUE "${Z_VCPKG_ROOT_DIR}/installed") +endif() + +set(VCPKG_INSTALLED_DIR "${Z_VCPKG_INSTALLED_DIR_INITIAL_VALUE}" + 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") + + set(Z_VCPKG_BOOTSTRAP_LOG "${CMAKE_BINARY_DIR}/vcpkg-bootstrap.log") + file(TO_NATIVE_PATH "${Z_VCPKG_BOOTSTRAP_LOG}" Z_NATIVE_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_NATIVE_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(CMAKE_VERSION VERSION_GREATER_EQUAL "3.18") + 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} + ) + + set(Z_VCPKG_MANIFEST_INSTALL_LOGFILE "${CMAKE_BINARY_DIR}/vcpkg-manifest-install.log") + file(TO_NATIVE_PATH "${Z_VCPKG_MANIFEST_INSTALL_LOGFILE}" Z_NATIVE_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_NATIVE_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) + +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|xbox") + 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") + find_package(Python COMPONENTS Interpreter) + add_custom_command(TARGET "${target_name}" POST_BUILD + COMMAND "${Python_EXECUTABLE}" "${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|xbox" 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|xbox-.*)$") + # 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() + + set(allowed_target_types MODULE_LIBRARY SHARED_LIBRARY EXECUTABLE) + foreach(target IN LISTS arg_TARGETS) + get_target_property(target_type "${target}" TYPE) + if(target_type IN_LIST allowed_target_types) + 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|FILE_SET)$") + 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" AND (modifier STREQUAL "" OR modifier STREQUAL "RUNTIME")) + set(component_param "COMPONENT" "${arg}") + endif() + endforeach() + + x_vcpkg_install_local_dependencies( + TARGETS ${parsed_targets} + DESTINATION "${destination}" + ${component_param} + ) + endif() + endfunction() +endif() + +option(VCPKG_TRACE_FIND_PACKAGE "Trace calls to find_package()" OFF) +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 +set(z_vcpkg_find_package_backup_id "0") +macro("${VCPKG_OVERRIDE_FIND_PACKAGE_NAME}" z_vcpkg_find_package_package_name) + if(VCPKG_TRACE_FIND_PACKAGE) + string(REPEAT " " "${z_vcpkg_find_package_backup_id}" z_vcpkg_find_package_indent) + string(JOIN " " z_vcpkg_find_package_argn ${ARGN}) + message(STATUS "${z_vcpkg_find_package_indent}find_package(${z_vcpkg_find_package_package_name} ${z_vcpkg_find_package_argn})") + unset(z_vcpkg_find_package_argn) + unset(z_vcpkg_find_package_indent) + endif() + + math(EXPR z_vcpkg_find_package_backup_id "${z_vcpkg_find_package_backup_id} + 1") + set(z_vcpkg_find_package_package_name "${z_vcpkg_find_package_package_name}") + set(z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_ARGN "${ARGN}") + set(z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_vars "") + + if(z_vcpkg_find_package_backup_id EQUAL "1") + # This is the top-level find_package call + if("${VCPKG_LOCK_FIND_PACKAGE_${z_vcpkg_find_package_package_name}}") + # Avoid CMake warning when both REQUIRED and CMAKE_REQUIRE_FIND_PACKAGE_<Pkg> are used + if(NOT "REQUIRED" IN_LIST "z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_ARGN") + list(APPEND "z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_vars" "CMAKE_REQUIRE_FIND_PACKAGE_${z_vcpkg_find_package_package_name}") + if(DEFINED "CMAKE_REQUIRE_FIND_PACKAGE_${z_vcpkg_find_package_package_name}") + set("z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_CMAKE_REQUIRE_FIND_PACKAGE_${z_vcpkg_find_package_package_name}" "${CMAKE_REQUIRE_FIND_PACKAGE_${z_vcpkg_find_package_package_name}}") + endif() + set("CMAKE_REQUIRE_FIND_PACKAGE_${z_vcpkg_find_package_package_name}" 1) + endif() + if(VCPKG_TRACE_FIND_PACKAGE) + message(STATUS " (required by VCPKG_LOCK_FIND_PACKAGE_${z_vcpkg_find_package_package_name}=${VCPKG_LOCK_FIND_PACKAGE_${z_vcpkg_find_package_package_name}})") + endif() + elseif(DEFINED "VCPKG_LOCK_FIND_PACKAGE_${z_vcpkg_find_package_package_name}") + list(APPEND "z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_vars" "CMAKE_DISABLE_FIND_PACKAGE_${z_vcpkg_find_package_package_name}") + if(DEFINED "CMAKE_DISABLE_FIND_PACKAGE_${z_vcpkg_find_package_package_name}") + set("z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_CMAKE_DISABLE_FIND_PACKAGE_${z_vcpkg_find_package_package_name}" "${CMAKE_DISABLE_FIND_PACKAGE_${z_vcpkg_find_package_package_name}}") + endif() + # We don't need to worry about clearing this for transitive users because + # once this top level find_package is disabled, we immediately will return + # not found and not try to visit transitive dependencies in the first place. + set("CMAKE_DISABLE_FIND_PACKAGE_${z_vcpkg_find_package_package_name}" 1) + if(VCPKG_TRACE_FIND_PACKAGE) + message(STATUS " (disabled by VCPKG_LOCK_FIND_PACKAGE_${z_vcpkg_find_package_package_name}=${VCPKG_LOCK_FIND_PACKAGE_${z_vcpkg_find_package_package_name}})") + endif() + elseif(VCPKG_TRACE_FIND_PACKAGE) + message(STATUS " (could be controlled by VCPKG_LOCK_FIND_PACKAGE_${z_vcpkg_find_package_package_name})") + endif() + endif() + + # 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" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS" OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "visionOS") + list(APPEND z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_vars "CMAKE_FIND_ROOT_PATH") + if(DEFINED CMAKE_FIND_ROOT_PATH) + set(z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_CMAKE_FIND_ROOT_PATH "${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(CMAKE_DISABLE_FIND_PACKAGE_${z_vcpkg_find_package_package_name}) + # Skip wrappers, fail if REQUIRED. + _find_package("${z_vcpkg_find_package_package_name}" ${z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_ARGN}) + elseif(EXISTS "${z_vcpkg_find_package_vcpkg_cmake_wrapper_path}") + if(VCPKG_TRACE_FIND_PACKAGE) + string(REPEAT " " "${z_vcpkg_find_package_backup_id}" z_vcpkg_find_package_indent) + message(STATUS "${z_vcpkg_find_package_indent}using share/${z_vcpkg_find_package_lowercase_package_name}/vcpkg-cmake-wrapper.cmake") + unset(z_vcpkg_find_package_indent) + endif() + list(APPEND z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_vars "ARGS") + if(DEFINED ARGS) + set(z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_ARGS "${ARGS}") + endif() + set(ARGS "${z_vcpkg_find_package_package_name};${z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_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_${z_vcpkg_find_package_backup_id}_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_${z_vcpkg_find_package_backup_id}_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_${z_vcpkg_find_package_backup_id}_ARGN} COMPONENTS data) + else() + _find_package("${z_vcpkg_find_package_package_name}" ${z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_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_${z_vcpkg_find_package_backup_id}_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_${z_vcpkg_find_package_backup_id}_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_${z_vcpkg_find_package_backup_id}_ARGN}) + else() + _find_package("${z_vcpkg_find_package_package_name}" ${z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_ARGN}) + endif() + # Do not use z_vcpkg_find_package_package_name beyond this point since it might have changed! + # Only variables using z_vcpkg_find_package_backup_id can used correctly below! + foreach(z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_var IN LISTS z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_vars) + if(DEFINED z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_${z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_var}) + set("${z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_var}" "${z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_${z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_var}}") + else() + unset("${z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_var}") + endif() + unset("z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_${z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_backup_var}") + endforeach() + math(EXPR z_vcpkg_find_package_backup_id "${z_vcpkg_find_package_backup_id} - 1") + if(z_vcpkg_find_package_backup_id LESS "0") + message(FATAL_ERROR "[vcpkg]: find_package ended with z_vcpkg_find_package_backup_id being less than 0! This is a logical error and should never happen. Please provide a cmake trace log via cmake cmd line option '--trace-expand'!") + endif() +endmacro() + +cmake_policy(PUSH) +cmake_policy(VERSION 3.16) + +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}") + +# Propagate 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_HOST_TRIPLET + VCPKG_INSTALLED_DIR + VCPKG_PREFER_SYSTEM_LIBS + # VCPKG_APPLOCAL_DEPS # This should be off within try_compile! + VCPKG_CHAINLOAD_TOOLCHAIN_FILE + Z_VCPKG_ROOT_DIR + ) +else() + set(VCPKG_APPLOCAL_DEPS OFF) +endif() + +if(Z_VCPKG_HAS_FATAL_ERROR) + message(FATAL_ERROR "${Z_VCPKG_FATAL_ERROR}") +endif() + +cmake_policy(POP) |