From c4c079f86eac8215040173d6707900d8983ea7fc Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 27 Nov 2017 00:25:29 -0800 Subject: [VcpkgPowershellUtils] Minor tweaks --- scripts/VcpkgPowershellUtils.ps1 | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/VcpkgPowershellUtils.ps1 b/scripts/VcpkgPowershellUtils.ps1 index d32c3ae6b..d431c3b45 100644 --- a/scripts/VcpkgPowershellUtils.ps1 +++ b/scripts/VcpkgPowershellUtils.ps1 @@ -11,6 +11,20 @@ function vcpkgCreateDirectoryIfNotExists([Parameter(Mandatory=$true)][string]$di } } +function vcpkgCreateParentDirectoryIfNotExists([Parameter(Mandatory=$true)][string]$path) +{ + $parentDir = split-path -parent $path + if ([string]::IsNullOrEmpty($parentDir)) + { + return + } + + if (!(Test-Path $dirPath)) + { + New-Item -ItemType Directory -Path $parentDir | Out-Null + } +} + function vcpkgRemoveDirectory([Parameter(Mandatory=$true)][string]$dirPath) { if (Test-Path $dirPath) @@ -101,8 +115,7 @@ function vcpkgDownloadFile( [Parameter(Mandatory=$true)][string]$url, return } - $downloadDir = split-path -parent $downloadPath - vcpkgCreateDirectoryIfNotExists $downloadDir + vcpkgCreateParentDirectoryIfNotExists $downloadPath $downloadPartPath = "$downloadPath.part" vcpkgRemoveFile $downloadPartPath @@ -143,10 +156,10 @@ function vcpkgDownloadFile( [Parameter(Mandatory=$true)][string]$url, function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file, [Parameter(Mandatory=$true)][string]$destinationDir) { - $parentPath = split-path -parent $destinationDir - vcpkgCreateDirectoryIfNotExists $parentPath + vcpkgCreateParentDirectoryIfNotExists $destinationDir $baseName = (Get-ChildItem $file).BaseName - $destinationPartial = "$destinationDir\$baseName-partially_extracted" + $destination = "$destinationDir\$baseName" + $destinationPartial = "$destination-partially_extracted" vcpkgRemoveDirectory $destinationPartial vcpkgCreateDirectoryIfNotExists $destinationPartial @@ -179,10 +192,12 @@ function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file, { Move-Item -Path "$destinationPartial\*" -Destination $destinationDir vcpkgRemoveDirectory $destinationPartial + return $destination } else { Rename-Item -Path $destinationPartial -NewName $baseName + return $destination } } -- cgit v1.2.3 From 2c914ff05af3b2209eb11b6ba61b43eb46033cb3 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 27 Nov 2017 00:42:21 -0800 Subject: Rework vcpkgExtractFile (powershell) --- scripts/VcpkgPowershellUtils.ps1 | 12 +++++------- scripts/fetchDependency.ps1 | 3 ++- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'scripts') diff --git a/scripts/VcpkgPowershellUtils.ps1 b/scripts/VcpkgPowershellUtils.ps1 index d431c3b45..0e53ff620 100644 --- a/scripts/VcpkgPowershellUtils.ps1 +++ b/scripts/VcpkgPowershellUtils.ps1 @@ -19,7 +19,7 @@ function vcpkgCreateParentDirectoryIfNotExists([Parameter(Mandatory=$true)][stri return } - if (!(Test-Path $dirPath)) + if (!(Test-Path $parentDir)) { New-Item -ItemType Directory -Path $parentDir | Out-Null } @@ -157,9 +157,7 @@ function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file, [Parameter(Mandatory=$true)][string]$destinationDir) { vcpkgCreateParentDirectoryIfNotExists $destinationDir - $baseName = (Get-ChildItem $file).BaseName - $destination = "$destinationDir\$baseName" - $destinationPartial = "$destination-partially_extracted" + $destinationPartial = "$destinationDir-partially_extracted" vcpkgRemoveDirectory $destinationPartial vcpkgCreateDirectoryIfNotExists $destinationPartial @@ -192,12 +190,12 @@ function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file, { Move-Item -Path "$destinationPartial\*" -Destination $destinationDir vcpkgRemoveDirectory $destinationPartial - return $destination + return $destinationDir } else { - Rename-Item -Path $destinationPartial -NewName $baseName - return $destination + Move-Item -Path $destinationPartial -Destination $destinationDir + return $destinationDir } } diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index 744439bb7..830ec7064 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -88,7 +88,8 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) { if (-not (Test-Path $executableFromDownload)) { - vcpkgExtractFile -File $downloadPath -DestinationDir $downloadsDir + $extractFolderName = (Get-ChildItem $downloadPath).BaseName + vcpkgExtractFile -File $downloadPath -DestinationDir "$downloadsDir\$extractFolderName" } } elseif($extractionType -eq $ExtractionType_SELF_EXTRACTING_7Z) -- cgit v1.2.3 From b7c9ef55531cba1c014650dbc5ff33fa1b977b40 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 27 Nov 2017 00:45:00 -0800 Subject: Don't return $destinationDir --- scripts/VcpkgPowershellUtils.ps1 | 2 -- 1 file changed, 2 deletions(-) (limited to 'scripts') diff --git a/scripts/VcpkgPowershellUtils.ps1 b/scripts/VcpkgPowershellUtils.ps1 index 0e53ff620..28e818437 100644 --- a/scripts/VcpkgPowershellUtils.ps1 +++ b/scripts/VcpkgPowershellUtils.ps1 @@ -190,12 +190,10 @@ function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file, { Move-Item -Path "$destinationPartial\*" -Destination $destinationDir vcpkgRemoveDirectory $destinationPartial - return $destinationDir } else { Move-Item -Path $destinationPartial -Destination $destinationDir - return $destinationDir } } -- cgit v1.2.3 From b4668e664a4db7b8bc9e9c4c202312e0fb7a8ff9 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Tue, 28 Nov 2017 13:17:10 -0800 Subject: [vcpkg] Only default target triplet to windows if on windows --- scripts/buildsystems/vcpkg.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 8edc2830c..24f6d855e 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -54,7 +54,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" OR CMAKE_SYSTEM_NAME STREQUAL "Wind set(_VCPKG_TARGET_TRIPLET_PLAT uwp) elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") set(_VCPKG_TARGET_TRIPLET_PLAT linux) -else() +elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") set(_VCPKG_TARGET_TRIPLET_PLAT windows) endif() -- cgit v1.2.3 From d38d4a75408e0e9d0820187b16da2e06ce0ee316 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Wed, 29 Nov 2017 23:45:47 -0800 Subject: [vcpkg] Add --x-xunit internal command to print installation results in a VSTS friendly format. --- scripts/internalCI.ps1 | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'scripts') diff --git a/scripts/internalCI.ps1 b/scripts/internalCI.ps1 index 16ce4fc7a..37f4f35a4 100644 --- a/scripts/internalCI.ps1 +++ b/scripts/internalCI.ps1 @@ -1,5 +1,7 @@ $ErrorActionPreference = "Stop" +rm TEST-internal-ci.xml -errorAction SilentlyContinue + New-Item -type directory downloads -errorAction SilentlyContinue | Out-Null ./scripts/bootstrap.ps1 if (-not $?) { throw $? } @@ -7,21 +9,14 @@ if (-not $?) { throw $? } # Clear out any intermediate files from the previous build if (Test-Path buildtrees) { - Get-ChildItem buildtrees/*/* | ? { $_.Name -ne "src" -and $_.Extension -ne ".log"} | Remove-Item -Recurse -Force + Get-ChildItem buildtrees/*/* | ? { $_.Name -ne "src" } | Remove-Item -Recurse -Force } # Purge any outdated packages ./vcpkg remove --outdated --recurse if (-not $?) { throw $? } -./vcpkg.exe install azure-storage-cpp cpprestsdk:x64-windows-static cpprestsdk:x86-uwp -if (-not $?) { throw $? } - -./vcpkg.exe install bond cryptopp zlib expat sdl2 curl sqlite3 libuv protobuf:x64-windows sfml opencv:x64-windows uwebsockets uwebsockets:x64-windows-static +./vcpkg.exe install azure-storage-cpp cpprestsdk:x64-windows-static cpprestsdk:x86-uwp ` +bond cryptopp zlib expat sdl2 curl sqlite3 libuv protobuf:x64-windows sfml opencv:x64-windows uwebsockets uwebsockets:x64-windows-static ` +opencv:x86-uwp boost:x86-uwp --keep-going "--x-xunit=TEST-internal-ci.xml" if (-not $?) { throw $? } - -./vcpkg.exe install opencv:x86-uwp boost:x86-uwp -if (-not $?) { throw $? } - -# ./vcpkg.exe install folly:x64-windows -# if (-not $?) { throw $? } -- cgit v1.2.3 From fdf7c65aa4ea53e580a85c9b984109c4f4446da5 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 30 Nov 2017 16:43:41 -0800 Subject: Exit early if no VS is found --- scripts/bootstrap.ps1 | 2 +- scripts/findAnyMSBuildWithCppPlatformToolset.ps1 | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/bootstrap.ps1 b/scripts/bootstrap.ps1 index ca7b1a0ce..3f40a2ead 100644 --- a/scripts/bootstrap.ps1 +++ b/scripts/bootstrap.ps1 @@ -46,7 +46,7 @@ try & $msbuildExe "/p:VCPKG_VERSION=-$gitHash" "/p:DISABLE_METRICS=$disableMetrics" /p:Configuration=Release /p:Platform=x86 /p:PlatformToolset=$platformToolset /p:TargetPlatformVersion=$windowsSDK /m dirs.proj if ($LASTEXITCODE -ne 0) { - Write-Error "Building vcpkg.exe failed. Please ensure you have installed the Desktop C++ workload and the Windows SDK for Desktop C++." + Write-Error "Building vcpkg.exe failed. Please ensure you have installed Visual Studio with the Desktop C++ workload and the Windows SDK for Desktop C++." return } diff --git a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 index e58b58c04..46ba767b9 100644 --- a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 +++ b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 @@ -8,6 +8,11 @@ $withVSPath = $withVSPath -replace "\\$" # Remove potential trailing backslash $scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition $VisualStudioInstallationInstances = & $scriptsDir\findVisualStudioInstallationInstances.ps1 +if ($VisualStudioInstallationInstances -eq $null) +{ + throw "Could not find Visual Studio. VS2015 or VS2017 (with C++) needs to be installed." +} + Write-Verbose "VS Candidates:`n`r$([system.String]::Join([Environment]::NewLine, $VisualStudioInstallationInstances))" foreach ($instanceCandidateWithEOL in $VisualStudioInstallationInstances) { -- cgit v1.2.3 From d26a6b067c24e324b111849c320bdc4cf681e713 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Sun, 26 Nov 2017 02:51:31 -0800 Subject: Add `vcpkg integrate powershell` for tab completion --- scripts/addPoshVcpkgToPowershellProfile.ps1 | 55 +++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 scripts/addPoshVcpkgToPowershellProfile.ps1 (limited to 'scripts') diff --git a/scripts/addPoshVcpkgToPowershellProfile.ps1 b/scripts/addPoshVcpkgToPowershellProfile.ps1 new file mode 100644 index 000000000..92a7573e4 --- /dev/null +++ b/scripts/addPoshVcpkgToPowershellProfile.ps1 @@ -0,0 +1,55 @@ +[CmdletBinding()] +param() + +function findExistingImportModuleDirectives([Parameter(Mandatory=$true)][string]$path) +{ + if (!(Test-Path $path)) + { + return $false + } + + $fileContents = Get-Content $path + return $fileContents -match 'Import-Module.+?(?=posh-vcpkg)' +} + +$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition +. "$scriptsDir\VcpkgPowershellUtils.ps1" + +$profileEntry = "Import-Module '$scriptsDir\posh-vcpkg'" +$profilePath = $PROFILE # Implicit powershell variable +if (!(Test-Path $profilePath)) +{ + $profileDir = Split-Path $profilePath -Parent + vcpkgCreateDirectoryIfNotExists $profileDir +} + +Write-Host "`nAdding the following line to ${profilePath}:" +Write-Host " $profileEntry" + +# @() Needed to force Array in PowerShell 2.0 +[Array]$existingImports = @(findExistingImportModuleDirectives $profilePath) +if ($existingImports.Count -gt 0) +{ + $existingImportsOut = $existingImports -join "`n " + Write-Host "`nposh-vcpkg is already imported to your PowerShell profile. The following entries were found:" + Write-Host " $existingImportsOut" + Write-Host "`nPlease make sure you have started a new Powershell window for the changes to take effect." + return +} + +# Posh-git does the following check, so we should too. +# https://github.com/dahlbyk/posh-git/blob/master/src/Utils.ps1 +# If the profile script exists and is signed, then we should not modify it +if (Test-Path $profilePath) +{ + $sig = Get-AuthenticodeSignature $profilePath + if ($null -ne $sig.SignerCertificate) + { + Write-Warning "Skipping add of posh-vcpkg import to profile; '$profilePath' appears to be signed." + Write-Warning "Please manually add the line '$profileEntry' to your profile and resign it." + return + } +} + +Add-Content $profilePath -Value "`n$profileEntry" -Encoding UTF8 +Write-Host "`nSuccessfully added posh-vcpkg to your PowerShell profile. Please start a new Powershell window for the changes to take effect." -- cgit v1.2.3 From a4f8515c9e6af66bbdcf704c75e5284daa240040 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Mon, 4 Dec 2017 17:37:08 -0800 Subject: [vcpkg-msbuild-integration] Address #2299 by using full path to powershell. --- scripts/buildsystems/msbuild/vcpkg.targets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/buildsystems/msbuild/vcpkg.targets b/scripts/buildsystems/msbuild/vcpkg.targets index ad1dde89b..d6fbcf179 100644 --- a/scripts/buildsystems/msbuild/vcpkg.targets +++ b/scripts/buildsystems/msbuild/vcpkg.targets @@ -67,11 +67,11 @@ File="$(TLogLocation)$(ProjectName).write.1u.tlog" Lines="^$(TargetPath);$([System.IO.Path]::Combine($(ProjectDir),$(IntDir)))vcpkg.applocal.log" Encoding="Unicode"/> -- cgit v1.2.3 From e7cbb50f3dd323380928f4cb4e5b9bc0945abac8 Mon Sep 17 00:00:00 2001 From: Ilya Finkelshteyn Date: Tue, 5 Dec 2017 14:31:58 -0800 Subject: Fix path to powershell.exe https://github.com/Microsoft/vcpkg/issues/2299 --- scripts/buildsystems/msbuild/vcpkg.targets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/buildsystems/msbuild/vcpkg.targets b/scripts/buildsystems/msbuild/vcpkg.targets index d6fbcf179..092e013b5 100644 --- a/scripts/buildsystems/msbuild/vcpkg.targets +++ b/scripts/buildsystems/msbuild/vcpkg.targets @@ -67,11 +67,11 @@ File="$(TLogLocation)$(ProjectName).write.1u.tlog" Lines="^$(TargetPath);$([System.IO.Path]::Combine($(ProjectDir),$(IntDir)))vcpkg.applocal.log" Encoding="Unicode"/> -- cgit v1.2.3 From 1f3013bea303736d216361a47e2f323577ab9c46 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 8 Dec 2017 15:16:35 -0800 Subject: Improve vcpkgExtractFile. Also merge vcpkgRemoveDirectory/File --- scripts/VcpkgPowershellUtils.ps1 | 41 ++++++++++++++++++---------------------- scripts/fetchDependency.ps1 | 4 ++-- 2 files changed, 20 insertions(+), 25 deletions(-) (limited to 'scripts') diff --git a/scripts/VcpkgPowershellUtils.ps1 b/scripts/VcpkgPowershellUtils.ps1 index 28e818437..45f52b225 100644 --- a/scripts/VcpkgPowershellUtils.ps1 +++ b/scripts/VcpkgPowershellUtils.ps1 @@ -25,7 +25,7 @@ function vcpkgCreateParentDirectoryIfNotExists([Parameter(Mandatory=$true)][stri } } -function vcpkgRemoveDirectory([Parameter(Mandatory=$true)][string]$dirPath) +function vcpkgRemoveItem([Parameter(Mandatory=$true)][string]$dirPath) { if (Test-Path $dirPath) { @@ -33,14 +33,6 @@ function vcpkgRemoveDirectory([Parameter(Mandatory=$true)][string]$dirPath) } } -function vcpkgRemoveFile([Parameter(Mandatory=$true)][string]$filePath) -{ - if (Test-Path $filePath) - { - Remove-Item $filePath -Force - } -} - function vcpkgHasCommand([Parameter(Mandatory=$true)][string]$commandName) { return [bool](Get-Command -Name $commandName -ErrorAction SilentlyContinue) @@ -118,7 +110,7 @@ function vcpkgDownloadFile( [Parameter(Mandatory=$true)][string]$url, vcpkgCreateParentDirectoryIfNotExists $downloadPath $downloadPartPath = "$downloadPath.part" - vcpkgRemoveFile $downloadPartPath + vcpkgRemoveItem $downloadPartPath $wc = New-Object System.Net.WebClient $proxyAuth = !$wc.Proxy.IsBypassed($url) @@ -144,7 +136,7 @@ function vcpkgDownloadFile( [Parameter(Mandatory=$true)][string]$url, catch [System.Exception] { # If BITS fails for any reason, delete any potentially partially downloaded files and continue - vcpkgRemoveFile $downloadPartPath + vcpkgRemoveItem $downloadPartPath } } @@ -154,14 +146,21 @@ function vcpkgDownloadFile( [Parameter(Mandatory=$true)][string]$url, } function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file, - [Parameter(Mandatory=$true)][string]$destinationDir) + [Parameter(Mandatory=$true)][string]$destinationDir, + [Parameter(Mandatory=$true)][string]$outFilename) { - vcpkgCreateParentDirectoryIfNotExists $destinationDir - $destinationPartial = "$destinationDir-partially_extracted" + vcpkgCreateDirectoryIfNotExists $destinationDir + $output = "$destinationDir/$outFilename" + vcpkgRemoveItem $output + $destinationPartial = "$destinationDir/partially-extracted" - vcpkgRemoveDirectory $destinationPartial + vcpkgRemoveItem $destinationPartial vcpkgCreateDirectoryIfNotExists $destinationPartial + $shell = new-object -com shell.application + $zip = $shell.NameSpace($file) + $itemCount = $zip.Items().Count + if (vcpkgHasCommand -commandName 'Microsoft.PowerShell.Archive\Expand-Archive') { Write-Verbose("Extracting with Microsoft.PowerShell.Archive\Expand-Archive") @@ -175,8 +174,6 @@ function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file, else { Write-Verbose("Extracting via shell") - $shell = new-object -com shell.application - $zip = $shell.NameSpace($file) foreach($item in $zip.items()) { # Piping to Out-Null is used to block until finished @@ -184,16 +181,14 @@ function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file, } } - $hasASingleItem = (Get-ChildItem $destinationPartial | Measure-Object).Count -eq 1; - - if ($hasASingleItem) + if ($itemCount -eq 1) { - Move-Item -Path "$destinationPartial\*" -Destination $destinationDir - vcpkgRemoveDirectory $destinationPartial + Move-Item -Path "$destinationPartial\*" -Destination $output + vcpkgRemoveItem $destinationPartial } else { - Move-Item -Path $destinationPartial -Destination $destinationDir + Move-Item -Path $destinationPartial -Destination $output } } diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index 830ec7064..f62fe450c 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -88,8 +88,8 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) { if (-not (Test-Path $executableFromDownload)) { - $extractFolderName = (Get-ChildItem $downloadPath).BaseName - vcpkgExtractFile -File $downloadPath -DestinationDir "$downloadsDir\$extractFolderName" + $outFilename = (Get-ChildItem $downloadPath).BaseName + vcpkgExtractFile -File $downloadPath -DestinationDir $downloadsDir -outFilename $outFilename } } elseif($extractionType -eq $ExtractionType_SELF_EXTRACTING_7Z) -- cgit v1.2.3 From 3c2b2cc60719b110de889b62dd13af5f1a4b883c Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Fri, 8 Dec 2017 22:03:03 -0800 Subject: [vcpkg-cmake-toolchain] Use list(APPEND) instead of set(). Fixes #2336. Fix MPI issue introduced in cmake 3.10. Fixes #2317. Add _VCPKG_ROOT_DIR to persisted variables to reduce disk access during cmake reconfigure. --- scripts/buildsystems/vcpkg.cmake | 50 ++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 17 deletions(-) (limited to 'scripts') diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 24f6d855e..cdef610c1 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -1,6 +1,7 @@ # Mark variables as used so cmake doesn't complain about them mark_as_advanced(CMAKE_TOOLCHAIN_FILE) +# This is a backport of CMAKE_TRY_COMPILE_PLATFORM_VARIABLES to cmake 3.0 get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE ) if( _CMAKE_IN_TRY_COMPILE ) include( "${CMAKE_CURRENT_SOURCE_DIR}/../vcpkg.config.cmake" OPTIONAL ) @@ -61,17 +62,19 @@ endif() set(VCPKG_TARGET_TRIPLET ${_VCPKG_TARGET_TRIPLET_ARCH}-${_VCPKG_TARGET_TRIPLET_PLAT} CACHE STRING "Vcpkg target triplet (ex. x86-windows)") set(_VCPKG_TOOLCHAIN_DIR ${CMAKE_CURRENT_LIST_DIR}) -# Detect .vcpkg-root to figure VCPKG_ROOT_DIR -set(_VCPKG_ROOT_DIR_CANDIDATE ${CMAKE_CURRENT_LIST_DIR}) -while(IS_DIRECTORY ${_VCPKG_ROOT_DIR_CANDIDATE} AND NOT EXISTS "${_VCPKG_ROOT_DIR_CANDIDATE}/.vcpkg-root") - get_filename_component(_VCPKG_ROOT_DIR_TEMP ${_VCPKG_ROOT_DIR_CANDIDATE} DIRECTORY) - if (_VCPKG_ROOT_DIR_TEMP STREQUAL _VCPKG_ROOT_DIR_CANDIDATE) # If unchanged, we have reached the root of the drive - message(FATAL_ERROR "Could not find .vcpkg-root") - else() - SET(_VCPKG_ROOT_DIR_CANDIDATE ${_VCPKG_ROOT_DIR_TEMP}) - endif() -endwhile() -set(_VCPKG_ROOT_DIR ${_VCPKG_ROOT_DIR_CANDIDATE}) +if(NOT DEFINED _VCPKG_ROOT_DIR) + # Detect .vcpkg-root to figure VCPKG_ROOT_DIR + set(_VCPKG_ROOT_DIR_CANDIDATE ${CMAKE_CURRENT_LIST_DIR}) + while(IS_DIRECTORY ${_VCPKG_ROOT_DIR_CANDIDATE} AND NOT EXISTS "${_VCPKG_ROOT_DIR_CANDIDATE}/.vcpkg-root") + get_filename_component(_VCPKG_ROOT_DIR_TEMP ${_VCPKG_ROOT_DIR_CANDIDATE} DIRECTORY) + if (_VCPKG_ROOT_DIR_TEMP STREQUAL _VCPKG_ROOT_DIR_CANDIDATE) # If unchanged, we have reached the root of the drive + message(FATAL_ERROR "Could not find .vcpkg-root") + else() + SET(_VCPKG_ROOT_DIR_CANDIDATE ${_VCPKG_ROOT_DIR_TEMP}) + endif() + endwhile() + set(_VCPKG_ROOT_DIR ${_VCPKG_ROOT_DIR_CANDIDATE} CACHE STRING "Vcpkg root directory") +endif() set(_VCPKG_INSTALLED_DIR ${_VCPKG_ROOT_DIR}/installed) if(CMAKE_BUILD_TYPE MATCHES "^Debug$" OR NOT DEFINED CMAKE_BUILD_TYPE) @@ -95,8 +98,6 @@ list(APPEND CMAKE_LIBRARY_PATH ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/manual-link ) -set(Boost_COMPILER "-vc140") - if (NOT DEFINED CMAKE_SYSTEM_VERSION AND _VCPKG_TARGET_TRIPLET_PLAT MATCHES "windows|uwp") include(${_VCPKG_ROOT_DIR}/scripts/cmake/vcpkg_get_windows_sdk.cmake) # This is used as an implicit parameter for vcpkg_get_windows_sdk @@ -124,11 +125,11 @@ set(CMAKE_SYSTEM_IGNORE_PATH "C:/OpenSSL-Win64/lib/VC/static" ) -set(CMAKE_PROGRAM_PATH ${CMAKE_PROGRAM_PATH} ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools) +list(APPEND CMAKE_PROGRAM_PATH ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools) file(GLOB _VCPKG_TOOLS_DIRS ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/*) foreach(_VCPKG_TOOLS_DIR ${_VCPKG_TOOLS_DIRS}) if(IS_DIRECTORY ${_VCPKG_TOOLS_DIR}) - set(CMAKE_PROGRAM_PATH ${CMAKE_PROGRAM_PATH} ${_VCPKG_TOOLS_DIR}) + list(APPEND CMAKE_PROGRAM_PATH ${_VCPKG_TOOLS_DIR}) endif() endforeach() @@ -167,6 +168,7 @@ macro(find_package name) unset(Boost_USE_STATIC_LIBS) unset(Boost_USE_MULTITHREADED) unset(Boost_USE_STATIC_RUNTIME) + set(Boost_COMPILER "-vc140") _find_package(${ARGV}) elseif("${name}" STREQUAL "ICU") function(_vcpkg_find_in_list) @@ -188,6 +190,17 @@ macro(find_package name) if(TIFF_LIBRARIES) list(APPEND TIFF_LIBRARIES ${LIBLZMA_LIBRARIES}) endif() + elseif("${name}" STREQUAL "MPI") + if(MPI_C_LIB_NAMES) + set(MPI_C_WORKS TRUE) + set(MPI_C_WRAPPER_FOUND TRUE) + endif() + if(MPI_CXX_LIB_NAMES) + set(MPI_CXX_WORKS TRUE) + set(MPI_CXX_WRAPPER_FOUND TRUE) + set(MPI_CXX_VALIDATE_SKIP_MPICXX TRUE) + endif() + _find_package(${ARGV}) else() _find_package(${ARGV}) endif() @@ -202,8 +215,11 @@ set(_UNUSED ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP}) if(NOT _CMAKE_IN_TRY_COMPILE) file(TO_CMAKE_PATH "${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}" _chainload_file) + file(TO_CMAKE_PATH "${_VCPKG_ROOT_DIR}" _root_dir) file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/vcpkg.config.cmake" "set(VCPKG_TARGET_TRIPLET \"${VCPKG_TARGET_TRIPLET}\" CACHE STRING \"\")\n" "set(VCPKG_APPLOCAL_DEPS \"${VCPKG_APPLOCAL_DEPS}\" CACHE STRING \"\")\n" - "set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE \"${_chainload_file}\" CACHE STRING \"\")\n") -endif() \ No newline at end of file + "set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE \"${_chainload_file}\" CACHE STRING \"\")\n" + "set(_VCPKG_ROOT_DIR \"${_root_dir}\" CACHE STRING \"\")\n" + ) +endif() -- cgit v1.2.3 From 19860a093370c5a57bd8c622e5e47177193c7c8e Mon Sep 17 00:00:00 2001 From: cDc Date: Sat, 9 Dec 2017 10:24:19 +0200 Subject: [tinyexif] add TinyEXIF library (#2221) --- scripts/buildsystems/vcpkg.cmake | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'scripts') diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index cdef610c1..22dc5d6b1 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -190,6 +190,12 @@ macro(find_package name) if(TIFF_LIBRARIES) list(APPEND TIFF_LIBRARIES ${LIBLZMA_LIBRARIES}) endif() + elseif("${name}" STREQUAL "tinyxml2") + _find_package(${ARGV}) + if(TARGET tinyxml2_static AND NOT TARGET tinyxml2) + add_library(tinyxml2 INTERFACE IMPORTED) + set_target_properties(tinyxml2 PROPERTIES INTERFACE_LINK_LIBRARIES "tinyxml2_static") + endif() elseif("${name}" STREQUAL "MPI") if(MPI_C_LIB_NAMES) set(MPI_C_WORKS TRUE) -- cgit v1.2.3 From 4567fa570916b0398ac0a65645e2074a4c8f0fd9 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Sat, 9 Dec 2017 17:25:12 -0800 Subject: [vcpkg-cmake-toolchain] Mark _VCPKG_ROOT_DIR as INTERNAL --- scripts/buildsystems/vcpkg.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 22dc5d6b1..71cf4e9b3 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -73,7 +73,7 @@ if(NOT DEFINED _VCPKG_ROOT_DIR) SET(_VCPKG_ROOT_DIR_CANDIDATE ${_VCPKG_ROOT_DIR_TEMP}) endif() endwhile() - set(_VCPKG_ROOT_DIR ${_VCPKG_ROOT_DIR_CANDIDATE} CACHE STRING "Vcpkg root directory") + set(_VCPKG_ROOT_DIR ${_VCPKG_ROOT_DIR_CANDIDATE} CACHE INTERNAL "Vcpkg root directory") endif() set(_VCPKG_INSTALLED_DIR ${_VCPKG_ROOT_DIR}/installed) -- cgit v1.2.3 From 1656cf7fa7f8fe7fa3d803c86fbd9ae8a649b719 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 12 Dec 2017 17:52:57 -0800 Subject: [powershell] Use \ instead of / for paths. Resolves #2358. Resolves #2361 --- scripts/VcpkgPowershellUtils.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/VcpkgPowershellUtils.ps1 b/scripts/VcpkgPowershellUtils.ps1 index 45f52b225..e394e540e 100644 --- a/scripts/VcpkgPowershellUtils.ps1 +++ b/scripts/VcpkgPowershellUtils.ps1 @@ -150,9 +150,9 @@ function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file, [Parameter(Mandatory=$true)][string]$outFilename) { vcpkgCreateDirectoryIfNotExists $destinationDir - $output = "$destinationDir/$outFilename" + $output = "$destinationDir\$outFilename" vcpkgRemoveItem $output - $destinationPartial = "$destinationDir/partially-extracted" + $destinationPartial = "$destinationDir\partially-extracted" vcpkgRemoveItem $destinationPartial vcpkgCreateDirectoryIfNotExists $destinationPartial -- cgit v1.2.3 From 7e1a737ba4ef1fb0377b75c4a64973f821a561d0 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Tue, 19 Dec 2017 16:11:20 -0800 Subject: [vcpkg-integrate-powershell] Fix $false bug. Fixes #2397. --- scripts/addPoshVcpkgToPowershellProfile.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/addPoshVcpkgToPowershellProfile.ps1 b/scripts/addPoshVcpkgToPowershellProfile.ps1 index 92a7573e4..7a12e7d34 100644 --- a/scripts/addPoshVcpkgToPowershellProfile.ps1 +++ b/scripts/addPoshVcpkgToPowershellProfile.ps1 @@ -5,11 +5,12 @@ function findExistingImportModuleDirectives([Parameter(Mandatory=$true)][string] { if (!(Test-Path $path)) { - return $false + return } $fileContents = Get-Content $path - return $fileContents -match 'Import-Module.+?(?=posh-vcpkg)' + $fileContents -match 'Import-Module.+?(?=posh-vcpkg)' + return } $scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition -- cgit v1.2.3 From 6cb6a61aaf5ef2c143f974e9f731778bcd3f5cbe Mon Sep 17 00:00:00 2001 From: Tsukasa Sugiura Date: Wed, 20 Dec 2017 09:18:13 +0900 Subject: Fix find Boost when can not be found Boost that installed with Vcpkg (#2395) * Fix find Boost when can not be found Boost that installed with Vcpkg Fix find Boost when can not be found Boost that installed with Vcpkg. Re-find package Boost uisng user specified options. * Fix regex of generators Fix regex of generators. Add ending position. * Fix Save and Resore Boost_COMPILER * [vcpkg-cmake-integration] Expand saved boost variables --- scripts/buildsystems/vcpkg.cmake | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 71cf4e9b3..b8d3fbdbb 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -31,9 +31,9 @@ else() set(_VCPKG_TARGET_TRIPLET_ARCH x86) elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 Win64$") set(_VCPKG_TARGET_TRIPLET_ARCH x64) - elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 ARM") + elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 ARM$") set(_VCPKG_TARGET_TRIPLET_ARCH arm) - elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017") + elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017$") set(_VCPKG_TARGET_TRIPLET_ARCH x86) else() find_program(_VCPKG_CL cl) @@ -165,11 +165,22 @@ endfunction() macro(find_package name) if("${name}" STREQUAL "Boost") + set(_Boost_USE_STATIC_LIBS ${Boost_USE_STATIC_LIBS}) + set(_Boost_USE_MULTITHREADED ${Boost_USE_MULTITHREADED}) + set(_Boost_USE_STATIC_RUNTIME ${Boost_USE_STATIC_RUNTIME}) + set(_Boost_COMPILER ${Boost_COMPILER}) unset(Boost_USE_STATIC_LIBS) unset(Boost_USE_MULTITHREADED) unset(Boost_USE_STATIC_RUNTIME) set(Boost_COMPILER "-vc140") _find_package(${ARGV}) + if(NOT Boost_FOUND) + set(Boost_USE_STATIC_LIBS ${_Boost_USE_STATIC_LIBS}) + set(Boost_USE_MULTITHREADED ${_Boost_USE_MULTITHREADED}) + set(Boost_USE_STATIC_RUNTIME ${_Boost_USE_STATIC_RUNTIME}) + set(Boost_COMPILER ${_Boost_COMPILER}) + _find_package(${ARGV}) + endif() elseif("${name}" STREQUAL "ICU") function(_vcpkg_find_in_list) list(FIND ARGV "COMPONENTS" COMPONENTS_IDX) -- cgit v1.2.3