aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-10-12 11:22:25 -0700
committerGitHub <noreply@github.com>2017-10-12 11:22:25 -0700
commit85e6b1b36e734c0db50464b07b77589d63c3c875 (patch)
tree095289838517a64f06298b1a05ded47a7139d7d9 /scripts
parentd7a313c5c356e1641f18cd14ad0ac0c3901bc0bf (diff)
parent9c3f9582fb4541a59e4282269e4f6c9c7debcc3e (diff)
downloadvcpkg-85e6b1b36e734c0db50464b07b77589d63c3c875.tar.gz
vcpkg-85e6b1b36e734c0db50464b07b77589d63c3c875.zip
Merge branch 'master' into vtk-components
Diffstat (limited to 'scripts')
-rw-r--r--scripts/bootstrap.ps12
-rw-r--r--scripts/buildsystems/msbuild/vcpkg.targets12
-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_common_functions.cmake1
-rw-r--r--scripts/cmake/vcpkg_configure_cmake.cmake34
-rw-r--r--scripts/cmake/vcpkg_configure_meson.cmake16
-rw-r--r--scripts/cmake/vcpkg_download_distfile.cmake2
-rw-r--r--scripts/cmake/vcpkg_find_acquire_program.cmake54
-rw-r--r--scripts/cmake/vcpkg_from_bitbucket.cmake190
-rw-r--r--scripts/cmake/vcpkg_install_cmake.cmake48
-rw-r--r--scripts/fetchDependency.ps163
-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
18 files changed, 469 insertions, 311 deletions
diff --git a/scripts/bootstrap.ps1 b/scripts/bootstrap.ps1
index 2dd6813a4..b874afd8c 100644
--- a/scripts/bootstrap.ps1
+++ b/scripts/bootstrap.ps1
@@ -14,7 +14,7 @@ $oldpath = $env:path
try
{
$env:path += ";$vcpkgRootDir\downloads\MinGit-2.14.1-32-bit\cmd"
- if (Get-Command "git" -ListImported -ErrorAction SilentlyContinue)
+ if (Get-Command "git" -ErrorAction SilentlyContinue)
{
$gitHash = git log HEAD -n 1 --format="%cd-%H" --date=short
if ($LASTEXITCODE -ne 0)
diff --git a/scripts/buildsystems/msbuild/vcpkg.targets b/scripts/buildsystems/msbuild/vcpkg.targets
index 5c24d755a..1cb338237 100644
--- a/scripts/buildsystems/msbuild/vcpkg.targets
+++ b/scripts/buildsystems/msbuild/vcpkg.targets
@@ -41,10 +41,10 @@
<ItemDefinitionGroup Condition="'$(VcpkgEnabled)' == 'true'">
<Link>
- <AdditionalDependencies Condition="'$(VcpkgConfiguration)' == 'Debug' and '$(VcpkgAutoLink)' != 'false'">%(AdditionalDependencies);$(VcpkgRoot)debug\lib\*.lib</AdditionalDependencies>
- <AdditionalDependencies Condition="'$(VcpkgConfiguration)' == 'Release' and '$(VcpkgAutoLink)' != 'false'">%(AdditionalDependencies);$(VcpkgRoot)lib\*.lib</AdditionalDependencies>
- <AdditionalLibraryDirectories Condition="'$(VcpkgConfiguration)' == 'Release'">%(AdditionalLibraryDirectories);$(VcpkgRoot)lib;$(VcpkgRoot)lib\manual-link</AdditionalLibraryDirectories>
- <AdditionalLibraryDirectories Condition="'$(VcpkgConfiguration)' == 'Debug'">%(AdditionalLibraryDirectories);$(VcpkgRoot)debug\lib;$(VcpkgRoot)debug\lib\manual-link</AdditionalLibraryDirectories>
+ <AdditionalDependencies Condition="$(VcpkgConfiguration.StartsWith('Debug')) and '$(VcpkgAutoLink)' != 'false'">%(AdditionalDependencies);$(VcpkgRoot)debug\lib\*.lib</AdditionalDependencies>
+ <AdditionalDependencies Condition="$(VcpkgConfiguration.StartsWith('Release')) and '$(VcpkgAutoLink)' != 'false'">%(AdditionalDependencies);$(VcpkgRoot)lib\*.lib</AdditionalDependencies>
+ <AdditionalLibraryDirectories Condition="$(VcpkgConfiguration.StartsWith('Release'))">%(AdditionalLibraryDirectories);$(VcpkgRoot)lib;$(VcpkgRoot)lib\manual-link</AdditionalLibraryDirectories>
+ <AdditionalLibraryDirectories Condition="$(VcpkgConfiguration.StartsWith('Debug'))">%(AdditionalLibraryDirectories);$(VcpkgRoot)debug\lib;$(VcpkgRoot)debug\lib\manual-link</AdditionalLibraryDirectories>
</Link>
<ClCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(VcpkgRoot)include</AdditionalIncludeDirectories>
@@ -63,11 +63,11 @@
<WriteLinesToFile
File="$(TLogLocation)$(ProjectName).write.1u.tlog"
Lines="^$(TargetPath);$([System.IO.Path]::Combine($(ProjectDir),$(IntDir)))vcpkg.applocal.log" Encoding="Unicode"/>
- <Exec Condition="'$(VcpkgConfiguration)' == 'Debug'"
+ <Exec Condition="$(VcpkgConfiguration.StartsWith('Debug'))"
Command="powershell.exe -ExecutionPolicy Bypass -noprofile -File %22$(MSBuildThisFileDirectory)applocal.ps1%22 %22$(TargetPath)%22 %22$(VcpkgRoot)debug\bin%22 %22$(TLogLocation)$(ProjectName).write.1u.tlog%22 %22$(IntDir)vcpkg.applocal.log%22"
StandardOutputImportance="Normal">
</Exec>
- <Exec Condition="'$(VcpkgConfiguration)' == 'Release'"
+ <Exec Condition="$(VcpkgConfiguration.StartsWith('Release'))"
Command="powershell.exe -ExecutionPolicy Bypass -noprofile -File %22$(MSBuildThisFileDirectory)applocal.ps1%22 %22$(TargetPath)%22 %22$(VcpkgRoot)bin%22 %22$(TLogLocation)$(ProjectName).write.1u.tlog%22 %22$(IntDir)vcpkg.applocal.log%22"
StandardOutputImportance="Normal">
</Exec>
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_common_functions.cmake b/scripts/cmake/vcpkg_common_functions.cmake
index 29f0f8dff..81e8e5813 100644
--- a/scripts/cmake/vcpkg_common_functions.cmake
+++ b/scripts/cmake/vcpkg_common_functions.cmake
@@ -6,6 +6,7 @@ include(vcpkg_execute_required_process_repeat)
include(vcpkg_find_acquire_program)
include(vcpkg_fixup_cmake_targets)
include(vcpkg_from_github)
+include(vcpkg_from_bitbucket)
include(vcpkg_build_cmake)
include(vcpkg_build_msbuild)
include(vcpkg_build_qmake)
diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake
index 07acfc8ea..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,24 +145,30 @@ 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 /Zi /Ob0 /Od /RTC1 ${VCPKG_CXX_FLAGS_DEBUG}"
- "-DCMAKE_C_FLAGS_DEBUG=/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 ${VCPKG_C_FLAGS_DEBUG}"
+ "-DCMAKE_CXX_FLAGS_DEBUG=/D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 ${VCPKG_CXX_FLAGS_DEBUG}"
+ "-DCMAKE_C_FLAGS_DEBUG=/D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 ${VCPKG_C_FLAGS_DEBUG}"
)
list(APPEND _csc_OPTIONS_RELEASE
- "-DCMAKE_CXX_FLAGS_RELEASE=/MD /O2 /Oi /Gy /DNDEBUG /Zi ${VCPKG_CXX_FLAGS_RELEASE}"
- "-DCMAKE_C_FLAGS_RELEASE=/MD /O2 /Oi /Gy /DNDEBUG /Zi ${VCPKG_C_FLAGS_RELEASE}"
+ "-DCMAKE_CXX_FLAGS_RELEASE=/MD /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_CXX_FLAGS_RELEASE}"
+ "-DCMAKE_C_FLAGS_RELEASE=/MD /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_C_FLAGS_RELEASE}"
)
elseif(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL static)
list(APPEND _csc_OPTIONS_DEBUG
- "-DCMAKE_CXX_FLAGS_DEBUG=/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1 ${VCPKG_CXX_FLAGS_DEBUG}"
- "-DCMAKE_C_FLAGS_DEBUG=/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1 ${VCPKG_C_FLAGS_DEBUG}"
+ "-DCMAKE_CXX_FLAGS_DEBUG=/D_DEBUG /MTd /Z7 /Ob0 /Od /RTC1 ${VCPKG_CXX_FLAGS_DEBUG}"
+ "-DCMAKE_C_FLAGS_DEBUG=/D_DEBUG /MTd /Z7 /Ob0 /Od /RTC1 ${VCPKG_C_FLAGS_DEBUG}"
)
list(APPEND _csc_OPTIONS_RELEASE
- "-DCMAKE_CXX_FLAGS_RELEASE=/MT /O2 /Oi /Gy /DNDEBUG /Zi ${VCPKG_CXX_FLAGS_RELEASE}"
- "-DCMAKE_C_FLAGS_RELEASE=/MT /O2 /Oi /Gy /DNDEBUG /Zi ${VCPKG_C_FLAGS_RELEASE}"
+ "-DCMAKE_CXX_FLAGS_RELEASE=/MT /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_CXX_FLAGS_RELEASE}"
+ "-DCMAKE_C_FLAGS_RELEASE=/MT /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_C_FLAGS_RELEASE}"
)
endif()
@@ -188,4 +200,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_configure_meson.cmake b/scripts/cmake/vcpkg_configure_meson.cmake
index 277f91e11..143bb74de 100644
--- a/scripts/cmake/vcpkg_configure_meson.cmake
+++ b/scripts/cmake/vcpkg_configure_meson.cmake
@@ -9,17 +9,17 @@ function(vcpkg_configure_meson)
set(MESON_COMMON_CXXFLAGS "${MESON_COMMON_CXXFLAGS} /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc")
if(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL dynamic)
- set(MESON_DEBUG_CFLAGS "${MESON_DEBUG_CFLAGS} /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1")
- set(MESON_DEBUG_CXXFLAGS "${MESON_DEBUG_CXXFLAGS} /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1")
+ set(MESON_DEBUG_CFLAGS "${MESON_DEBUG_CFLAGS} /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1")
+ set(MESON_DEBUG_CXXFLAGS "${MESON_DEBUG_CXXFLAGS} /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1")
- set(MESON_RELEASE_CFLAGS "${MESON_RELEASE_CFLAGS} /MD /O2 /Oi /Gy /DNDEBUG /Zi")
- set(MESON_RELEASE_CXXFLAGS "${MESON_RELEASE_CXXFLAGS} /MD /O2 /Oi /Gy /DNDEBUG /Zi")
+ set(MESON_RELEASE_CFLAGS "${MESON_RELEASE_CFLAGS} /MD /O2 /Oi /Gy /DNDEBUG /Z7")
+ set(MESON_RELEASE_CXXFLAGS "${MESON_RELEASE_CXXFLAGS} /MD /O2 /Oi /Gy /DNDEBUG /Z7")
elseif(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL static)
- set(MESON_DEBUG_CFLAGS "${MESON_DEBUG_CFLAGS} /D_DEBUG /MTd /Zi /Ob0 /Od /RTC1")
- set(MESON_DEBUG_CXXFLAGS "${MESON_DEBUG_CXXFLAGS} /D_DEBUG /MTd /Zi /Ob0 /Od /RTC1")
+ set(MESON_DEBUG_CFLAGS "${MESON_DEBUG_CFLAGS} /D_DEBUG /MTd /Z7 /Ob0 /Od /RTC1")
+ set(MESON_DEBUG_CXXFLAGS "${MESON_DEBUG_CXXFLAGS} /D_DEBUG /MTd /Z7 /Ob0 /Od /RTC1")
- set(MESON_RELEASE_CFLAGS "${MESON_RELEASE_CFLAGS} /MT /O2 /Oi /Gy /DNDEBUG /Zi")
- set(MESON_RELEASE_CXXFLAGS "${MESON_RELEASE_CXXFLAGS} /MT /O2 /Oi /Gy /DNDEBUG /Zi")
+ set(MESON_RELEASE_CFLAGS "${MESON_RELEASE_CFLAGS} /MT /O2 /Oi /Gy /DNDEBUG /Z7")
+ set(MESON_RELEASE_CXXFLAGS "${MESON_RELEASE_CXXFLAGS} /MT /O2 /Oi /Gy /DNDEBUG /Z7")
endif()
set(MESON_COMMON_LDFLAGS "${MESON_COMMON_LDFLAGS} /DEBUG")
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 fef62da53..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()
@@ -66,31 +67,19 @@ function(vcpkg_find_acquire_program VAR)
set(HASH 850b26be5bbbdaeaf45ac39dd27f69f1a85e600c35afbd16b9f621396b3c7a19863ea3ff316b025b578fce0a8280eef2203306a2b3e46ee1389abb65313fb720)
elseif(VAR MATCHES "PYTHON3")
set(PROGNAME python)
- set(PATHS ${DOWNLOADS}/tools/python)
- set(URL "https://www.python.org/ftp/python/3.5.3/python-3.5.3-embed-win32.zip")
- set(ARCHIVE "python-3.5.3-embed-win32.zip")
- set(HASH c8cfdc09d052dc27e4380e8e4bf0d32a4c0def7e03896c1fa6cabc26dde78bb74dbb04e3673cc36e3e307d65a1ef284d69174f0cc80008c83bc6178f192ac5cf)
+ set(SUBDIR "python3")
+ set(PATHS ${DOWNLOADS}/tools/python/${SUBDIR})
+ set(URL "https://www.python.org/ftp/python/3.5.4/python-3.5.4-embed-win32.zip")
+ set(ARCHIVE "python-3.5.4-embed-win32.zip")
+ set(HASH b5240fdc95088c2d7f65d2dd598650f8dd106b49589d94156bd4a078b108c6cabbe7a38ef73e2b2cf00e8312a93d2e587eac2c54ce85540d3c7a26cc60013156)
elseif(VAR MATCHES "PYTHON2")
- find_program(PYTHON2 NAMES python2 python PATHS C:/python27 c:/Python27amd64 ENV PYTHON)
- if(NOT PYTHON2 MATCHES "NOTFOUND")
- execute_process(
- COMMAND ${PYTHON2} --version
- OUTPUT_VARIABLE PYTHON_VER_CHECK_OUT
- ERROR_VARIABLE PYTHON_VER_CHECK_ERR
- )
- set(PYTHON_VER_CHECK "${PYTHON_VER_CHECK_OUT}${PYTHON_VER_CHECK_ERR}")
- debug_message("PYTHON_VER_CHECK=${PYTHON_VER_CHECK}")
- if(NOT PYTHON_VER_CHECK MATCHES "Python 2.7")
- set(PYTHON2 PYTHON2-NOTFOUND)
- find_program(PYTHON2 NAMES python2 python PATHS C:/python27 ENV PYTHON NO_SYSTEM_ENVIRONMENT_PATH)
- endif()
- endif()
- if(PYTHON2 MATCHES "NOTFOUND")
- message(FATAL_ERROR "Python 2.7 was not found in the path or by searching inside C:\\Python27.\n"
- "There is no portable redistributable for Python 2.7, so you will need to install the MSI located at:\n"
- " https://www.python.org/ftp/python/2.7.13/python-2.7.13.msi\n"
- )
- endif()
+ set(PROGNAME python)
+ set(SUBDIR "python2")
+ set(PATHS ${DOWNLOADS}/tools/python/${SUBDIR})
+ file(TO_NATIVE_PATH "${PATHS}" DESTINATION_NATIVE_PATH)
+ set(URL "https://www.python.org/ftp/python/2.7.14/python-2.7.14.msi")
+ set(ARCHIVE "python2.msi")
+ set(HASH 8c3ad6e527742d99ba96dcfd1098861b14e7207b80d51a54e9b410ab2f36e44e05561ea1527d8e92b3e10808311536260bd9e82db0da3b513fb1be18e108510e)
elseif(VAR MATCHES "RUBY")
set(PROGNAME "ruby")
set(PATHS ${DOWNLOADS}/tools/ruby/rubyinstaller-2.4.1-1-x86/bin)
@@ -152,13 +141,21 @@ function(vcpkg_find_acquire_program VAR)
set(URL "https://raw.githubusercontent.com/FFmpeg/gas-preprocessor/36bacb4cba27003c572e5bf7a9c4dfe3c9a8d40d/gas-preprocessor.pl")
set(ARCHIVE "gas-preprocessor.pl")
set(HASH a25caadccd1457a0fd2abb5a0da9aca1713b2c351d76daf87a4141e52021f51aa09e95a62942c6f0764f79cc1fa65bf71584955b09e62ee7da067b5c82baf6b3)
+ elseif(VAR MATCHES "DARK")
+ set(PROGNAME dark)
+ set(SUBDIR "wix311-binaries")
+ set(PATHS ${DOWNLOADS}/tools/dark/${SUBDIR})
+ set(URL "https://github.com/wixtoolset/wix3/releases/download/wix311rtm/wix311-binaries.zip")
+ set(ARCHIVE "wix311-binaries.zip")
+ set(HASH 74f0fa29b5991ca655e34a9d1000d47d4272e071113fada86727ee943d913177ae96dc3d435eaf494d2158f37560cd4c2c5274176946ebdb17bf2354ced1c516)
else()
message(FATAL "unknown tool ${VAR} -- unable to acquire.")
endif()
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})
@@ -167,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
@@ -178,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(
diff --git a/scripts/cmake/vcpkg_from_bitbucket.cmake b/scripts/cmake/vcpkg_from_bitbucket.cmake
new file mode 100644
index 000000000..227de5141
--- /dev/null
+++ b/scripts/cmake/vcpkg_from_bitbucket.cmake
@@ -0,0 +1,190 @@
+## # vcpkg_from_bitbucket
+##
+## Download and extract a project from Bitbucket.
+## Enables support for installing HEAD `vcpkg.exe install --head <port>`.
+##
+## ## Usage:
+## ```cmake
+## vcpkg_from_bitbucket(
+## OUT_SOURCE_PATH <SOURCE_PATH>
+## REPO <Microsoft/cpprestsdk>
+## [REF <v2.0.0>]
+## [SHA512 <45d0d7f8cc350...>]
+## [HEAD_REF <master>]
+## )
+## ```
+##
+## ## Parameters:
+## ### OUT_SOURCE_PATH
+## Specifies the out-variable that will contain the extracted location.
+##
+## This should be set to `SOURCE_PATH` by convention.
+##
+## ### REPO
+## The organization or user and repository on GitHub.
+##
+## ### REF
+## A stable git commit-ish (ideally a tag) that will not change contents. **This should not be a branch.**
+##
+## For repositories without official releases, this can be set to the full commit id of the current latest master.
+##
+## If `REF` is specified, `SHA512` must also be specified.
+##
+## ### SHA512
+## The SHA512 hash that should match the archive (https://bitbucket.com/${REPO}/get/${REF}.tar.gz).
+##
+## This is most easily determined by first setting it to `1`, then trying to build the port. The error message will contain the full hash, which can be copied back into the portfile.
+##
+## ### HEAD_REF
+## The unstable git commit-ish (ideally a branch) to pull for `--head` builds.
+##
+## For most projects, this should be `master`. The chosen branch should be one that is expected to be always buildable on all supported platforms.
+##
+## ## Notes:
+## At least one of `REF` and `HEAD_REF` must be specified, however it is preferable for both to be present.
+##
+## This exports the `VCPKG_HEAD_VERSION` variable during head builds.
+##
+## ## Examples:
+##
+## * [blaze](https://github.com/Microsoft/vcpkg/blob/master/ports/blaze/portfile.cmake)
+function(vcpkg_from_bitbucket)
+ set(oneValueArgs OUT_SOURCE_PATH REPO REF SHA512 HEAD_REF)
+ set(multipleValuesArgs)
+ cmake_parse_arguments(_vdud "" "${oneValueArgs}" "${multipleValuesArgs}" ${ARGN})
+
+ if(NOT _vdud_OUT_SOURCE_PATH)
+ message(FATAL_ERROR "OUT_SOURCE_PATH must be specified.")
+ endif()
+
+ if((_vdud_REF AND NOT _vdud_SHA512) OR (NOT _vdud_REF AND _vdud_SHA512))
+ message(FATAL_ERROR "SHA512 must be specified if REF is specified.")
+ endif()
+
+ if(NOT _vdud_REPO)
+ message(FATAL_ERROR "The Bitbucket repository must be specified.")
+ endif()
+
+ if(NOT _vdud_REF AND NOT _vdud_HEAD_REF)
+ message(FATAL_ERROR "At least one of REF and HEAD_REF must be specified.")
+ endif()
+
+ string(REGEX REPLACE ".*/" "" REPO_NAME ${_vdud_REPO})
+ string(REGEX REPLACE "/.*" "" ORG_NAME ${_vdud_REPO})
+
+ macro(set_SOURCE_PATH BASE BASEREF)
+ set(SOURCE_PATH "${BASE}/${ORG_NAME}-${REPO_NAME}-${BASEREF}")
+ if(EXISTS ${SOURCE_PATH})
+ set(${_vdud_OUT_SOURCE_PATH} "${SOURCE_PATH}" PARENT_SCOPE)
+ else()
+ # Sometimes GitHub strips a leading 'v' off the REF.
+ string(REGEX REPLACE "^v" "" REF ${BASEREF})
+ set(SOURCE_PATH "${BASE}/${ORG_NAME}-${REPO_NAME}-${REF}")
+ if(EXISTS ${SOURCE_PATH})
+ set(${_vdud_OUT_SOURCE_PATH} "${SOURCE_PATH}" PARENT_SCOPE)
+ else()
+ message(FATAL_ERROR "Could not determine source path: '${BASE}/${ORG_NAME}-${REPO_NAME}-${BASEREF}' does not exist")
+ endif()
+ endif()
+ endmacro()
+
+ if(VCPKG_USE_HEAD_VERSION AND NOT _vdud_HEAD_REF)
+ message(STATUS "Package does not specify HEAD_REF. Falling back to non-HEAD version.")
+ set(VCPKG_USE_HEAD_VERSION OFF)
+ endif()
+
+ # Handle --no-head scenarios
+ if(NOT VCPKG_USE_HEAD_VERSION)
+ if(NOT _vdud_REF)
+ message(FATAL_ERROR "Package does not specify REF. It must built using --head.")
+ endif()
+
+ set(URL "https://bitbucket.com/${ORG_NAME}/${REPO_NAME}/get/${_vdud_REF}.tar.gz")
+ set(downloaded_file_path "${DOWNLOADS}/${ORG_NAME}-${REPO_NAME}-${_vdud_REF}.tar.gz")
+
+ file(DOWNLOAD "https://api.bitbucket.com/2.0/repositories/${ORG_NAME}/${REPO_NAME}/refs/tags/${_vdud_REF}"
+ ${downloaded_file_path}.version
+ STATUS download_status
+ )
+ list(GET download_status 0 status_code)
+ if ("${status_code}" STREQUAL "0")
+ # Parse the github refs response with regex.
+ # TODO: use some JSON swiss-army-knife utility instead.
+ file(READ "${downloaded_file_path}.version" _contents)
+ string(REGEX MATCH "\"hash\": \"[a-f0-9]+\"" x "${_contents}")
+ string(REGEX REPLACE "\"hash\": \"([a-f0-9]+)\"" "\\1" _version ${x})
+ string(SUBSTRING ${_version} 0 12 _version) # Get the 12 first numbers from commit hash
+ else()
+ set(_version ${_vdud_REF})
+ endif()
+
+ vcpkg_download_distfile(ARCHIVE
+ URLS "https://bitbucket.com/${ORG_NAME}/${REPO_NAME}/get/${_vdud_REF}.tar.gz"
+ SHA512 "${_vdud_SHA512}"
+ FILENAME "${ORG_NAME}-${REPO_NAME}-${_vdud_REF}.tar.gz"
+ )
+ vcpkg_extract_source_archive_ex(ARCHIVE "${ARCHIVE}")
+ set_SOURCE_PATH(${CURRENT_BUILDTREES_DIR}/src ${_version})
+ return()
+ endif()
+
+ # The following is for --head scenarios
+ set(URL "https://bitbucket.com/${ORG_NAME}/${REPO_NAME}/get/${_vdud_HEAD_REF}.tar.gz")
+ set(downloaded_file_path "${DOWNLOADS}/${ORG_NAME}-${REPO_NAME}-${_vdud_HEAD_REF}.tar.gz")
+
+ if(_VCPKG_NO_DOWNLOADS)
+ if(NOT EXISTS ${downloaded_file_path} OR NOT EXISTS ${downloaded_file_path}.version)
+ message(FATAL_ERROR "Downloads are disabled, but '${downloaded_file_path}' does not exist.")
+ endif()
+ message(STATUS "Using cached ${downloaded_file_path}")
+ else()
+ if(EXISTS ${downloaded_file_path})
+ message(STATUS "Purging cached ${downloaded_file_path} to fetch latest (use --no-downloads to suppress)")
+ file(REMOVE ${downloaded_file_path})
+ endif()
+ if(EXISTS ${downloaded_file_path}.version)
+ file(REMOVE ${downloaded_file_path}.version)
+ endif()
+ if(EXISTS ${CURRENT_BUILDTREES_DIR}/src/head)
+ file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/src/head)
+ endif()
+
+ # Try to download the file and version information from bitbucket.
+ message(STATUS "Downloading ${URL}...")
+ file(DOWNLOAD "https://api.bitbucket.com/2.0/repositories/${ORG_NAME}/${REPO_NAME}/refs/branches/${_vdud_HEAD_REF}"
+ ${downloaded_file_path}.version
+ STATUS download_status
+ )
+ list(GET download_status 0 status_code)
+ if (NOT "${status_code}" STREQUAL "0")
+ file(REMOVE ${downloaded_file_path}.version)
+ message(FATAL_ERROR "Downloading version info for ${URL}... Failed. Status: ${download_status}")
+ endif()
+
+ file(DOWNLOAD ${URL} ${downloaded_file_path} STATUS download_status)
+ list(GET download_status 0 status_code)
+ if (NOT "${status_code}" STREQUAL "0")
+ file(REMOVE ${downloaded_file_path})
+ message(FATAL_ERROR "Downloading ${URL}... Failed. Status: ${download_status}")
+ else()
+ message(STATUS "Downloading ${URL}... OK")
+ endif()
+ endif()
+
+ vcpkg_extract_source_archive_ex(
+ ARCHIVE "${downloaded_file_path}"
+ WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/src/head"
+ )
+
+ # Parse the github refs response with regex.
+ # TODO: use some JSON swiss-army-knife utility instead.
+ file(READ "${downloaded_file_path}.version" _contents)
+ string(REGEX MATCH "\"hash\": \"[a-f0-9]+\"" x "${_contents}")
+ string(REGEX REPLACE "\"hash\": \"([a-f0-9]+)\"" "\\1" _version ${x})
+ string(SUBSTRING ${_version} 0 12 _vdud_HEAD_REF) # Get the 12 first numbers from commit hash
+
+ # exports VCPKG_HEAD_VERSION to the caller. This will get picked up by ports.cmake after the build.
+ set(VCPKG_HEAD_VERSION ${_version} PARENT_SCOPE)
+
+ set_SOURCE_PATH(${CURRENT_BUILDTREES_DIR}/src/head ${_vdud_HEAD_REF})
+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 c9aeb0f77..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)
}
}
@@ -105,22 +107,32 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency)
if($Dependency -eq "cmake")
{
- $requiredVersion = "3.9.1"
- $downloadVersion = "3.9.1"
- $url = "https://cmake.org/files/v3.9/cmake-3.9.1-win32-x86.zip"
- $downloadPath = "$downloadsDir\cmake-3.9.1-win32-x86.zip"
- $expectedDownloadedFileHash = "e0d9501bd34e3100e925dcb2e07f5f0ce8980bdbe5fce0ae950b21368d54c1a1"
- $executableFromDownload = "$downloadsDir\cmake-3.9.1-win32-x86\bin\cmake.exe"
+ $requiredVersion = "3.9.3"
+ $downloadVersion = "3.9.3"
+ $url = "https://cmake.org/files/v3.9/cmake-3.9.3-win32-x86.zip"
+ $downloadPath = "$downloadsDir\cmake-3.9.3-win32-x86.zip"
+ $expectedDownloadedFileHash = "47870e3d4c9a5aa019e71020cd85cc60b6f2d2569fb239eaec204cd991e512f1"
+ $executableFromDownload = "$downloadsDir\cmake-3.9.3-win32-x86\bin\cmake.exe"
$extractionType = $ExtractionType_ZIP
$extractionFolder = $downloadsDir
}
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