aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorBilly O'Neal <bion@microsoft.com>2020-06-03 19:31:28 -0700
committerGitHub <noreply@github.com>2020-06-03 19:31:28 -0700
commit4fb225608532e9fb2fd2f5f1dbe9ec092cdc7c93 (patch)
treed4ccfc78c9043c6c136dc2ec72a3f005366564a3 /scripts
parent20e6626d8758f5e46c1777e3e1ff4d98ed5d2e7a (diff)
downloadvcpkg-4fb225608532e9fb2fd2f5f1dbe9ec092cdc7c93.tar.gz
vcpkg-4fb225608532e9fb2fd2f5f1dbe9ec092cdc7c93.zip
[vcpkg] Allow CI to pass in all relevant directories and remove use of symbolic links (#11483)
Diffstat (limited to 'scripts')
-rw-r--r--scripts/azure-pipelines/linux/azure-pipelines.yml24
-rwxr-xr-xscripts/azure-pipelines/linux/initialize-environment.sh8
-rw-r--r--scripts/azure-pipelines/osx/azure-pipelines.yml10
-rwxr-xr-xscripts/azure-pipelines/osx/initialize-environment.sh17
-rw-r--r--scripts/azure-pipelines/windows/azure-pipelines.yml21
-rw-r--r--scripts/azure-pipelines/windows/initialize-environment.ps144
-rw-r--r--scripts/buildsystems/msbuild/vcpkg.targets26
-rw-r--r--scripts/buildsystems/vcpkg.cmake8
-rw-r--r--scripts/cmake/vcpkg_build_cmake.cmake4
-rw-r--r--scripts/cmake/vcpkg_build_make.cmake26
-rw-r--r--scripts/cmake/vcpkg_build_msbuild.cmake1
-rw-r--r--scripts/cmake/vcpkg_configure_cmake.cmake2
-rw-r--r--scripts/cmake/vcpkg_install_msbuild.cmake1
-rw-r--r--scripts/ports.cmake26
14 files changed, 74 insertions, 144 deletions
diff --git a/scripts/azure-pipelines/linux/azure-pipelines.yml b/scripts/azure-pipelines/linux/azure-pipelines.yml
index 022fc70e4..fc0977697 100644
--- a/scripts/azure-pipelines/linux/azure-pipelines.yml
+++ b/scripts/azure-pipelines/linux/azure-pipelines.yml
@@ -10,28 +10,26 @@ jobs:
clean: resources
timeoutInMinutes: 1440 # 1 day
steps:
- - bash: |
- df -h
- displayName: 'Report on Disk Space Before Environment'
- condition: always()
- - task: Bash@3
- displayName: 'Initialize Environment'
- inputs:
- filePath: scripts/azure-pipelines/linux/initialize-environment.sh
+ - bash: df -h
+ displayName: 'Report on Disk Space'
- bash: |
sudo mkdir /home/agent -m=777
sudo chown `id -u` /home/agent
exit 0
displayName: 'Create /home/agent'
+ # Note: /mnt is the Azure machines' temporary disk.
- bash: |
- df -h
- displayName: 'Report on Disk Space After Environment'
- condition: always()
+ sudo mkdir /mnt/vcpkg-ci -m=777
+ sudo mkdir /mnt/vcpkg-ci/downloads -m=777
+ exit 0
+ displayName: 'Create /mnt/vcpkg-ci/downloads'
- task: Bash@3
displayName: 'Build vcpkg'
inputs:
filePath: bootstrap-vcpkg.sh
arguments: "-buildTests"
+ env:
+ VCPKG_DOWNLOADS: '/mnt/vcpkg-ci/downloads'
- bash: toolsrc/build.rel/vcpkg-test
displayName: 'Run vcpkg tests'
- powershell: |
@@ -39,14 +37,14 @@ jobs:
$skipList = ./scripts/azure-pipelines/generate-skip-list.ps1 -Triplet "x64-linux" -BaselineFile "$(System.DefaultWorkingDirectory)/scripts/ci.baseline.txt"
mkdir $(System.ArtifactsDirectory)/xml-results
$env:HOME = '/home/agent'
- ./vcpkg ci x64-linux --x-xunit="$(System.ArtifactsDirectory)/xml-results/x64-linux.xml" --exclude=$skipList --binarycaching
+ ./vcpkg ci x64-linux --x-xunit="$(System.ArtifactsDirectory)/xml-results/x64-linux.xml" --exclude=$skipList --binarycaching --x-binarysource=clear`;files`,/archives`,upload --x-buildtrees-root=/mnt/vcpkg-ci/buildtrees --x-install-root=/mnt/vcpkg-ci/install --x-packages-root=/mnt/vcpkg-ci/packages --downloads-root=/mnt/vcpkg-ci/downloads
displayName: '** Test Modified Ports **'
- task: PowerShell@2
displayName: 'Analyze results and prepare test logs'
inputs:
failOnStderr: true
filePath: 'scripts/azure-pipelines/analyze-test-results.ps1'
- arguments: '-baselineFile $(System.DefaultWorkingDirectory)/scripts/ci.baseline.txt -logDir "$(System.ArtifactsDirectory)/xml-results" -outputDir "$(Build.ArtifactStagingDirectory)" -failurelogDir "archives/fail" -triplets "x64-linux" -errorOnRegression'
+ arguments: '-baselineFile $(System.DefaultWorkingDirectory)/scripts/ci.baseline.txt -logDir "$(System.ArtifactsDirectory)/xml-results" -outputDir "$(Build.ArtifactStagingDirectory)" -failurelogDir "/archives/fail" -triplets "x64-linux" -errorOnRegression'
- bash: |
df -h
displayName: 'Report on Disk Space After Build'
diff --git a/scripts/azure-pipelines/linux/initialize-environment.sh b/scripts/azure-pipelines/linux/initialize-environment.sh
deleted file mode 100755
index 1cbdd3326..000000000
--- a/scripts/azure-pipelines/linux/initialize-environment.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-# Copyright (c) Microsoft Corporation.
-# SPDX-License-Identifier: MIT
-
-# Cleans up the environment to prevent contamination across builds.
-if [ ! -d "archives" ]; then
- ln -s /archives archives
-fi
diff --git a/scripts/azure-pipelines/osx/azure-pipelines.yml b/scripts/azure-pipelines/osx/azure-pipelines.yml
index e51698c45..be410e6a2 100644
--- a/scripts/azure-pipelines/osx/azure-pipelines.yml
+++ b/scripts/azure-pipelines/osx/azure-pipelines.yml
@@ -33,20 +33,22 @@ jobs:
inputs:
filePath: bootstrap-vcpkg.sh
arguments: '-buildTests'
+ env:
+ VCPKG_DOWNLOADS: '/Users/vagrant/Data/downloads'
- bash: toolsrc/build.rel/vcpkg-test
displayName: 'Run vcpkg tests'
- powershell: |
- ./vcpkg x-ci-clean
- $skip_list = ./scripts/azure-pipelines/generate-skip-list.ps1 -Triplet "x64-osx" -BaselineFile "$(System.DefaultWorkingDirectory)/scripts/ci.baseline.txt"
+ ./vcpkg x-ci-clean --x-buildtrees-root=/Users/vagrant/Data/buildtrees --x-install-root=/Users/vagrant/Data/installed --x-packages-root=/Users/vagrant/Data/packages --downloads-root=/Users/vagrant/Data/downloads
+ $skipList = ./scripts/azure-pipelines/generate-skip-list.ps1 -Triplet "x64-osx" -BaselineFile "$(System.DefaultWorkingDirectory)/scripts/ci.baseline.txt"
mkdir $(System.ArtifactsDirectory)/xml-results
- ./vcpkg ci x64-osx --x-xunit="$(System.ArtifactsDirectory)/xml-results/x64-osx.xml" --exclude=$skip_list --binarycaching
+ ./vcpkg ci x64-osx --x-xunit="$(System.ArtifactsDirectory)/xml-results/x64-osx.xml" --exclude=$skipList --binarycaching --x-binarysource=clear`;files`,/Users/vagrant/Data/archives`,upload --x-buildtrees-root=/Users/vagrant/Data/buildtrees --x-install-root=/Users/vagrant/Data/installed --x-packages-root=/Users/vagrant/Data/packages --downloads-root=/Users/vagrant/Data/downloads
displayName: '** Test Modified Ports **'
- task: PowerShell@2
displayName: 'Analyze results and prepare test logs'
inputs:
failOnStderr: true
filePath: 'scripts/azure-pipelines/analyze-test-results.ps1'
- arguments: '-baselineFile $(System.DefaultWorkingDirectory)/scripts/ci.baseline.txt -logDir "$(System.ArtifactsDirectory)/xml-results" -outputDir "$(Build.ArtifactStagingDirectory)" -failurelogDir ~/Data/archives/fail -triplets "x64-osx" -errorOnRegression'
+ arguments: '-baselineFile $(System.DefaultWorkingDirectory)/scripts/ci.baseline.txt -logDir "$(System.ArtifactsDirectory)/xml-results" -outputDir "$(Build.ArtifactStagingDirectory)" -failurelogDir /Users/vagrant/Data/archives/fail -triplets "x64-osx" -errorOnRegression'
- bash: |
df -h
displayName: 'Report on Disk Space After Build'
diff --git a/scripts/azure-pipelines/osx/initialize-environment.sh b/scripts/azure-pipelines/osx/initialize-environment.sh
index 6f42a809a..e94790668 100755
--- a/scripts/azure-pipelines/osx/initialize-environment.sh
+++ b/scripts/azure-pipelines/osx/initialize-environment.sh
@@ -4,20 +4,5 @@
# Sets up the environment for MacOS runs of vcpkg CI
-mkdir -p ~/Data/installed || true
-ln -s ~/Data/installed
-
-mkdir -p ~/Data/buildtrees || true
-ln -s ~/Data/buildtrees
-
-mkdir -p ~/Data/packages || true
-ln -s ~/Data/packages
-
-rm archives || rm -rf archives || true
-ln -s ~/Data/archives
-
-mkdir -p ~/Data/downloads || true
-ln -s ~/Data/downloads
-
#delete downloaded files that have not been used in 7 days
-find downloads/ -maxdepth 1 -type f ! -atime 7 -exec rm -f {} \;
+find ~/Data/downloads/ -maxdepth 1 -type f ! -atime 7 -exec rm -f {} \;
diff --git a/scripts/azure-pipelines/windows/azure-pipelines.yml b/scripts/azure-pipelines/windows/azure-pipelines.yml
index 48f3908d2..f2b14657b 100644
--- a/scripts/azure-pipelines/windows/azure-pipelines.yml
+++ b/scripts/azure-pipelines/windows/azure-pipelines.yml
@@ -15,33 +15,32 @@ jobs:
displayName: 'Initialize Environment'
inputs:
filePath: 'scripts/azure-pipelines/windows/initialize-environment.ps1'
- - task: BatchScript@1
+ # Note: D: is the Azure machines' temporary disk.
+ - task: CmdLine@2
displayName: 'Build vcpkg'
inputs:
- filename: 'bootstrap-vcpkg.bat'
+ script: |
+ set VCPKG_DOWNLOADS=D:\downloads
+ .\bootstrap-vcpkg.bat
- powershell: |
- .\vcpkg.exe x-ci-clean
- $skipList = ./scripts/azure-pipelines/generate-skip-list.ps1 -Triplet "${{ parameters.triplet }}" -BaselineFile "$(System.DefaultWorkingDirectory)\scripts\ci.baseline.txt"
+ .\vcpkg.exe x-ci-clean --binarycaching --x-binarysource=clear`;files`,W:\`,upload --x-buildtrees-root=E:\buildtrees --x-install-root=E:\install --x-packages-root=E:\packages --downloads-root=D:\downloads
+ $skipList = ./scripts/azure-pipelines/generate-skip-list.ps1 -Triplet "${{ parameters.triplet }}" -BaselineFile .\scripts\ci.baseline.txt
mkdir $(System.ArtifactsDirectory)\xml-results
# WORKAROUND: the x86-windows flavors of these are needed for all cross-compilation, but they are not auto-installed.
# Install them so the CI succeeds:
if ( "${{ parameters.triplet }}" -notmatch "x86-windows" -and "${{ parameters.triplet }}" -notmatch "x64-windows" ) {
- .\vcpkg.exe install protobuf:x86-windows boost-build:x86-windows sqlite3:x86-windows
+ .\vcpkg.exe install protobuf:x86-windows boost-build:x86-windows sqlite3:x86-windows --binarycaching --x-binarysource=clear`;files`,W:\`,upload --x-buildtrees-root=E:\buildtrees --x-install-root=E:\install --x-packages-root=E:\packages --downloads-root=D:\downloads
}
- $command = ".\vcpkg.exe ci ${{ parameters.triplet }} --x-xunit=`"$(System.ArtifactsDirectory)\xml-results\${{ parameters.triplet }}.xml`" --exclude=$skipList --binarycaching"
+ .\vcpkg.exe ci ${{ parameters.triplet }} --x-xunit=`"$(System.ArtifactsDirectory)\xml-results\${{ parameters.triplet }}.xml`" --exclude=$skipList --binarycaching --x-binarysource=clear`;files`,W:\`,upload --x-buildtrees-root=E:\buildtrees --x-install-root=E:\install --x-packages-root=E:\packages --downloads-root=D:\downloads
Set-Content -Path 'run_ci.cmd' -Value $command -Encoding ASCII
- displayName: 'Write Test Modified Ports Batch File'
- - task: BatchScript@1
displayName: '** Test Modified Ports **'
- inputs:
- filename: 'run_ci.cmd'
- task: PowerShell@2
displayName: 'Analyze results and prepare test logs'
inputs:
failOnStderr: true
filePath: 'scripts/azure-pipelines/analyze-test-results.ps1'
- arguments: '-baselineFile "$(System.DefaultWorkingDirectory)\scripts\ci.baseline.txt" -logDir "$(System.ArtifactsDirectory)\xml-results" -failurelogDir "archives\fail" -outputDir "$(Build.ArtifactStagingDirectory)" -errorOnRegression -triplets "${{ parameters.triplet }}"'
+ arguments: '-baselineFile .\scripts\ci.baseline.txt -logDir "$(System.ArtifactsDirectory)\xml-results" -failurelogDir "W:\fail" -outputDir "$(Build.ArtifactStagingDirectory)" -errorOnRegression -triplets "${{ parameters.triplet }}"'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: ${{ parameters.triplet }} port build failure logs'
inputs:
diff --git a/scripts/azure-pipelines/windows/initialize-environment.ps1 b/scripts/azure-pipelines/windows/initialize-environment.ps1
index 4211a228a..4a252df49 100644
--- a/scripts/azure-pipelines/windows/initialize-environment.ps1
+++ b/scripts/azure-pipelines/windows/initialize-environment.ps1
@@ -22,13 +22,6 @@ Param(
$StorageAccountName = $env:StorageAccountName
$StorageAccountKey = $env:StorageAccountKey
-function Remove-DirectorySymlink {
- Param([string]$Path)
- if (Test-Path $Path) {
- [System.IO.Directory]::Delete($Path, $true)
- }
-}
-
Write-Host 'Setting up archives mount'
if (-Not (Test-Path W:)) {
net use W: "\\$StorageAccountName.file.core.windows.net\archives" /u:"AZURE\$StorageAccountName" $StorageAccountKey
@@ -52,40 +45,3 @@ if( Test-Path D:\downloads\tools\msys2 )
Write-Host "removing previously installed msys2"
Remove-Item D:\downloads\tools\msys2 -Recurse -Force
}
-
-Write-Host 'Setting up archives path...'
-if ([string]::IsNullOrWhiteSpace($ForceAllPortsToRebuildKey))
-{
- $archivesPath = 'W:\'
-}
-else
-{
- $archivesPath = "W:\force\$ForceAllPortsToRebuildKey"
- if (-Not (Test-Path $fullPath)) {
- Write-Host 'Creating $archivesPath'
- mkdir $archivesPath
- }
-}
-
-Write-Host "Linking archives => $archivesPath"
-if (-Not (Test-Path archives)) {
- cmd /c "mklink /D archives $archivesPath"
-}
-
-Write-Host 'Linking installed => E:\installed'
-if (-Not (Test-Path E:\installed)) {
- mkdir E:\installed
-}
-
-if (-Not (Test-Path installed)) {
- cmd /c "mklink /D installed E:\installed"
-}
-
-Write-Host 'Linking downloads => D:\downloads'
-if (-Not (Test-Path D:\downloads)) {
- mkdir D:\downloads
-}
-
-if (-Not (Test-Path downloads)) {
- cmd /c "mklink /D downloads D:\downloads"
-}
diff --git a/scripts/buildsystems/msbuild/vcpkg.targets b/scripts/buildsystems/msbuild/vcpkg.targets
index f956a4f33..de7334d09 100644
--- a/scripts/buildsystems/msbuild/vcpkg.targets
+++ b/scripts/buildsystems/msbuild/vcpkg.targets
@@ -54,7 +54,13 @@
<VcpkgNormalizedConfiguration Condition="$(VcpkgConfiguration.StartsWith('Debug'))">Debug</VcpkgNormalizedConfiguration>
<VcpkgNormalizedConfiguration Condition="$(VcpkgConfiguration.StartsWith('Release')) or '$(VcpkgConfiguration)' == 'RelWithDebInfo' or '$(VcpkgConfiguration)' == 'MinSizeRel'">Release</VcpkgNormalizedConfiguration>
<VcpkgRoot Condition="'$(VcpkgRoot)' == ''">$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), .vcpkg-root))\</VcpkgRoot>
- <VcpkgCurrentInstalledDir Condition="'$(VcpkgCurrentInstalledDir)' == ''">$(VcpkgRoot)installed\$(VcpkgTriplet)\</VcpkgCurrentInstalledDir>
+ <!-- We add a trailing slash if it is missing in a different property because msbuild's default behavior does not
+ allow us to override a console provided property here. -->
+ <VcpkgRootSanitized>$(VcpkgRoot)</VcpkgRootSanitized>
+ <VcpkgRootSanitized Condition="!$(VcpkgRootSanitized.EndsWith('\'))">$(VcpkgRootSanitized)\</VcpkgRootSanitized>
+ <VcpkgCurrentInstalledDirSanitized>$(VcpkgCurrentInstalledDir)</VcpkgCurrentInstalledDirSanitized>
+ <VcpkgCurrentInstalledDirSanitized Condition="'$(VcpkgCurrentInstalledDirSanitized)' == ''">$(VcpkgRootSanitized)installed\$(VcpkgTriplet)\</VcpkgCurrentInstalledDirSanitized>
+ <VcpkgCurrentInstalledDirSanitized Condition="!$(VcpkgCurrentInstalledDirSanitized.EndsWith('\'))">$(VcpkgCurrentInstalledDirSanitized)\</VcpkgCurrentInstalledDirSanitized>
<VcpkgApplocalDeps Condition="'$(VcpkgApplocalDeps)' == ''">true</VcpkgApplocalDeps>
<!-- Deactivate Autolinking if lld is used as a linker. (Until a better way to solve the problem is found!).
Tried to add /lib as a parameter to the linker call but was unable to find a way to pass it as the first parameter. -->
@@ -63,21 +69,21 @@
<ItemDefinitionGroup Condition="'$(VcpkgEnabled)' == 'true'">
<Link>
- <AdditionalDependencies Condition="'$(VcpkgNormalizedConfiguration)' == 'Debug' and '$(VcpkgAutoLink)' != 'false'">%(AdditionalDependencies);$(VcpkgCurrentInstalledDir)debug\lib\*.lib</AdditionalDependencies>
- <AdditionalDependencies Condition="'$(VcpkgNormalizedConfiguration)' == 'Release' and '$(VcpkgAutoLink)' != 'false'">%(AdditionalDependencies);$(VcpkgCurrentInstalledDir)lib\*.lib</AdditionalDependencies>
- <AdditionalLibraryDirectories Condition="'$(VcpkgNormalizedConfiguration)' == 'Release'">%(AdditionalLibraryDirectories);$(VcpkgCurrentInstalledDir)lib;$(VcpkgCurrentInstalledDir)lib\manual-link</AdditionalLibraryDirectories>
- <AdditionalLibraryDirectories Condition="'$(VcpkgNormalizedConfiguration)' == 'Debug'">%(AdditionalLibraryDirectories);$(VcpkgCurrentInstalledDir)debug\lib;$(VcpkgCurrentInstalledDir)debug\lib\manual-link</AdditionalLibraryDirectories>
+ <AdditionalDependencies Condition="'$(VcpkgNormalizedConfiguration)' == 'Debug' and '$(VcpkgAutoLink)' != 'false'">%(AdditionalDependencies);$(VcpkgCurrentInstalledDirSanitized)debug\lib\*.lib</AdditionalDependencies>
+ <AdditionalDependencies Condition="'$(VcpkgNormalizedConfiguration)' == 'Release' and '$(VcpkgAutoLink)' != 'false'">%(AdditionalDependencies);$(VcpkgCurrentInstalledDirSanitized)lib\*.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories Condition="'$(VcpkgNormalizedConfiguration)' == 'Release'">%(AdditionalLibraryDirectories);$(VcpkgCurrentInstalledDirSanitized)lib;$(VcpkgCurrentInstalledDirSanitized)lib\manual-link</AdditionalLibraryDirectories>
+ <AdditionalLibraryDirectories Condition="'$(VcpkgNormalizedConfiguration)' == 'Debug'">%(AdditionalLibraryDirectories);$(VcpkgCurrentInstalledDirSanitized)debug\lib;$(VcpkgCurrentInstalledDirSanitized)debug\lib\manual-link</AdditionalLibraryDirectories>
</Link>
<ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(VcpkgCurrentInstalledDir)include</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(VcpkgCurrentInstalledDirSanitized)include</AdditionalIncludeDirectories>
</ClCompile>
<ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(VcpkgCurrentInstalledDir)include</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(VcpkgCurrentInstalledDirSanitized)include</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<Target Name="VcpkgTripletSelection" BeforeTargets="ClCompile">
- <Message Text="Using triplet &quot;$(VcpkgTriplet)&quot; from &quot;$(VcpkgCurrentInstalledDir)&quot;" Importance="Normal" Condition="'$(VcpkgEnabled)' == 'true'"/>
+ <Message Text="Using triplet &quot;$(VcpkgTriplet)&quot; from &quot;$(VcpkgCurrentInstalledDirSanitized)&quot;" Importance="Normal" Condition="'$(VcpkgEnabled)' == 'true'"/>
<Message Text="Not using Vcpkg because VcpkgEnabled is &quot;$(VcpkgEnabled)&quot;" Importance="Normal" Condition="'$(VcpkgEnabled)' != 'true'"/>
<Message Text="Vcpkg is unable to link because we cannot decide between Release and Debug libraries. Please define the property VcpkgConfiguration to be 'Release' or 'Debug' (currently '$(VcpkgConfiguration)')." Importance="High" Condition="'$(VcpkgEnabled)' == 'true' and '$(VcpkgNormalizedConfiguration)' == ''"/>
</Target>
@@ -87,11 +93,11 @@
File="$(TLogLocation)$(ProjectName).write.1u.tlog"
Lines="^$(TargetPath);$([System.IO.Path]::Combine($(ProjectDir),$(IntDir)))vcpkg.applocal.log" Encoding="Unicode"/>
<Exec Condition="$(VcpkgConfiguration.StartsWith('Debug'))"
- Command="$(SystemRoot)\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -noprofile -File %22$(MSBuildThisFileDirectory)applocal.ps1%22 %22$(TargetPath)%22 %22$(VcpkgCurrentInstalledDir)debug\bin%22 %22$(TLogLocation)$(ProjectName).write.1u.tlog%22 %22$(IntDir)vcpkg.applocal.log%22"
+ Command="$(SystemRoot)\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -noprofile -File %22$(MSBuildThisFileDirectory)applocal.ps1%22 %22$(TargetPath)%22 %22$(VcpkgCurrentInstalledDirSanitized)debug\bin%22 %22$(TLogLocation)$(ProjectName).write.1u.tlog%22 %22$(IntDir)vcpkg.applocal.log%22"
StandardOutputImportance="Normal">
</Exec>
<Exec Condition="$(VcpkgConfiguration.StartsWith('Release'))"
- Command="$(SystemRoot)\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -noprofile -File %22$(MSBuildThisFileDirectory)applocal.ps1%22 %22$(TargetPath)%22 %22$(VcpkgCurrentInstalledDir)bin%22 %22$(TLogLocation)$(ProjectName).write.1u.tlog%22 %22$(IntDir)vcpkg.applocal.log%22"
+ Command="$(SystemRoot)\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -noprofile -File %22$(MSBuildThisFileDirectory)applocal.ps1%22 %22$(TargetPath)%22 %22$(VcpkgCurrentInstalledDirSanitized)bin%22 %22$(TLogLocation)$(ProjectName).write.1u.tlog%22 %22$(IntDir)vcpkg.applocal.log%22"
StandardOutputImportance="Normal">
</Exec>
<ReadLinesFromFile File="$(IntDir)vcpkg.applocal.log">
diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake
index 66f9ec921..03926336b 100644
--- a/scripts/buildsystems/vcpkg.cmake
+++ b/scripts/buildsystems/vcpkg.cmake
@@ -1,7 +1,7 @@
# Mark variables as used so cmake doesn't complain about them
mark_as_advanced(CMAKE_TOOLCHAIN_FILE)
-# VCPKG toolchain options.
+# VCPKG toolchain options.
option(VCPKG_VERBOSE "Enables messages from the VCPKG toolchain for debugging purposes." OFF)
mark_as_advanced(VCPKG_VERBOSE)
@@ -28,7 +28,7 @@ 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.
+#In most cases this is the debug configuration which is wrong.
if(NOT DEFINED CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL)
set(CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL "MinSizeRel;Release;")
if(VCPKG_VERBOSE)
@@ -151,7 +151,9 @@ if(NOT DEFINED _VCPKG_ROOT_DIR)
endwhile()
set(_VCPKG_ROOT_DIR ${_VCPKG_ROOT_DIR_CANDIDATE} CACHE INTERNAL "Vcpkg root directory")
endif()
-set(_VCPKG_INSTALLED_DIR ${_VCPKG_ROOT_DIR}/installed)
+if (NOT DEFINED _VCPKG_INSTALLED_DIR)
+ set(_VCPKG_INSTALLED_DIR ${_VCPKG_ROOT_DIR}/installed)
+endif()
if(NOT EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" AND NOT _CMAKE_IN_TRY_COMPILE AND NOT VCPKG_SUPPRESS_INSTALLED_LIBRARIES_WARNING)
message(WARNING "There are no libraries installed for the Vcpkg triplet ${VCPKG_TARGET_TRIPLET}.")
diff --git a/scripts/cmake/vcpkg_build_cmake.cmake b/scripts/cmake/vcpkg_build_cmake.cmake
index d049c907b..5274c29da 100644
--- a/scripts/cmake/vcpkg_build_cmake.cmake
+++ b/scripts/cmake/vcpkg_build_cmake.cmake
@@ -75,9 +75,9 @@ function(vcpkg_build_cmake)
if(_bc_ADD_BIN_TO_PATH)
set(_BACKUP_ENV_PATH "$ENV{PATH}")
if(BUILDTYPE STREQUAL "debug")
- vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/bin")
+ vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}/debug/bin")
else()
- vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin")
+ vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}/bin")
endif()
endif()
diff --git a/scripts/cmake/vcpkg_build_make.cmake b/scripts/cmake/vcpkg_build_make.cmake
index 5d1b8d636..17a755890 100644
--- a/scripts/cmake/vcpkg_build_make.cmake
+++ b/scripts/cmake/vcpkg_build_make.cmake
@@ -86,7 +86,7 @@ function(vcpkg_build_make)
set(MAKE_OPTS ${_bc_MAKE_OPTIONS} V=1 -j ${VCPKG_CONCURRENCY} -f Makefile ${_bc_BUILD_TARGET})
set(INSTALL_OPTS -j ${VCPKG_CONCURRENCY} install DESTDIR=${CURRENT_PACKAGES_DIR})
endif()
-
+
# Backup enviromnent variables
set(C_FLAGS_BACKUP "$ENV{CFLAGS}")
set(CXX_FLAGS_BACKUP "$ENV{CXXFLAGS}")
@@ -98,7 +98,7 @@ function(vcpkg_build_make)
_vcpkg_backup_env_variable(LD_LIBRARY_PATH)
_vcpkg_backup_env_variable(LIBRARY_PATH)
set(LIBPATH_BACKUP "$ENV{LIBPATH}")
-
+
# Setup include enviromnent
set(ENV{INCLUDE} "${_VCPKG_INSTALLED}/include${VCPKG_HOST_PATH_SEPARATOR}${INCLUDE_BACKUP}")
set(ENV{INCLUDE_PATH} "${_VCPKG_INSTALLED}/include${VCPKG_HOST_PATH_SEPARATOR}${INCLUDE_PATH_BACKUP}")
@@ -141,7 +141,7 @@ function(vcpkg_build_make)
endif()
set(CMAKE_BUILDTYPE "RELEASE")
endif()
-
+
set(WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}${SHORT_BUILDTYPE}")
message(STATUS "Building ${TARGET_TRIPLET}${SHORT_BUILDTYPE}")
@@ -149,9 +149,9 @@ function(vcpkg_build_make)
if(_bc_ADD_BIN_TO_PATH)
set(_BACKUP_ENV_PATH "$ENV{PATH}")
if(BUILDTYPE STREQUAL "debug")
- vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/bin")
+ vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}/debug/bin")
else()
- vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin")
+ vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}/bin")
endif()
endif()
@@ -159,15 +159,15 @@ function(vcpkg_build_make)
set(TMP_CFLAGS "${C_FLAGS_GLOBAL} ${VCPKG_C_FLAGS_${CMAKE_BUILDTYPE}}")
string(REGEX REPLACE "[ \t]+/" " -" TMP_CFLAGS "${TMP_CFLAGS}")
set(ENV{CFLAGS} ${TMP_CFLAGS})
-
+
set(TMP_CXXFLAGS "${CXX_FLAGS_GLOBAL} ${VCPKG_CXX_FLAGS_${CMAKE_BUILDTYPE}}")
string(REGEX REPLACE "[ \t]+/" " -" TMP_CXXFLAGS "${TMP_CXXFLAGS}")
set(ENV{CXXFLAGS} ${TMP_CXXFLAGS})
-
+
set(TMP_LDFLAGS "${LD_FLAGS_GLOBAL} ${VCPKG_LINKER_FLAGS_${CMAKE_BUILDTYPE}}")
string(REGEX REPLACE "[ \t]+/" " -" TMP_LDFLAGS "${TMP_LDFLAGS}")
set(ENV{LDFLAGS} ${TMP_LDFLAGS})
-
+
string(REPLACE " " "\ " _VCPKG_INSTALLED_PKGCONF "${CURRENT_INSTALLED_DIR}")
string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" _VCPKG_INSTALLED_PKGCONF "${_VCPKG_INSTALLED_PKGCONF}")
string(REPLACE "\\" "/" _VCPKG_INSTALLED_PKGCONF "${_VCPKG_INSTALLED_PKGCONF}")
@@ -176,7 +176,7 @@ function(vcpkg_build_make)
else()
set(ENV{VCPKG_PKG_PREFIX} ${_VCPKG_INSTALLED_PKGCONF})
endif()
-
+
else()
set(ENV{CFLAGS} "${C_FLAGS_GLOBAL} ${VCPKG_C_FLAGS_${CMAKE_BUILDTYPE}}")
set(ENV{CXXFLAGS} "${CXX_FLAGS_GLOBAL} ${VCPKG_CXX_FLAGS_${CMAKE_BUILDTYPE}}")
@@ -226,15 +226,15 @@ function(vcpkg_build_make)
set(SHORT_BUILDTYPE "-rel")
endif()
endif()
-
+
message(STATUS "Installing ${TARGET_TRIPLET}${SHORT_BUILDTYPE}")
-
+
if(MAKE_BASH)
set(MAKE_CMD_LINE "${MAKE_COMMAND} ${INSTALL_OPTS}")
else()
set(MAKE_CMD_LINE ${MAKE_COMMAND} ${INSTALL_OPTS})
endif()
-
+
set(WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}${SHORT_BUILDTYPE}")
vcpkg_execute_build_process(
COMMAND ${MAKE_BASH} ${MAKE_CMD_LINE}
@@ -266,6 +266,6 @@ function(vcpkg_build_make)
if (CMAKE_HOST_WIN32)
set(ENV{PATH} "${PATH_GLOBAL}")
endif()
-
+
endfunction()
diff --git a/scripts/cmake/vcpkg_build_msbuild.cmake b/scripts/cmake/vcpkg_build_msbuild.cmake
index cfd429da2..67ff3d3ae 100644
--- a/scripts/cmake/vcpkg_build_msbuild.cmake
+++ b/scripts/cmake/vcpkg_build_msbuild.cmake
@@ -110,6 +110,7 @@ function(vcpkg_build_msbuild)
APPEND _csc_OPTIONS
/p:ForceImportBeforeCppTargets=${SCRIPTS}/buildsystems/msbuild/vcpkg.targets
"/p:VcpkgTriplet=${TARGET_TRIPLET}"
+ "/p:VcpkgCurrentInstalledDir=${CURRENT_INSTALLED_DIR}"
)
endif()
diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake
index ab65a5683..4debcb718 100644
--- a/scripts/cmake/vcpkg_configure_cmake.cmake
+++ b/scripts/cmake/vcpkg_configure_cmake.cmake
@@ -236,6 +236,8 @@ function(vcpkg_configure_cmake)
"-DVCPKG_TARGET_ARCHITECTURE=${VCPKG_TARGET_ARCHITECTURE}"
"-DCMAKE_INSTALL_LIBDIR:STRING=lib"
"-DCMAKE_INSTALL_BINDIR:STRING=bin"
+ "-D_VCPKG_ROOT_DIR=${VCPKG_ROOT_DIR}"
+ "-D_VCPKG_INSTALLED_DIR=${_VCPKG_INSTALLED_DIR}"
)
if(DEFINED ARCH)
diff --git a/scripts/cmake/vcpkg_install_msbuild.cmake b/scripts/cmake/vcpkg_install_msbuild.cmake
index 01bf49f02..8fc0298e0 100644
--- a/scripts/cmake/vcpkg_install_msbuild.cmake
+++ b/scripts/cmake/vcpkg_install_msbuild.cmake
@@ -137,6 +137,7 @@ function(vcpkg_install_msbuild)
/p:UseIntelMKL=No
/p:WindowsTargetPlatformVersion=${_csc_TARGET_PLATFORM_VERSION}
/p:VcpkgTriplet=${TARGET_TRIPLET}
+ "/p:VcpkgCurrentInstalledDir=${CURRENT_INSTALLED_DIR}"
/m
)
diff --git a/scripts/ports.cmake b/scripts/ports.cmake
index fcec5ad2f..9b33745f9 100644
--- a/scripts/ports.cmake
+++ b/scripts/ports.cmake
@@ -6,34 +6,20 @@ macro(debug_message)
endif()
endmacro()
-#Detect .vcpkg-root to figure VCPKG_ROOT_DIR, starting from triplet folder.
-set(VCPKG_ROOT_DIR_CANDIDATE ${CMAKE_CURRENT_LIST_DIR})
-
-if(DEFINED VCPKG_ROOT_PATH)
- set(VCPKG_ROOT_DIR_CANDIDATE ${VCPKG_ROOT_PATH})
-else()
+if((NOT DEFINED VCPKG_ROOT_DIR)
+ OR (NOT DEFINED DOWNLOADS)
+ OR (NOT DEFINED _VCPKG_INSTALLED_DIR)
+ OR (NOT DEFINED PACKAGES_DIR)
+ OR (NOT DEFINED BUILDTREES_DIR))
message(FATAL_ERROR [[
Your vcpkg executable is outdated and is not compatible with the current CMake scripts.
Please re-build vcpkg by running bootstrap-vcpkg.
]])
endif()
-# fixup Windows drive letter to uppercase.
-get_filename_component(VCPKG_ROOT_DIR_CANDIDATE ${VCPKG_ROOT_DIR_CANDIDATE} ABSOLUTE)
-
-# Validate VCPKG_ROOT_DIR_CANDIDATE
-if (NOT EXISTS "${VCPKG_ROOT_DIR_CANDIDATE}/.vcpkg-root")
- message(FATAL_ERROR "Could not find .vcpkg-root")
-endif()
-
-set(VCPKG_ROOT_DIR ${VCPKG_ROOT_DIR_CANDIDATE})
-
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
-set(CURRENT_INSTALLED_DIR ${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET} CACHE PATH "Location to install final packages")
-set(DOWNLOADS ${VCPKG_ROOT_DIR}/downloads CACHE PATH "Location to download sources and tools")
+set(CURRENT_INSTALLED_DIR ${_VCPKG_INSTALLED_DIR}/${TARGET_TRIPLET} CACHE PATH "Location to install final packages")
set(SCRIPTS ${CMAKE_CURRENT_LIST_DIR} CACHE PATH "Location to stored scripts")
-set(PACKAGES_DIR ${VCPKG_ROOT_DIR}/packages CACHE PATH "Location to store package images")
-set(BUILDTREES_DIR ${VCPKG_ROOT_DIR}/buildtrees CACHE PATH "Location to perform actual extract+config+build")
if(PORT)
set(CURRENT_BUILDTREES_DIR ${BUILDTREES_DIR}/${PORT})