From 06798b6528b777ba2e2a9af59774309db5cf5e52 Mon Sep 17 00:00:00 2001 From: glachancecmaisonneuve Date: Mon, 25 Sep 2017 13:05:32 -0400 Subject: Fix for BUILD_ARGS being always added in non ninja build --- scripts/cmake/vcpkg_build_cmake.cmake | 30 +++++++++++++++++++++++++++++- scripts/cmake/vcpkg_install_cmake.cmake | 6 ++++-- 2 files changed, 33 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_build_cmake.cmake b/scripts/cmake/vcpkg_build_cmake.cmake index 18e2a8b00..546071a36 100644 --- a/scripts/cmake/vcpkg_build_cmake.cmake +++ b/scripts/cmake/vcpkg_build_cmake.cmake @@ -1,3 +1,29 @@ +## # vcpkg_build_cmake +## +## Build a cmake project. +## +## ## Usage: +## ```cmake +## vcpkg_build_cmake([MSVC_64_TOOLSET] [DISABLE_PARALLEL]) +## ``` +## +## ## Parameters: +## ### MSVC_64_TOOLSET +## This adds the `/p:PreferredToolArchitecture=x64` switch to the underlying buildsystem parameters. Some large projects can run out of memory when linking if they use the 32-bit hosted tools. +## +## ### DISABLE_PARALLEL +## The /m parameter will not be added to the underlying buildsystem parameters +## +## ## Notes: +## This command should be preceeded by a call to [`vcpkg_configure_cmake()`](vcpkg_configure_cmake.md). +## Use [`vcpkg_install_cmake()`](vcpkg_configure_cmake.md) function if your CMake script supports the "install" target +## +## ## Examples: +## +## * [zlib](https://github.com/Microsoft/vcpkg/blob/master/ports/zlib/portfile.cmake) +## * [cpprestsdk](https://github.com/Microsoft/vcpkg/blob/master/ports/cpprestsdk/portfile.cmake) +## * [poco](https://github.com/Microsoft/vcpkg/blob/master/ports/poco/portfile.cmake) +## * [opencv](https://github.com/Microsoft/vcpkg/blob/master/ports/opencv/portfile.cmake) function(vcpkg_build_cmake) cmake_parse_arguments(_bc "MSVC_64_TOOLSET;DISABLE_PARALLEL" "" "" ${ARGN}) @@ -19,7 +45,9 @@ function(vcpkg_build_cmake) if(EXISTS ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/build.ninja) set(BUILD_ARGS -v) # verbose output - else() + endif() + + if(_bc_MSVC_64_TOOLSET) set(BUILD_ARGS ${MSVC_EXTRA_ARGS}) endif() diff --git a/scripts/cmake/vcpkg_install_cmake.cmake b/scripts/cmake/vcpkg_install_cmake.cmake index f778007ef..34ac15fe6 100644 --- a/scripts/cmake/vcpkg_install_cmake.cmake +++ b/scripts/cmake/vcpkg_install_cmake.cmake @@ -9,7 +9,7 @@ ## ## ## Parameters: ## ### MSVC_64_TOOLSET -## This adds the `/p:PreferredToolArchitecture=x64` switch if the underlying buildsystem is MSBuild. Some large projects can run out of memory when linking if they use the 32-bit hosted tools. +## This adds the `/p:PreferredToolArchitecture=x64` switch to the underlying buildsystem parameters. Some large projects can run out of memory when linking if they use the 32-bit hosted tools. ## ## ## Notes: ## This command should be preceeded by a call to [`vcpkg_configure_cmake()`](vcpkg_configure_cmake.md). @@ -41,7 +41,9 @@ function(vcpkg_install_cmake) if(EXISTS ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/build.ninja) set(BUILD_ARGS -v) # verbose output - else() + endif() + + if(_bc_MSVC_64_TOOLSET) set(BUILD_ARGS ${MSVC_EXTRA_ARGS}) endif() -- cgit v1.2.3 From c6149fae2f9f33d9ed363650aee6aea642574b0a Mon Sep 17 00:00:00 2001 From: Konstantin Podsvirov Date: Wed, 27 Sep 2017 02:57:51 +0300 Subject: [vcpkg-export-ifw] Usage QtIFW tools Download and use tools to make repository and installer --- scripts/fetchDependency.ps1 | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'scripts') diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index 2a23002a4..25447c19b 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -137,6 +137,17 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) $extractionType = $ExtractionType_ZIP $extractionFolder = "$downloadsDir\MinGit-2.14.1-32-bit" } + elseif($Dependency -eq "installerbase") + { + $requiredVersion = "3.1.81" + $downloadVersion = "3.1.81" + $url = "https://github.com/podsvirov/installer-framework/releases/download/cr203958-9/QtInstallerFramework-win-x86.zip" + $downloadPath = "$downloadsDir\QtInstallerFramework-win-x86.zip" + $expectedDownloadedFileHash = "f2ce23cf5cf9fc7ce409bdca49328e09a070c0026d3c8a04e4dfde7b05b83fe8" + $executableFromDownload = "$downloadsDir\QtInstallerFramework-win-x86\bin\installerbase.exe" + $extractionType = $ExtractionType_ZIP + $extractionFolder = $downloadsDir + } else { throw "Unknown program requested" -- cgit v1.2.3 From 0ba3c166d76a4484fd4d378dc7367f2794577a20 Mon Sep 17 00:00:00 2001 From: Jens Frederich Date: Wed, 4 Oct 2017 08:19:57 +0200 Subject: Get proxy credentials behind web proxy --- scripts/bootstrap.ps1 | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'scripts') diff --git a/scripts/bootstrap.ps1 b/scripts/bootstrap.ps1 index b7bc5afab..fa51de404 100644 --- a/scripts/bootstrap.ps1 +++ b/scripts/bootstrap.ps1 @@ -4,6 +4,10 @@ param( [string]$disableMetrics = "0" ) +$webclient=New-Object System.Net.WebClient +$creds=Get-Credential +$webclient.Proxy.Credentials=$creds + $scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition $vcpkgRootDir = & $scriptsDir\findFileRecursivelyUp.ps1 $scriptsDir .vcpkg-root -- cgit v1.2.3 From 6f763c5ca830c9e461e106c63959a60d33eb5e5b Mon Sep 17 00:00:00 2001 From: Konstantin Podsvirov Date: Thu, 5 Oct 2017 21:24:32 +0300 Subject: [vcpkg-export-ifw] Maintenance Tool Install maintenance tool and create Start menu shortcuts to manage, update and uninstall packages. --- scripts/ifw/maintenance.qs | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 scripts/ifw/maintenance.qs (limited to 'scripts') diff --git a/scripts/ifw/maintenance.qs b/scripts/ifw/maintenance.qs new file mode 100644 index 000000000..5cdad7225 --- /dev/null +++ b/scripts/ifw/maintenance.qs @@ -0,0 +1,46 @@ +// constructor +function Component() +{ + installer.installationStarted.connect(this, Component.prototype.onInstallationStarted); +} + +Component.prototype.onInstallationStarted = function() +{ + if (component.updateRequested() || component.installationRequested()) { + if (installer.value("os") == "win") + component.installerbaseBinaryPath = "@TargetDir@/tempmaintenancetool.exe"; + installer.setInstallerBaseBinary(component.installerbaseBinaryPath); + } +} + +Component.prototype.createOperations = function() +{ + // call the base createOperations + component.createOperations(); + + // only for windows online installer + if ( installer.value("os") == "win" && !installer.isOfflineOnly() ) + { + // shortcut to add or remove packages + component.addOperation( "CreateShortcut", + "@TargetDir@/maintenancetool.exe", + "@StartMenuDir@/Manage vcpkg.lnk", + " --manage-packages"); + // shortcut to update packages + component.addOperation( "CreateShortcut", + "@TargetDir@/maintenancetool.exe", + "@StartMenuDir@/Update vcpkg.lnk", + " --updater"); + } + + // create uninstall link only for windows + if (installer.value("os") == "win") + { + // shortcut to uninstaller + component.addOperation( "CreateShortcut", + "@TargetDir@/maintenancetool.exe", + "@StartMenuDir@/Uninstall vcpkg.lnk", + " --uninstall"); + } +} + -- cgit v1.2.3 From 2c9ee072da34a925f0faf22596e532d378930582 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Thu, 5 Oct 2017 17:49:28 -0700 Subject: [vcpkg_build_cmake] Refactor _build_ and _install_ into a single cmake script. Regenerate documentation. Remove MSVC_64_TOOLSET option because it's obsolete. --- scripts/cmake/vcpkg_build_cmake.cmake | 65 +++++++++++++++++-------------- scripts/cmake/vcpkg_configure_cmake.cmake | 2 + scripts/cmake/vcpkg_install_cmake.cmake | 50 +++--------------------- 3 files changed, 43 insertions(+), 74 deletions(-) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_build_cmake.cmake b/scripts/cmake/vcpkg_build_cmake.cmake index 546071a36..5dc81ec09 100644 --- a/scripts/cmake/vcpkg_build_cmake.cmake +++ b/scripts/cmake/vcpkg_build_cmake.cmake @@ -4,19 +4,21 @@ ## ## ## Usage: ## ```cmake -## vcpkg_build_cmake([MSVC_64_TOOLSET] [DISABLE_PARALLEL]) +## vcpkg_build_cmake([DISABLE_PARALLEL] [TARGET ]) ## ``` ## ## ## Parameters: -## ### MSVC_64_TOOLSET -## This adds the `/p:PreferredToolArchitecture=x64` switch to the underlying buildsystem parameters. Some large projects can run out of memory when linking if they use the 32-bit hosted tools. -## ## ### DISABLE_PARALLEL -## The /m parameter will not be added to the underlying buildsystem parameters +## The underlying buildsystem will be instructed to not parallelize +## +## ### TARGET +## The target passed to the cmake build command (`cmake --build . --target `). If not specified, no target will +## be passed. ## ## ## Notes: ## This command should be preceeded by a call to [`vcpkg_configure_cmake()`](vcpkg_configure_cmake.md). -## Use [`vcpkg_install_cmake()`](vcpkg_configure_cmake.md) function if your CMake script supports the "install" target +## You can use the alias [`vcpkg_install_cmake()`](vcpkg_configure_cmake.md) function if your CMake script supports the +## "install" target ## ## ## Examples: ## @@ -25,45 +27,50 @@ ## * [poco](https://github.com/Microsoft/vcpkg/blob/master/ports/poco/portfile.cmake) ## * [opencv](https://github.com/Microsoft/vcpkg/blob/master/ports/opencv/portfile.cmake) function(vcpkg_build_cmake) - cmake_parse_arguments(_bc "MSVC_64_TOOLSET;DISABLE_PARALLEL" "" "" ${ARGN}) - - set(MSVC_EXTRA_ARGS - "/p:VCPkgLocalAppDataDisabled=true" - "/p:UseIntelMKL=No" - ) + cmake_parse_arguments(_bc "DISABLE_PARALLEL" "TARGET;LOGFILE_ROOT" "" ${ARGN}) - # Specifies the architecture of the toolset, NOT the architecture of the produced binary - # This can help libraries that cause the linker to run out of memory. - # https://support.microsoft.com/en-us/help/2891057/linker-fatal-error-lnk1102-out-of-memory - if (_bc_MSVC_64_TOOLSET) - list(APPEND MSVC_EXTRA_ARGS "/p:PreferredToolArchitecture=x64") + if(NOT _bc_LOGFILE_ROOT) + set(_bc_LOGFILE_ROOT "build") endif() - if (NOT _bc_DISABLE_PARALLEL) - list(APPEND MSVC_EXTRA_ARGS "/m") + if(_VCPKG_CMAKE_GENERATOR MATCHES "Ninja") + set(BUILD_ARGS "-v") # verbose output + if (_bc_DISABLE_PARALLEL) + list(APPEND BUILD_ARGS "-j1") + endif() + elseif(_VCPKG_CMAKE_GENERATOR MATCHES "Visual Studio") + set(BUILD_ARGS + "/p:VCPkgLocalAppDataDisabled=true" + "/p:UseIntelMKL=No" + ) + if (NOT _bc_DISABLE_PARALLEL) + list(APPEND BUILD_ARGS "/m") + endif() + elseif(_VCPKG_CMAKE_GENERATOR MATCHES "NMake") + # No options are currently added for nmake builds + else() + message(FATAL_ERROR "Unrecognized GENERATOR setting from vcpkg_configure_cmake(). Valid generators are: Ninja, Visual Studio, and NMake Makefiles") endif() - if(EXISTS ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/build.ninja) - set(BUILD_ARGS -v) # verbose output - endif() - - if(_bc_MSVC_64_TOOLSET) - set(BUILD_ARGS ${MSVC_EXTRA_ARGS}) + if(_bc_TARGET) + set(TARGET_PARAM "--target" ${_bc_TARGET}) + else() + set(TARGET_PARAM) endif() message(STATUS "Build ${TARGET_TRIPLET}-rel") vcpkg_execute_required_process( - COMMAND ${CMAKE_COMMAND} --build . --config Release -- ${BUILD_ARGS} + COMMAND ${CMAKE_COMMAND} --build . --config Release ${TARGET_PARAM} -- ${BUILD_ARGS} WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel - LOGNAME build-${TARGET_TRIPLET}-rel + LOGNAME ${_bc_LOGFILE_ROOT}-${TARGET_TRIPLET}-rel ) message(STATUS "Build ${TARGET_TRIPLET}-rel done") message(STATUS "Build ${TARGET_TRIPLET}-dbg") vcpkg_execute_required_process( - COMMAND ${CMAKE_COMMAND} --build . --config Debug -- ${BUILD_ARGS} + COMMAND ${CMAKE_COMMAND} --build . --config Debug ${TARGET_PARAM} -- ${BUILD_ARGS} WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg - LOGNAME build-${TARGET_TRIPLET}-dbg + LOGNAME ${_bc_LOGFILE_ROOT}-${TARGET_TRIPLET}-dbg ) message(STATUS "Build ${TARGET_TRIPLET}-dbg done") endfunction() diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake index fecea8f1c..fe8c97c52 100644 --- a/scripts/cmake/vcpkg_configure_cmake.cmake +++ b/scripts/cmake/vcpkg_configure_cmake.cmake @@ -188,4 +188,6 @@ function(vcpkg_configure_cmake) LOGNAME config-${TARGET_TRIPLET}-dbg ) message(STATUS "Configuring ${TARGET_TRIPLET}-dbg done") + + set(_VCPKG_CMAKE_GENERATOR "${GENERATOR}" PARENT_SCOPE) endfunction() \ No newline at end of file diff --git a/scripts/cmake/vcpkg_install_cmake.cmake b/scripts/cmake/vcpkg_install_cmake.cmake index 34ac15fe6..ab72d054e 100644 --- a/scripts/cmake/vcpkg_install_cmake.cmake +++ b/scripts/cmake/vcpkg_install_cmake.cmake @@ -4,15 +4,15 @@ ## ## ## Usage: ## ```cmake -## vcpkg_install_cmake([MSVC_64_TOOLSET]) +## vcpkg_install_cmake(...) ## ``` ## ## ## Parameters: -## ### MSVC_64_TOOLSET -## This adds the `/p:PreferredToolArchitecture=x64` switch to the underlying buildsystem parameters. Some large projects can run out of memory when linking if they use the 32-bit hosted tools. +## See [`vcpkg_build_cmake()`](vcpkg_build_cmake.md). ## ## ## Notes: -## This command should be preceeded by a call to [`vcpkg_configure_cmake()`](vcpkg_configure_cmake.md). +## This command transparently forwards to [`vcpkg_build_cmake()`](vcpkg_build_cmake.md), adding a `TARGET install` +## parameter. ## ## ## Examples: ## @@ -21,45 +21,5 @@ ## * [poco](https://github.com/Microsoft/vcpkg/blob/master/ports/poco/portfile.cmake) ## * [opencv](https://github.com/Microsoft/vcpkg/blob/master/ports/opencv/portfile.cmake) function(vcpkg_install_cmake) - cmake_parse_arguments(_bc "MSVC_64_TOOLSET;DISABLE_PARALLEL" "" "" ${ARGN}) - - set(MSVC_EXTRA_ARGS - "/p:VCPkgLocalAppDataDisabled=true" - "/p:UseIntelMKL=No" - ) - - # Specifies the architecture of the toolset, NOT the architecture of the produced binary - # This can help libraries that cause the linker to run out of memory. - # https://support.microsoft.com/en-us/help/2891057/linker-fatal-error-lnk1102-out-of-memory - if (_bc_MSVC_64_TOOLSET) - list(APPEND MSVC_EXTRA_ARGS "/p:PreferredToolArchitecture=x64") - endif() - - if (NOT _bc_DISABLE_PARALLEL) - list(APPEND MSVC_EXTRA_ARGS "/m") - endif() - - if(EXISTS ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/build.ninja) - set(BUILD_ARGS -v) # verbose output - endif() - - if(_bc_MSVC_64_TOOLSET) - set(BUILD_ARGS ${MSVC_EXTRA_ARGS}) - endif() - - message(STATUS "Package ${TARGET_TRIPLET}-rel") - vcpkg_execute_required_process( - COMMAND ${CMAKE_COMMAND} --build . --config Release --target install -- ${BUILD_ARGS} - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel - LOGNAME package-${TARGET_TRIPLET}-rel - ) - message(STATUS "Package ${TARGET_TRIPLET}-rel done") - - message(STATUS "Package ${TARGET_TRIPLET}-dbg") - vcpkg_execute_required_process( - COMMAND ${CMAKE_COMMAND} --build . --config Debug --target install -- ${BUILD_ARGS} - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg - LOGNAME package-${TARGET_TRIPLET}-dbg - ) - message(STATUS "Package ${TARGET_TRIPLET}-dbg done") + vcpkg_build_cmake(LOGFILE_ROOT install TARGET install ${ARGN}) endfunction() -- cgit v1.2.3 From 9a963f7eff1981d4e894ea8b297d092cda60b764 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 5 Oct 2017 13:51:28 -0700 Subject: Overhaul VS selection. Add triplet option to specify VS instance --- scripts/get_triplet_environment.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/get_triplet_environment.cmake b/scripts/get_triplet_environment.cmake index 69e06bf97..b32f840d2 100644 --- a/scripts/get_triplet_environment.cmake +++ b/scripts/get_triplet_environment.cmake @@ -5,4 +5,5 @@ message("c35112b6-d1ba-415b-aa5d-81de856ef8eb") message("VCPKG_TARGET_ARCHITECTURE=${VCPKG_TARGET_ARCHITECTURE}") message("VCPKG_CMAKE_SYSTEM_NAME=${VCPKG_CMAKE_SYSTEM_NAME}") message("VCPKG_CMAKE_SYSTEM_VERSION=${VCPKG_CMAKE_SYSTEM_VERSION}") -message("VCPKG_PLATFORM_TOOLSET=${VCPKG_PLATFORM_TOOLSET}") \ No newline at end of file +message("VCPKG_PLATFORM_TOOLSET=${VCPKG_PLATFORM_TOOLSET}") +message("VCPKG_VISUAL_STUDIO_PATH=${VCPKG_VISUAL_STUDIO_PATH}") \ No newline at end of file -- cgit v1.2.3 From eca5a8b8d48d24c1a50fac58797af45dc5e83110 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 5 Oct 2017 14:27:36 -0700 Subject: Add vswhere in fetchDependency.ps1 --- scripts/fetchDependency.ps1 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index 25447c19b..80d6d2abb 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -119,11 +119,21 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) $requiredVersion = "4.1.0" $downloadVersion = "4.1.0" $url = "https://dist.nuget.org/win-x86-commandline/v4.1.0/nuget.exe" - $downloadPath = "$downloadsDir\nuget-4.1.0\nuget.exe" + $downloadPath = "$downloadsDir\nuget-$downloadVersion\nuget.exe" $expectedDownloadedFileHash = "4c1de9b026e0c4ab087302ff75240885742c0faa62bd2554f913bbe1f6cb63a0" $executableFromDownload = $downloadPath $extractionType = $ExtractionType_NO_EXTRACTION_REQUIRED } + elseif($Dependency -eq "vswhere") + { + $requiredVersion = "2.1.4" + $downloadVersion = "2.1.4" + $url = "https://github.com/Microsoft/vswhere/releases/download/2.1.4/vswhere.exe" + $downloadPath = "$downloadsDir\vswhere-$downloadVersion\vswhere.exe" + $expectedDownloadedFileHash = "548fb9dfeed59bc4ddcce739a5729e9c8dd5932cd60ff6f74727ee069e7da458" + $executableFromDownload = $downloadPath + $extractionType = $ExtractionType_NO_EXTRACTION_REQUIRED + } elseif($Dependency -eq "git") { $requiredVersion = "2.14.1" -- cgit v1.2.3 From f0c23aeb6b238ee0ba2dc272ee4c193f2f777460 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 5 Oct 2017 18:25:34 -0700 Subject: Completely rework Visual Studio detection - Now using vswhere.exe to detect all VS instance (2015 + 2017) - Default version preference order is now: stable, prerelease, legacy - Within each preference weight, the latest one is chosen - findVisualStudioInstallationInstances.ps1 now has a parameter to choose VS instance --- scripts/findAnyMSBuildWithCppPlatformToolset.ps1 | 172 ++++------------------ scripts/findVisualStudioInstallationInstances.ps1 | 49 +++--- 2 files changed, 55 insertions(+), 166 deletions(-) (limited to 'scripts') diff --git a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 index f72491e5d..632cc2cdf 100644 --- a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 +++ b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 @@ -1,164 +1,50 @@ [CmdletBinding()] param( [Parameter(Mandatory=$False)] - [switch]$DisableVS2017 = $False, - - [Parameter(Mandatory=$False)] - [switch]$DisableVS2015 = $False + [string]$explicitlyRequestedVSPath = "" ) -if ($DisableVS2017 -and $DisableVS2015) -{ - throw "Both VS2015 and VS2017 were disabled." -} - -function New-MSBuildInstance() -{ - param ($msbuildExePath, $toolsetVersion) - - $instance = new-object PSObject - $instance | add-member -type NoteProperty -Name msbuildExePath -Value $msbuildExePath - $instance | add-member -type NoteProperty -Name toolsetVersion -Value $toolsetVersion +$explicitlyRequestedVSPath = $explicitlyRequestedVSPath -replace "\\$" # Remove potential trailing backslash - return $instance -} - -Write-Verbose "Executing $($MyInvocation.MyCommand.Name) with DisableVS2017=$DisableVS2017, DisableVS2015=$DisableVS2015" $scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition - -$validInstances = New-Object System.Collections.ArrayList - -# VS2017 -Write-Verbose "`n`n" -Write-Verbose "Checking for MSBuild from VS2017 instances..." -$VisualStudio2017InstallationInstances = & $scriptsDir\findVisualStudioInstallationInstances.ps1 -Write-Verbose "VS2017 Candidates: $([system.String]::Join(',', $VisualStudio2017InstallationInstances))" -foreach ($instanceCandidate in $VisualStudio2017InstallationInstances) -{ - $VCFolder= "$instanceCandidate\VC\Tools\MSVC\" - - if (Test-Path $VCFolder) - { - $instance = New-MSBuildInstance "$instanceCandidate\MSBuild\15.0\Bin\MSBuild.exe" "v141" - Write-Verbose "Found $instance" - $validInstances.Add($instance) > $null - } -} - -# VS2015 - in Program Files -Write-Verbose "`n`n" -Write-Verbose "Checking for MSBuild from VS2015 in Program Files..." -$CandidateProgramFiles = $(& $scriptsDir\getProgramFiles32bit.ps1), $(& $scriptsDir\getProgramFilesPlatformBitness.ps1) -Write-Verbose "Program Files Candidate locations: $([system.String]::Join(',', $CandidateProgramFiles))" -foreach ($ProgramFiles in $CandidateProgramFiles) -{ - $clExe= "$ProgramFiles\Microsoft Visual Studio 14.0\VC\bin\cl.exe" - - if (!(Test-Path $clExe)) - { - Write-Verbose "$clExe - Not Found" - continue - } - - Write-Verbose "$clExe - Found" - $instance = New-MSBuildInstance "$ProgramFiles\MSBuild\14.0\Bin\MSBuild.exe" "v140" - Write-Verbose "Found $instance" - $validInstances.Add($instance) > $null -} - -# VS2015 - through the registry -function NewCppRegistryPair() -{ - param ($visualStudioEntry, $msBuildEntry) - - $instance = new-object PSObject - $instance | add-member -type NoteProperty -Name visualStudioEntry -Value $visualStudioEntry - $instance | add-member -type NoteProperty -Name msBuildEntry -Value $msBuildEntry - - return $instance -} - -Write-Verbose "`n`n" -Write-Verbose "Checking for MSBuild from VS2015 through the registry..." - -$registryPairs = -$(NewCppRegistryPair "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\visualstudio\14.0" "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\msbuild\toolsversions\14.0"), -$(NewCppRegistryPair "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\visualstudio\14.0" "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\msbuild\toolsversions\14.0") - -foreach ($pair in $registryPairs) +$VisualStudioInstallationInstances = & $scriptsDir\findVisualStudioInstallationInstances.ps1 +Write-Verbose "VS Candidates:`n`r$([system.String]::Join([Environment]::NewLine, $VisualStudioInstallationInstances))" +foreach ($instanceCandidate in $VisualStudioInstallationInstances) { - $vsEntry = $pair.visualStudioEntry - try - { - $VS14InstallDir = $(gp $vsEntry InstallDir -erroraction Stop | % { $_.InstallDir }) - Write-Verbose "$vsEntry\InstallDir - Found" - } - catch - { - Write-Verbose "$vsEntry\InstallDir - Not Found" - continue - } - - Write-Verbose "$VS14InstallDir - Obtained from registry" - # We want "${VS14InstallDir}..\..\VC\bin\cl.exe" - # Doing Split-path to avoid the ..\.. from appearing in the output - $clExePath = Split-path $VS14InstallDir -Parent - $clExePath = Split-path $clExePath -Parent - $clExePath = "$clExePath\VC\bin\cl.exe" - - if (!(Test-Path $clExePath)) - { - Write-Verbose "$clExePath - Not Found" - continue - } + Write-Verbose "Inspecting: $instanceCandidate" + $split = $instanceCandidate -split "::" + # $preferenceWeight = $split[0] + # $releaseType = $split[1] + $version = $split[2] + $path = $split[3] - Write-Verbose "$clExePath - Found" - - $msbuildEntry = $pair.msBuildEntry - try - { - $MSBuild14 = $(gp $msbuildEntry MSBuildToolsPath -erroraction Stop | % { $_.MSBuildToolsPath }) - Write-Verbose "$msbuildEntry\MSBuildToolsPath - Found" - } - catch - { - Write-Verbose "$msbuildEntry\MSBuildToolsPath - Not Found" - continue - } - - Write-Verbose "${MSBuild14} - Obtained from registry" - $msbuildPath = "${MSBuild14}MSBuild.exe" - if (!(Test-Path $msbuildPath)) + if ($explicitlyRequestedVSPath -ne "" -and $explicitlyRequestedVSPath -ne $path) { - Write-Verbose "$msbuildPath - Not Found" + Write-Verbose "Skipping: $instanceCandidate" continue } - $instance = New-MSBuildInstance $msbuildPath "v140" - Write-Verbose "Found $instance" - $validInstances.Add($instance) > $null -} - -Write-Verbose "`n`n`n" -Write-Verbose "The following MSBuild instances were found:" -foreach ($instance in $validInstances) -{ - Write-Verbose $instance -} - -# Selecting -foreach ($instance in $validInstances) -{ - if (!$DisableVS2017 -and $instance.toolsetVersion -eq "v141") + $majorVersion = $version.Substring(0,2); + if ($majorVersion -eq "15") { - return $instance.msbuildExePath, $instance.toolsetVersion + $VCFolder= "$path\VC\Tools\MSVC\" + if (Test-Path $VCFolder) + { + Write-Verbose "Picking: $instanceCandidate" + return "$path\MSBuild\15.0\Bin\MSBuild.exe", "v141" + } } - if (!$DisableVS2015 -and $instance.toolsetVersion -eq "v140") + if ($majorVersion -eq "14") { - return $instance.msbuildExePath, $instance.toolsetVersion + $clExe= "$path\VC\bin\cl.exe" + if (Test-Path $clExe) + { + Write-Verbose "Picking: $instanceCandidate" + $programFilesPath = split-path -parent $path + return "$programFilesPath\MSBuild\14.0\Bin\MSBuild.exe", "v140" + } } } - throw "Could not find MSBuild version with C++ support. VS2015 or VS2017 (with C++) needs to be installed." \ No newline at end of file diff --git a/scripts/findVisualStudioInstallationInstances.ps1 b/scripts/findVisualStudioInstallationInstances.ps1 index ca807980c..8c67ef6d6 100644 --- a/scripts/findVisualStudioInstallationInstances.ps1 +++ b/scripts/findVisualStudioInstallationInstances.ps1 @@ -4,32 +4,35 @@ param( ) $scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition -$vcpkgRootDir = & $scriptsDir\findFileRecursivelyUp.ps1 $scriptsDir .vcpkg-root +$vswhereExe = & $scriptsDir\fetchDependency.ps1 "vswhere" -$downloadsDir = "$vcpkgRootDir\downloads" +$output = & $vswhereExe -prerelease -legacy -format xml +[xml]$asXml = $output -$nugetexe = & $scriptsDir\fetchDependency.ps1 "nuget" -$nugetPackageDir = "$downloadsDir\nuget-packages" - -$SetupAPIVersion = "1.8.24" -Write-Verbose "Fetching Microsoft.VisualStudio.Setup.Configuration.Native@$SetupAPIVersion from NuGet." -$nugetOutput = & $nugetexe install Microsoft.VisualStudio.Setup.Configuration.Native -Version $SetupAPIVersion -OutputDirectory $nugetPackageDir -Source "https://api.nuget.org/v3/index.json" -nocache 2>&1 -Write-Verbose "Fetching Microsoft.VisualStudio.Setup.Configuration.Native@$SetupAPIVersion from NuGet. Done." - -$SetupConsoleExe = "$nugetPackageDir\Microsoft.VisualStudio.Setup.Configuration.Native.$SetupAPIVersion\tools\x86\Microsoft.VisualStudio.Setup.Configuration.Console.exe" - -if (!(Test-Path $SetupConsoleExe)) +$results = New-Object System.Collections.ArrayList +foreach ($instance in $asXml.instances.instance) { - throw $nugetOutput + $installationPath = $instance.InstallationPath -replace "\\$" # Remove potential trailing backslash + $installationVersion = $instance.InstallationVersion + $isPrerelease = $instance.IsPrerelease + if ($isPrerelease -eq 0) + { + $releaseType = "PreferenceWeight3::StableRelease" + } + elseif ($isPrerelease -eq 1) + { + $releaseType = "PreferenceWeight2::PreRelease" + } + else + { + $releaseType = "PreferenceWeight1::Legacy" + } + + # Placed like that for easy sorting according to preference + $results.Add("${releaseType}::${installationVersion}::${installationPath}") > $null } -$instances = & $SetupConsoleExe -nologo -value InstallationPath 2>&1 -$instanceCount = $instances.Length - -# The last item can be empty -if ($instanceCount -gt 0 -and $instances[$instanceCount - 1] -eq "") -{ - $instances = $instances[0..($instanceCount - 2)] -} +$results.Sort() +$results.Reverse() -return $instances +return $results \ No newline at end of file -- cgit v1.2.3 From 0643bd6581182a537b23c885b1c6b27e33e61dc4 Mon Sep 17 00:00:00 2001 From: Daniel Strommen Date: Thu, 5 Oct 2017 19:47:41 -0700 Subject: Fix Win10SDK detection during Bootstrap When multiple Win10 SDK's are installed, like Insider previews, depending on the SDK installation, it may not contain the um headers. There is already a loop for trying to find the newest Win10 SDK that has full headers, but it's returning at the first failure, rather than continuing the loop to the next iteration. Also, use Join-Path instead of manual path appending, to normalize the extra \ at the end of the sdk root value. In some cases paths with double backslashes can be interpreted as a fallback syntax for UNC paths. Join-Path normalizes the path appropriately. --- scripts/getWindowsSDK.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/getWindowsSDK.ps1 b/scripts/getWindowsSDK.ps1 index 9aebae8e3..f4537ddc3 100644 --- a/scripts/getWindowsSDK.ps1 +++ b/scripts/getWindowsSDK.ps1 @@ -20,7 +20,7 @@ $validInstances = New-Object System.Collections.ArrayList # Windows 10 SDK function CheckWindows10SDK($path) { - $folder = "$path\Include" + $folder = (Join-Path $path "Include") if (!(Test-Path $folder)) { Write-Verbose "$folder - Not Found" @@ -37,7 +37,7 @@ function CheckWindows10SDK($path) if (!(Test-Path $windowsheader)) { Write-Verbose "$windowsheader - Not Found" - return + continue } Write-Verbose "$windowsheader - Found" @@ -45,7 +45,7 @@ function CheckWindows10SDK($path) if (!(Test-Path $ddkheader)) { Write-Verbose "$ddkheader - Not Found" - return + continue } Write-Verbose "$ddkheader - Found" @@ -106,4 +106,4 @@ foreach ($instance in $validInstances) } } -throw "Could not detect a Windows SDK / TargetPlatformVersion" \ No newline at end of file +throw "Could not detect a Windows SDK / TargetPlatformVersion" -- cgit v1.2.3 From e3527b23ea291489fae1363528ecde07c9191f95 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 5 Oct 2017 22:44:49 -0700 Subject: Don't assume VS2015 is in C:\Program Files (x86)\ --- scripts/findAnyMSBuildWithCppPlatformToolset.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 index 632cc2cdf..e9fb60cb2 100644 --- a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 +++ b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 @@ -41,7 +41,7 @@ foreach ($instanceCandidate in $VisualStudioInstallationInstances) if (Test-Path $clExe) { Write-Verbose "Picking: $instanceCandidate" - $programFilesPath = split-path -parent $path + $programFilesPath = & $scriptsDir\getProgramFiles32bit.ps1 return "$programFilesPath\MSBuild\14.0\Bin\MSBuild.exe", "v140" } } -- cgit v1.2.3 From cf7762a82ea044b33ddadd6b1d01a4035af3bf9d Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Fri, 6 Oct 2017 00:49:41 -0700 Subject: [vcpkg-internal-ci] Remove chakracore due to dependency on cor.h --- scripts/internalCI.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/internalCI.ps1 b/scripts/internalCI.ps1 index 67871acc1..887eb7bea 100644 --- a/scripts/internalCI.ps1 +++ b/scripts/internalCI.ps1 @@ -14,7 +14,7 @@ if (-not $?) { throw $? } ./vcpkg.exe install azure-storage-cpp cpprestsdk:x64-windows-static cpprestsdk:x86-uwp if (-not $?) { throw $? } -./vcpkg.exe install bond chakracore cryptopp zlib expat sdl2 curl sqlite3 libuv protobuf:x64-windows sfml opencv:x64-windows uwebsockets uwebsockets:x64-windows-static +./vcpkg.exe install bond cryptopp zlib expat sdl2 curl sqlite3 libuv protobuf:x64-windows sfml opencv:x64-windows uwebsockets uwebsockets:x64-windows-static if (-not $?) { throw $? } ./vcpkg.exe install opencv:x86-uwp boost:x86-uwp -- cgit v1.2.3 From f0f25b1cb714e07766b998bb205314498f891416 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 6 Oct 2017 02:04:04 -0700 Subject: Remove unused variable --- scripts/getWindowsSDK.ps1 | 1 - 1 file changed, 1 deletion(-) (limited to 'scripts') diff --git a/scripts/getWindowsSDK.ps1 b/scripts/getWindowsSDK.ps1 index f4537ddc3..8ef26a436 100644 --- a/scripts/getWindowsSDK.ps1 +++ b/scripts/getWindowsSDK.ps1 @@ -13,7 +13,6 @@ if ($DisableWin10SDK -and $DisableWin81SDK) } Write-Verbose "Executing $($MyInvocation.MyCommand.Name)" -$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition $validInstances = New-Object System.Collections.ArrayList -- cgit v1.2.3 From cd4142d3cac144c6f4e558cdfe8403e1987ff833 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 6 Oct 2017 14:06:02 -0700 Subject: Bump version of nuget to 4.3.0 (was 4.1.0) --- scripts/fetchDependency.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index 80d6d2abb..665376baf 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -116,11 +116,11 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) } elseif($Dependency -eq "nuget") { - $requiredVersion = "4.1.0" - $downloadVersion = "4.1.0" - $url = "https://dist.nuget.org/win-x86-commandline/v4.1.0/nuget.exe" + $requiredVersion = "4.3.0" + $downloadVersion = "4.3.0" + $url = "https://dist.nuget.org/win-x86-commandline/v4.3.0/nuget.exe" $downloadPath = "$downloadsDir\nuget-$downloadVersion\nuget.exe" - $expectedDownloadedFileHash = "4c1de9b026e0c4ab087302ff75240885742c0faa62bd2554f913bbe1f6cb63a0" + $expectedDownloadedFileHash = "386da77a8cf2b63d1260b7020feeedabfe3b65ab31d20e6a313a530865972f3a" $executableFromDownload = $downloadPath $extractionType = $ExtractionType_NO_EXTRACTION_REQUIRED } -- cgit v1.2.3 From ab7a1abc93473dc1b7fcb341a4d104e3a77afd87 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 9 Oct 2017 16:38:21 -0700 Subject: [VS detection] Add -products * flag to vswhere. This includes Express and BuildTools SKUs --- scripts/findVisualStudioInstallationInstances.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/findVisualStudioInstallationInstances.ps1 b/scripts/findVisualStudioInstallationInstances.ps1 index 8c67ef6d6..b2f186478 100644 --- a/scripts/findVisualStudioInstallationInstances.ps1 +++ b/scripts/findVisualStudioInstallationInstances.ps1 @@ -6,7 +6,7 @@ param( $scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition $vswhereExe = & $scriptsDir\fetchDependency.ps1 "vswhere" -$output = & $vswhereExe -prerelease -legacy -format xml +$output = & $vswhereExe -prerelease -legacy -products * -format xml [xml]$asXml = $output $results = New-Object System.Collections.ArrayList -- cgit v1.2.3 From b6512bace19d6c28cce71a0c2e8e28ab77d3ef56 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 9 Oct 2017 16:40:13 -0700 Subject: [vswhere.exe] Update to vesrion 2.2.3 (was 2.1.4) --- scripts/fetchDependency.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index 665376baf..bc58f4436 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -126,11 +126,11 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) } elseif($Dependency -eq "vswhere") { - $requiredVersion = "2.1.4" - $downloadVersion = "2.1.4" - $url = "https://github.com/Microsoft/vswhere/releases/download/2.1.4/vswhere.exe" + $requiredVersion = "2.2.3" + $downloadVersion = "2.2.3" + $url = "https://github.com/Microsoft/vswhere/releases/download/2.2.3/vswhere.exe" $downloadPath = "$downloadsDir\vswhere-$downloadVersion\vswhere.exe" - $expectedDownloadedFileHash = "548fb9dfeed59bc4ddcce739a5729e9c8dd5932cd60ff6f74727ee069e7da458" + $expectedDownloadedFileHash = "5f19066ac91635ad17d33fe0f79fc63c672a46f98c0358589a90163bcb2733e8" $executableFromDownload = $downloadPath $extractionType = $ExtractionType_NO_EXTRACTION_REQUIRED } -- cgit v1.2.3 From 00d89dbd66a658174233920d6be2a85f282ef29f Mon Sep 17 00:00:00 2001 From: Mikhail Paulyshka Date: Sun, 24 Sep 2017 16:01:37 +0300 Subject: vcpkg: initial ARM64 support --- scripts/cmake/vcpkg_configure_cmake.cmake | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake index fe8c97c52..bfb6a19fd 100644 --- a/scripts/cmake/vcpkg_configure_cmake.cmake +++ b/scripts/cmake/vcpkg_configure_cmake.cmake @@ -78,14 +78,20 @@ function(vcpkg_configure_cmake) set(GENERATOR "Visual Studio 15 2017") elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") set(GENERATOR "Visual Studio 15 2017 Win64") - elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH STREQUAL "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") set(GENERATOR "Visual Studio 15 2017 ARM") + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH STREQUAL "arm64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + set(GENERATOR "Visual Studio 15 2017") + set(ARCH "ARM64") elseif(TRIPLET_SYSTEM_ARCH MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") set(GENERATOR "Visual Studio 15 2017") elseif(TRIPLET_SYSTEM_ARCH MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") set(GENERATOR "Visual Studio 15 2017 Win64") - elseif(TRIPLET_SYSTEM_ARCH MATCHES "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + elseif(TRIPLET_SYSTEM_ARCH STREQUAL "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") set(GENERATOR "Visual Studio 15 2017 ARM") + elseif(TRIPLET_SYSTEM_ARCH STREQUAL "arm64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + set(GENERATOR "Visual Studio 15 2017") + set(ARCH "ARM64") endif() # If we use Ninja, make sure it's on PATH @@ -139,6 +145,12 @@ function(vcpkg_configure_cmake) "-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON" ) + if(DEFINED ARCH) + list(APPEND _csc_OPTIONS + "-A${ARCH}" + ) + endif() + if(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL dynamic) list(APPEND _csc_OPTIONS_DEBUG "-DCMAKE_CXX_FLAGS_DEBUG=/D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 ${VCPKG_CXX_FLAGS_DEBUG}" -- cgit v1.2.3 From 5c66f301b9d7aa27a11059cee970e579f039c66c Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Thu, 12 Oct 2017 08:22:50 -0700 Subject: [vcpkg-scripts] Remove double expansions --- scripts/cmake/vcpkg_acquire_depot_tools.cmake | 2 +- scripts/cmake/vcpkg_download_distfile.cmake | 2 +- scripts/cmake/vcpkg_find_acquire_program.cmake | 11 +++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_acquire_depot_tools.cmake b/scripts/cmake/vcpkg_acquire_depot_tools.cmake index 1cc375725..009ba40f1 100644 --- a/scripts/cmake/vcpkg_acquire_depot_tools.cmake +++ b/scripts/cmake/vcpkg_acquire_depot_tools.cmake @@ -26,7 +26,7 @@ function(vcpkg_acquire_depot_tools PATH_TO_ROOT_OUT) set(download_success 1) endif() - if (NOT ${download_success}) + if (NOT download_success) message(FATAL_ERROR "\n" " Failed to download file.\n" diff --git a/scripts/cmake/vcpkg_download_distfile.cmake b/scripts/cmake/vcpkg_download_distfile.cmake index 006570195..b8acfc823 100644 --- a/scripts/cmake/vcpkg_download_distfile.cmake +++ b/scripts/cmake/vcpkg_download_distfile.cmake @@ -78,7 +78,7 @@ function(vcpkg_download_distfile VAR) endif() endforeach(url) - if (NOT ${download_success}) + if (NOT download_success) message(FATAL_ERROR "\n" " Failed to download file.\n" diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake index 3c6dfae08..8d167e1c2 100644 --- a/scripts/cmake/vcpkg_find_acquire_program.cmake +++ b/scripts/cmake/vcpkg_find_acquire_program.cmake @@ -34,7 +34,8 @@ ## * [openssl](https://github.com/Microsoft/vcpkg/blob/master/ports/openssl/portfile.cmake) ## * [qt5](https://github.com/Microsoft/vcpkg/blob/master/ports/qt5/portfile.cmake) function(vcpkg_find_acquire_program VAR) - if(${VAR} AND NOT ${VAR} MATCHES "-NOTFOUND") + set(EXPANDED_VAR ${${VAR}}) + if(EXPANDED_VAR) return() endif() @@ -153,7 +154,8 @@ function(vcpkg_find_acquire_program VAR) macro(do_find) if(NOT DEFINED REQUIRED_INTERPRETER) - find_program(${VAR} ${PROGNAME} PATHS ${PATHS}) + find_program(FOUND_PROG ${PROGNAME} PATHS ${PATHS}) + set(${VAR} ${FOUND_PROG}) else() vcpkg_find_acquire_program(${REQUIRED_INTERPRETER}) find_file(SCRIPT ${SCRIPTNAME} PATHS ${PATHS}) @@ -162,7 +164,8 @@ function(vcpkg_find_acquire_program VAR) endmacro() do_find() - if(${VAR} MATCHES "-NOTFOUND") + set(FOUND_PROG ${${VAR}}) + if(FOUND_PROG MATCHES "-NOTFOUND") file(DOWNLOAD ${URL} ${DOWNLOADS}/${ARCHIVE} EXPECTED_HASH SHA512=${HASH} SHOW_PROGRESS @@ -173,7 +176,7 @@ function(vcpkg_find_acquire_program VAR) else() get_filename_component(ARCHIVE_EXTENSION ${ARCHIVE} EXT) string(TOLOWER "${ARCHIVE_EXTENSION}" ARCHIVE_EXTENSION) - if(${ARCHIVE_EXTENSION} STREQUAL ".msi") + if(ARCHIVE_EXTENSION STREQUAL ".msi") file(TO_NATIVE_PATH "${DOWNLOADS}/${ARCHIVE}" ARCHIVE_NATIVE_PATH) file(TO_NATIVE_PATH "${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR}" DESTINATION_NATIVE_PATH) execute_process( -- cgit v1.2.3 From 9ddc98988fb8d7c886963fa7568395ecd5785eaa Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Thu, 12 Oct 2017 10:52:00 -0700 Subject: [vcpkg-scripts] Detect and prompt for proxy in more cases --- scripts/bootstrap.ps1 | 4 ---- scripts/fetchDependency.ps1 | 20 +++++++++++--------- 2 files changed, 11 insertions(+), 13 deletions(-) (limited to 'scripts') diff --git a/scripts/bootstrap.ps1 b/scripts/bootstrap.ps1 index fa51de404..b7bc5afab 100644 --- a/scripts/bootstrap.ps1 +++ b/scripts/bootstrap.ps1 @@ -4,10 +4,6 @@ param( [string]$disableMetrics = "0" ) -$webclient=New-Object System.Net.WebClient -$creds=Get-Credential -$webclient.Proxy.Credentials=$creds - $scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition $vcpkgRootDir = & $scriptsDir\findFileRecursivelyUp.ps1 $scriptsDir .vcpkg-root diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index b6144d581..2ee87bcff 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -82,17 +82,19 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) New-Item -ItemType directory -Path $downloadDir | Out-Null } + $WC = New-Object System.Net.WebClient + $ProxyAuth = !$WC.Proxy.IsBypassed($url) + if ($ProxyAuth) + { + $ProxyCred = Get-Credential -Message "Enter credentials for Proxy Authentication" + $PSDefaultParameterValues.Add("Start-BitsTransfer:ProxyAuthentication","Basic") + $PSDefaultParameterValues.Add("Start-BitsTransfer:ProxyCredential",$ProxyCred) + $WC.Proxy.Credentials=$ProxyCred + } + if (($PSVersionTable.PSEdition -ne "Core") -and ($Dependency -ne "git")) # git fails with BITS { try { - $WC = New-Object System.Net.WebClient - $ProxyAuth = !$WC.Proxy.IsBypassed($url) - If($ProxyAuth){ - $ProxyCred = Get-Credential -Message "Enter credentials for Proxy Authentication" - $PSDefaultParameterValues.Add("Start-BitsTransfer:ProxyAuthentication","Basic") - $PSDefaultParameterValues.Add("Start-BitsTransfer:ProxyCredential",$ProxyCred) - } - Start-BitsTransfer -Source $url -Destination $downloadPath -ErrorAction Stop } catch [System.Exception] { @@ -106,7 +108,7 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) if (!(Test-Path $downloadPath)) { Write-Verbose("Downloading $Dependency...") - (New-Object System.Net.WebClient).DownloadFile($url, $downloadPath) + $WC.DownloadFile($url, $downloadPath) } } -- cgit v1.2.3 From 53ad1402514481c581a7b3bd1b0ffbcea9aaa902 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Thu, 12 Oct 2017 11:54:47 -0700 Subject: [vcpkg-scripts] Hotpatch revert changes to vcpkg_find_acquire_program.cmake. --- scripts/cmake/vcpkg_find_acquire_program.cmake | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake index 8d167e1c2..51e394bf1 100644 --- a/scripts/cmake/vcpkg_find_acquire_program.cmake +++ b/scripts/cmake/vcpkg_find_acquire_program.cmake @@ -154,8 +154,7 @@ function(vcpkg_find_acquire_program VAR) macro(do_find) if(NOT DEFINED REQUIRED_INTERPRETER) - find_program(FOUND_PROG ${PROGNAME} PATHS ${PATHS}) - set(${VAR} ${FOUND_PROG}) + find_program(${VAR} ${PROGNAME} PATHS ${PATHS}) else() vcpkg_find_acquire_program(${REQUIRED_INTERPRETER}) find_file(SCRIPT ${SCRIPTNAME} PATHS ${PATHS}) @@ -164,8 +163,7 @@ function(vcpkg_find_acquire_program VAR) endmacro() do_find() - set(FOUND_PROG ${${VAR}}) - if(FOUND_PROG MATCHES "-NOTFOUND") + if("${${VAR}}" MATCHES "-NOTFOUND") file(DOWNLOAD ${URL} ${DOWNLOADS}/${ARCHIVE} EXPECTED_HASH SHA512=${HASH} SHOW_PROGRESS @@ -194,5 +192,5 @@ function(vcpkg_find_acquire_program VAR) do_find() endif() - set(${VAR} ${${VAR}} PARENT_SCOPE) + set(${VAR} "${${VAR}}" PARENT_SCOPE) endfunction() -- cgit v1.2.3 From fc1a24ad8bb3187d17341c967353c3cc9742317a Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Sat, 14 Oct 2017 01:45:28 -0700 Subject: [vcpkg] Initial commit of powershell integration --- scripts/posh-vcpkg/0.0.1/posh-vcpkg.psd1 | 31 +++++++++++++++++++++++++ scripts/posh-vcpkg/0.0.1/posh-vcpkg.psm1 | 39 ++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 scripts/posh-vcpkg/0.0.1/posh-vcpkg.psd1 create mode 100644 scripts/posh-vcpkg/0.0.1/posh-vcpkg.psm1 (limited to 'scripts') diff --git a/scripts/posh-vcpkg/0.0.1/posh-vcpkg.psd1 b/scripts/posh-vcpkg/0.0.1/posh-vcpkg.psd1 new file mode 100644 index 000000000..3fb94fe7d --- /dev/null +++ b/scripts/posh-vcpkg/0.0.1/posh-vcpkg.psd1 @@ -0,0 +1,31 @@ +@{ + +# Script module or binary module file associated with this manifest. +ModuleToProcess = 'posh-vcpkg.psm1' + +# Version number of this module. +ModuleVersion = '0.0.1' + +# ID used to uniquely identify this module +GUID = '948f02ab-fc99-4a53-8335-b6556eef129b' + +# Minimum version of the Windows PowerShell engine required by this module +PowerShellVersion = '5.0' + +FunctionsToExport = @('TabExpansion') +CmdletsToExport = @() +VariablesToExport = @() +AliasesToExport = @() + +# Private data to pass to the module specified in RootModule/ModuleToProcess. +# This may also contain a PSData hashtable with additional module metadata used by PowerShell. +PrivateData = +@{ + PSData = + @{ + # Tags applied to this module. These help with module discovery in online galleries. + Tags = @('vcpkg', 'tab', 'tab-completion', 'tab-expansion', 'tabexpansion') + } +} + +} diff --git a/scripts/posh-vcpkg/0.0.1/posh-vcpkg.psm1 b/scripts/posh-vcpkg/0.0.1/posh-vcpkg.psm1 new file mode 100644 index 000000000..25ef99609 --- /dev/null +++ b/scripts/posh-vcpkg/0.0.1/posh-vcpkg.psm1 @@ -0,0 +1,39 @@ +param() + +if (Get-Module posh-vcpkg) { return } + +if ($PSVersionTable.PSVersion.Major -lt 5) { + Write-Warning ("posh-vcpkg does not support PowerShell versions before 5.0.") + return +} + +if (Test-Path Function:\TabExpansion) { + Rename-Item Function:\TabExpansion VcpkgTabExpansionBackup +} + +function TabExpansion($line, $lastWord) { + $lastBlock = [regex]::Split($line, '[|;]')[-1].TrimStart() + + switch -regex ($lastBlock) { + "^(?(\./|\.\\|)vcpkg(\.exe|)) (?.*)$" + { + & $matches['vcpkgexe'] autocomplete $matches['remaining'] + return + } + + # Fall back on existing tab expansion + default { + if (Test-Path Function:\VcpkgTabExpansionBackup) { + VcpkgTabExpansionBackup $line $lastWord + } + } + } +} + +$exportModuleMemberParams = @{ + Function = @( + 'TabExpansion' + ) +} + +Export-ModuleMember @exportModuleMemberParams -- cgit v1.2.3