aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/cmake/vcpkg_acquire_depot_tools.cmake2
-rw-r--r--scripts/cmake/vcpkg_build_cmake.cmake75
-rw-r--r--scripts/cmake/vcpkg_configure_cmake.cmake18
-rw-r--r--scripts/cmake/vcpkg_download_distfile.cmake2
-rw-r--r--scripts/cmake/vcpkg_find_acquire_program.cmake9
-rw-r--r--scripts/cmake/vcpkg_install_cmake.cmake48
-rw-r--r--scripts/fetchDependency.ps151
-rw-r--r--scripts/findAnyMSBuildWithCppPlatformToolset.ps1172
-rw-r--r--scripts/findVisualStudioInstallationInstances.ps149
-rw-r--r--scripts/getWindowsSDK.ps19
-rw-r--r--scripts/get_triplet_environment.cmake3
-rw-r--r--scripts/ifw/maintenance.qs46
-rw-r--r--scripts/internalCI.ps12
-rw-r--r--scripts/posh-vcpkg/0.0.1/posh-vcpkg.psd131
-rw-r--r--scripts/posh-vcpkg/0.0.1/posh-vcpkg.psm139
15 files changed, 298 insertions, 258 deletions
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_build_cmake.cmake b/scripts/cmake/vcpkg_build_cmake.cmake
index 18e2a8b00..5dc81ec09 100644
--- a/scripts/cmake/vcpkg_build_cmake.cmake
+++ b/scripts/cmake/vcpkg_build_cmake.cmake
@@ -1,41 +1,76 @@
+## # vcpkg_build_cmake
+##
+## Build a cmake project.
+##
+## ## Usage:
+## ```cmake
+## vcpkg_build_cmake([DISABLE_PARALLEL] [TARGET <target>])
+## ```
+##
+## ## Parameters:
+## ### DISABLE_PARALLEL
+## The underlying buildsystem will be instructed to not parallelize
+##
+## ### TARGET
+## The target passed to the cmake build command (`cmake --build . --target <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).
+## You can use the alias [`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})
+ cmake_parse_arguments(_bc "DISABLE_PARALLEL" "TARGET;LOGFILE_ROOT" "" ${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")
+ 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
+ if(_bc_TARGET)
+ set(TARGET_PARAM "--target" ${_bc_TARGET})
else()
- set(BUILD_ARGS ${MSVC_EXTRA_ARGS})
+ 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 738f98731..3e92db762 100644
--- a/scripts/cmake/vcpkg_configure_cmake.cmake
+++ b/scripts/cmake/vcpkg_configure_cmake.cmake
@@ -86,14 +86,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
@@ -147,6 +153,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}"
@@ -196,4 +208,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_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..51e394bf1 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()
@@ -162,7 +163,7 @@ function(vcpkg_find_acquire_program VAR)
endmacro()
do_find()
- if(${VAR} MATCHES "-NOTFOUND")
+ if("${${VAR}}" MATCHES "-NOTFOUND")
file(DOWNLOAD ${URL} ${DOWNLOADS}/${ARCHIVE}
EXPECTED_HASH SHA512=${HASH}
SHOW_PROGRESS
@@ -173,7 +174,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(
@@ -191,5 +192,5 @@ function(vcpkg_find_acquire_program VAR)
do_find()
endif()
- set(${VAR} ${${VAR}} PARENT_SCOPE)
+ set(${VAR} "${${VAR}}" PARENT_SCOPE)
endfunction()
diff --git a/scripts/cmake/vcpkg_install_cmake.cmake b/scripts/cmake/vcpkg_install_cmake.cmake
index f778007ef..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 if the underlying buildsystem is MSBuild. 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,43 +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
- else()
- 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()
diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1
index 2a23002a4..773ebeac4 100644
--- a/scripts/fetchDependency.ps1
+++ b/scripts/fetchDependency.ps1
@@ -36,17 +36,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] {
@@ -60,7 +62,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)
}
}
@@ -116,11 +118,21 @@ 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"
- $downloadPath = "$downloadsDir\nuget-4.1.0\nuget.exe"
- $expectedDownloadedFileHash = "4c1de9b026e0c4ab087302ff75240885742c0faa62bd2554f913bbe1f6cb63a0"
+ $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 = "386da77a8cf2b63d1260b7020feeedabfe3b65ab31d20e6a313a530865972f3a"
+ $executableFromDownload = $downloadPath
+ $extractionType = $ExtractionType_NO_EXTRACTION_REQUIRED
+ }
+ elseif($Dependency -eq "vswhere")
+ {
+ $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 = "5f19066ac91635ad17d33fe0f79fc63c672a46f98c0358589a90163bcb2733e8"
$executableFromDownload = $downloadPath
$extractionType = $ExtractionType_NO_EXTRACTION_REQUIRED
}
@@ -137,6 +149,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"
diff --git a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1
index f72491e5d..e9fb60cb2 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 = & $scriptsDir\getProgramFiles32bit.ps1
+ 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..b2f186478 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 -products * -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
diff --git a/scripts/getWindowsSDK.ps1 b/scripts/getWindowsSDK.ps1
index 9aebae8e3..8ef26a436 100644
--- a/scripts/getWindowsSDK.ps1
+++ b/scripts/getWindowsSDK.ps1
@@ -13,14 +13,13 @@ if ($DisableWin10SDK -and $DisableWin81SDK)
}
Write-Verbose "Executing $($MyInvocation.MyCommand.Name)"
-$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition
$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 +36,7 @@ function CheckWindows10SDK($path)
if (!(Test-Path $windowsheader))
{
Write-Verbose "$windowsheader - Not Found"
- return
+ continue
}
Write-Verbose "$windowsheader - Found"
@@ -45,7 +44,7 @@ function CheckWindows10SDK($path)
if (!(Test-Path $ddkheader))
{
Write-Verbose "$ddkheader - Not Found"
- return
+ continue
}
Write-Verbose "$ddkheader - Found"
@@ -106,4 +105,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"
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
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");
+ }
+}
+
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
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) {
+ "^(?<vcpkgexe>(\./|\.\\|)vcpkg(\.exe|)) (?<remaining>.*)$"
+ {
+ & $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