mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-29 03:34:26 +08:00
27 lines
947 B
PowerShell
27 lines
947 B
PowerShell
|
[cmdletbinding()]
|
||
|
param([string]$targetBinary, [string]$installedDir, [string]$tlogFile)
|
||
|
|
||
|
function resolve($targetBinary) {
|
||
|
$targetBinaryPath = Resolve-Path $targetBinary
|
||
|
$targetBinaryDir = Split-Path $targetBinaryPath -parent
|
||
|
|
||
|
$a = $(link /dump /imports $targetBinary | ? { $_ -match "^ [^ ].*\.dll" } | % { $_ -replace "^ ","" })
|
||
|
$a | % {
|
||
|
if (Test-Path "$installedDir\$_") {
|
||
|
if (Test-Path "$targetBinaryDir\$_") {
|
||
|
Write-Verbose "$_ is already present"
|
||
|
}
|
||
|
else {
|
||
|
Copy-Item $installedDir\$_ $targetBinaryDir
|
||
|
Write-Verbose "Copying $installedDir\$_ -> $_"
|
||
|
}
|
||
|
"$targetBinaryDir\$_"
|
||
|
if ($tlogFile) { Add-Content $tlogFile "$targetBinaryDir\$_" }
|
||
|
resolve("$targetBinaryDir\$_")
|
||
|
} else {
|
||
|
Write-Verbose "$installedDir\$_ not found"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
resolve($targetBinary)
|