From c167c70c272a417779e601fffcbdb72278da1848 Mon Sep 17 00:00:00 2001 From: martin-s Date: Sat, 2 Sep 2017 16:48:29 +0200 Subject: - Added support for VS2013 build chain tools. --- scripts/cmake/vcpkg_configure_cmake.cmake | 8 +++++ scripts/findAnyMSBuildWithCppPlatformToolset.ps1 | 39 +++++++++++++++++++++--- 2 files changed, 42 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake index 07acfc8ea..e43075961 100644 --- a/scripts/cmake/vcpkg_configure_cmake.cmake +++ b/scripts/cmake/vcpkg_configure_cmake.cmake @@ -61,6 +61,14 @@ function(vcpkg_configure_cmake) set(GENERATOR ${_csc_GENERATOR}) elseif(_csc_PREFER_NINJA AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND NOT _csc_HOST_ARCHITECTURE STREQUAL "x86") set(GENERATOR "Ninja") + + elseif(TRIPLET_SYSTEM_ARCH MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v120") + set(GENERATOR "Visual Studio 12 2013") + elseif(TRIPLET_SYSTEM_ARCH MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v120") + set(GENERATOR "Visual Studio 12 2013 Win64") + elseif(TRIPLET_SYSTEM_ARCH MATCHES "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v120") + set(GENERATOR "Visual Studio 12 2013 ARM") + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015") elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") diff --git a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 index f72491e5d..82d9f7c16 100644 --- a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 +++ b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 @@ -4,12 +4,15 @@ param( [switch]$DisableVS2017 = $False, [Parameter(Mandatory=$False)] - [switch]$DisableVS2015 = $False + [switch]$DisableVS2015 = $False, + + [Parameter(Mandatory=$False)] + [switch]$DisableVS2013 = $False ) -if ($DisableVS2017 -and $DisableVS2015) +if ($DisableVS2017 -and $DisableVS2015 -and $DisableVS2013) { - throw "Both VS2015 and VS2017 were disabled." + throw "VS013, VS2015 and VS2017 were disabled." } function New-MSBuildInstance() @@ -23,7 +26,7 @@ function New-MSBuildInstance() return $instance } -Write-Verbose "Executing $($MyInvocation.MyCommand.Name) with DisableVS2017=$DisableVS2017, DisableVS2015=$DisableVS2015" +Write-Verbose "Executing $($MyInvocation.MyCommand.Name) with DisableVS2017=$DisableVS2017, DisableVS2015=$DisableVS2015, DisableVS2013=$DisableVS2013" $scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition $validInstances = New-Object System.Collections.ArrayList @@ -139,6 +142,27 @@ foreach ($pair in $registryPairs) $validInstances.Add($instance) > $null } +# VS2013 - in Program Files +Write-Verbose "`n`n" +Write-Verbose "Checking for MSBuild from VS2013 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 12.0\VC\bin\cl.exe" + + if (!(Test-Path $clExe)) + { + Write-Verbose "$clExe - Not Found" + continue + } + + Write-Verbose "$clExe - Found" + $instance = New-MSBuildInstance "$ProgramFiles\MSBuild\12.0\Bin\MSBuild.exe" "v120" + 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) @@ -158,7 +182,12 @@ foreach ($instance in $validInstances) { return $instance.msbuildExePath, $instance.toolsetVersion } + + if (!$DisableVS2013 -and $instance.toolsetVersion -eq "v120") + { + return $instance.msbuildExePath, $instance.toolsetVersion + } } -throw "Could not find MSBuild version with C++ support. VS2015 or VS2017 (with C++) needs to be installed." \ No newline at end of file +throw "Could not find MSBuild version with C++ support. VS2013, VS2015 or VS2017 (with C++) needs to be installed." \ No newline at end of file -- cgit v1.2.3 From 433c505e32ec38b8a3395e1f0fe3fca0e9c12cad Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Tue, 3 Oct 2017 15:58:10 -0700 Subject: [vcpkg] Revert attempt to build vcpkg.exe with VS2013 --- scripts/findAnyMSBuildWithCppPlatformToolset.ps1 | 39 +++--------------------- 1 file changed, 5 insertions(+), 34 deletions(-) (limited to 'scripts') diff --git a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 index 82d9f7c16..f72491e5d 100644 --- a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 +++ b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 @@ -4,15 +4,12 @@ param( [switch]$DisableVS2017 = $False, [Parameter(Mandatory=$False)] - [switch]$DisableVS2015 = $False, - - [Parameter(Mandatory=$False)] - [switch]$DisableVS2013 = $False + [switch]$DisableVS2015 = $False ) -if ($DisableVS2017 -and $DisableVS2015 -and $DisableVS2013) +if ($DisableVS2017 -and $DisableVS2015) { - throw "VS013, VS2015 and VS2017 were disabled." + throw "Both VS2015 and VS2017 were disabled." } function New-MSBuildInstance() @@ -26,7 +23,7 @@ function New-MSBuildInstance() return $instance } -Write-Verbose "Executing $($MyInvocation.MyCommand.Name) with DisableVS2017=$DisableVS2017, DisableVS2015=$DisableVS2015, DisableVS2013=$DisableVS2013" +Write-Verbose "Executing $($MyInvocation.MyCommand.Name) with DisableVS2017=$DisableVS2017, DisableVS2015=$DisableVS2015" $scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition $validInstances = New-Object System.Collections.ArrayList @@ -142,27 +139,6 @@ foreach ($pair in $registryPairs) $validInstances.Add($instance) > $null } -# VS2013 - in Program Files -Write-Verbose "`n`n" -Write-Verbose "Checking for MSBuild from VS2013 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 12.0\VC\bin\cl.exe" - - if (!(Test-Path $clExe)) - { - Write-Verbose "$clExe - Not Found" - continue - } - - Write-Verbose "$clExe - Found" - $instance = New-MSBuildInstance "$ProgramFiles\MSBuild\12.0\Bin\MSBuild.exe" "v120" - 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) @@ -182,12 +158,7 @@ foreach ($instance in $validInstances) { return $instance.msbuildExePath, $instance.toolsetVersion } - - if (!$DisableVS2013 -and $instance.toolsetVersion -eq "v120") - { - return $instance.msbuildExePath, $instance.toolsetVersion - } } -throw "Could not find MSBuild version with C++ support. VS2013, VS2015 or VS2017 (with C++) needs to be installed." \ No newline at end of file +throw "Could not find MSBuild version with C++ support. VS2015 or VS2017 (with C++) needs to be installed." \ No newline at end of file -- cgit v1.2.3 From 6290155eaaff1bd70ec9a893b090adea473effa8 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Nov 2017 01:23:14 -0800 Subject: [vcpkgExtractFile] Fix partial dir name. Special case 1-item zips - If the zip contains a single item, pull that up a directory - If the zip contains multiple items, place that in a directory on of the same name as the zip --- scripts/VcpkgPowershellUtils.ps1 | 23 +++++++++++++++++------ scripts/fetchDependency.ps1 | 5 +---- 2 files changed, 18 insertions(+), 10 deletions(-) (limited to 'scripts') diff --git a/scripts/VcpkgPowershellUtils.ps1 b/scripts/VcpkgPowershellUtils.ps1 index 12eacec96..0b1a35262 100644 --- a/scripts/VcpkgPowershellUtils.ps1 +++ b/scripts/VcpkgPowershellUtils.ps1 @@ -141,11 +141,13 @@ function vcpkgDownloadFile( [Parameter(Mandatory=$true)][string]$url, } function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file, - [Parameter(Mandatory=$true)][string]$destination) + [Parameter(Mandatory=$true)][string]$destinationDir) { - vcpkgCreateDirectory $destination - $baseName = (Get-ChildItem .\downloads\cmake-3.9.5-win32-x86.zip).BaseName - $destinationPartial = "$destination\$baseName-partially_extracted" + $parentPath = split-path -parent $destinationDir + vcpkgCreateDirectory $parentPath + $baseName = (Get-ChildItem $file).BaseName + $destinationPartial = "$destinationDir\$baseName-partially_extracted" + vcpkgRemoveDirectory $destinationPartial vcpkgCreateDirectory $destinationPartial @@ -171,8 +173,17 @@ function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file, } } - Move-Item -Path "$destinationPartial\*" -Destination $destination - vcpkgRemoveDirectory $destinationPartial + $hasASingleItem = (Get-ChildItem $destinationPartial | Measure-Object).Count -eq 1; + + if ($hasASingleItem) + { + Move-Item -Path "$destinationPartial\*" -Destination $destinationDir + vcpkgRemoveDirectory $destinationPartial + } + else + { + Rename-Item -Path $destinationPartial -NewName $baseName + } } function vcpkgInvokeCommand() diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index 2cc782feb..596845acb 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -27,7 +27,6 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) $expectedDownloadedFileHash = "dd3e183254c12f7c338d3edfa642f1ac84a763b8b9a2feabb4ad5fccece5dff9" $executableFromDownload = "$downloadsDir\cmake-3.9.5-win32-x86\bin\cmake.exe" $extractionType = $ExtractionType_ZIP - $extractionFolder = $downloadsDir } elseif($Dependency -eq "nuget") { @@ -60,7 +59,6 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) # Therefore, choosing the cmd dir here as well. $executableFromDownload = "$downloadsDir\MinGit-2.15.0-32-bit\cmd\git.exe" $extractionType = $ExtractionType_ZIP - $extractionFolder = "$downloadsDir\MinGit-2.15.0-32-bit" } elseif($Dependency -eq "installerbase") { @@ -71,7 +69,6 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) $expectedDownloadedFileHash = "f2ce23cf5cf9fc7ce409bdca49328e09a070c0026d3c8a04e4dfde7b05b83fe8" $executableFromDownload = "$downloadsDir\QtInstallerFramework-win-x86\bin\installerbase.exe" $extractionType = $ExtractionType_ZIP - $extractionFolder = $downloadsDir } else { @@ -91,7 +88,7 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) { if (-not (Test-Path $executableFromDownload)) { - vcpkgExtractFile -File $downloadPath -Destination $extractionFolder + vcpkgExtractFile -File $downloadPath -DestinationDir $downloadsDir } } elseif($extractionType -eq $ExtractionType_SELF_EXTRACTING_7Z) -- cgit v1.2.3 From 7fc2d7dbdf81b05905f4121fd52aa68234024c43 Mon Sep 17 00:00:00 2001 From: Frank Quinn Date: Sun, 19 Nov 2017 11:42:52 +0000 Subject: Added SCONS to vcpkg_find_acquire_program See: http://scons.org I have a port I would like to submit which uses scons (which in turn uses the python interpreter already provided). This change makes SCONS usable for vcpkg_execute_required_process. --- scripts/cmake/vcpkg_find_acquire_program.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake index e6a37e328..066126e6c 100644 --- a/scripts/cmake/vcpkg_find_acquire_program.cmake +++ b/scripts/cmake/vcpkg_find_acquire_program.cmake @@ -148,6 +148,14 @@ function(vcpkg_find_acquire_program VAR) set(URL "https://github.com/wixtoolset/wix3/releases/download/wix311rtm/wix311-binaries.zip") set(ARCHIVE "wix311-binaries.zip") set(HASH 74f0fa29b5991ca655e34a9d1000d47d4272e071113fada86727ee943d913177ae96dc3d435eaf494d2158f37560cd4c2c5274176946ebdb17bf2354ced1c516) + elseif(VAR MATCHES "SCONS") + set(PROGNAME scons) + set(REQUIRED_INTERPRETER PYTHON2) + set(SCRIPTNAME "scons.py") + set(PATHS ${DOWNLOADS}/tools/scons) + set(URL "https://sourceforge.net/projects/scons/files/scons-local-3.0.1.zip/download") + set(ARCHIVE "scons-local-3.0.1.zip") + set(HASH fe121b67b979a4e9580c7f62cfdbe0c243eba62a05b560d6d513ac7f35816d439b26d92fc2d7b7d7241c9ce2a49ea7949455a17587ef53c04a5f5125ac635727) else() message(FATAL "unknown tool ${VAR} -- unable to acquire.") endif() -- cgit v1.2.3 From 141f10801c2fae8ab844e94fe5338d055892c0ac Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Sat, 25 Nov 2017 11:49:15 -0800 Subject: [vcpkg] Improve external toolchain handling. --- scripts/buildsystems/vcpkg.cmake | 16 +++++++++++----- scripts/cmake/vcpkg_configure_cmake.cmake | 4 ++-- scripts/cmake/vcpkg_execute_required_process.cmake | 7 ++++--- scripts/get_triplet_environment.cmake | 3 ++- 4 files changed, 19 insertions(+), 11 deletions(-) (limited to 'scripts') diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index ff89439cc..4d82c43b7 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -1,6 +1,11 @@ # Mark variables as used so cmake doesn't complain about them mark_as_advanced(CMAKE_TOOLCHAIN_FILE) +get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE ) +if( _CMAKE_IN_TRY_COMPILE ) + include( "${CMAKE_CURRENT_SOURCE_DIR}/../vcpkg.config.cmake" OPTIONAL ) +endif() + if(VCPKG_CHAINLOAD_TOOLCHAIN_FILE) include("${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}") endif() @@ -9,11 +14,6 @@ if(VCPKG_TOOLCHAIN) return() endif() -get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE ) -if( _CMAKE_IN_TRY_COMPILE ) - include( "${CMAKE_CURRENT_SOURCE_DIR}/../vcpkg.config.cmake" OPTIONAL ) -endif() - if(VCPKG_TARGET_TRIPLET) elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Ww][Ii][Nn]32$") set(_VCPKG_TARGET_TRIPLET_ARCH x86) @@ -77,10 +77,16 @@ if(CMAKE_BUILD_TYPE MATCHES "^Debug$" OR NOT DEFINED CMAKE_BUILD_TYPE) list(APPEND CMAKE_LIBRARY_PATH ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/manual-link ) + list(APPEND CMAKE_FIND_ROOT_PATH + ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug + ) endif() list(APPEND CMAKE_PREFIX_PATH ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET} ) +list(APPEND CMAKE_FIND_ROOT_PATH + ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET} +) list(APPEND CMAKE_LIBRARY_PATH ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/manual-link ) diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake index 54616122c..d40550f06 100644 --- a/scripts/cmake/vcpkg_configure_cmake.cmake +++ b/scripts/cmake/vcpkg_configure_cmake.cmake @@ -61,14 +61,14 @@ function(vcpkg_configure_cmake) set(GENERATOR ${_csc_GENERATOR}) elseif(_csc_PREFER_NINJA AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND NOT _csc_HOST_ARCHITECTURE STREQUAL "x86") set(GENERATOR "Ninja") - elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v120") set(GENERATOR "Visual Studio 12 2013") elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v120") set(GENERATOR "Visual Studio 12 2013 Win64") elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v120") set(GENERATOR "Visual Studio 12 2013 ARM") - + elseif(VCPKG_CHAINLOAD_TOOLCHAIN_FILE) + set(GENERATOR "Ninja") elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND VCPKG_TARGET_ARCHITECTURE MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015") elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") diff --git a/scripts/cmake/vcpkg_execute_required_process.cmake b/scripts/cmake/vcpkg_execute_required_process.cmake index 173bca6e9..7c4907016 100644 --- a/scripts/cmake/vcpkg_execute_required_process.cmake +++ b/scripts/cmake/vcpkg_execute_required_process.cmake @@ -38,13 +38,14 @@ function(vcpkg_execute_required_process) RESULT_VARIABLE error_code WORKING_DIRECTORY ${vcpkg_execute_required_process_WORKING_DIRECTORY}) #debug_message("error_code=${error_code}") - file(TO_NATIVE_PATH "${CURRENT_BUILDTREES_DIR}" NATIVE_BUILDTREES_DIR) if(error_code) + file(TO_NATIVE_PATH "${CURRENT_BUILDTREES_DIR}/${vcpkg_execute_required_process_LOGNAME}-out.log" NATIVE_LOG_OUT) + file(TO_NATIVE_PATH "${CURRENT_BUILDTREES_DIR}/${vcpkg_execute_required_process_LOGNAME}-err.log" NATIVE_LOG_ERR) message(FATAL_ERROR " Command failed: ${vcpkg_execute_required_process_COMMAND}\n" " Working Directory: ${vcpkg_execute_required_process_WORKING_DIRECTORY}\n" " See logs for more information:\n" - " ${NATIVE_BUILDTREES_DIR}\\${vcpkg_execute_required_process_LOGNAME}-out.log\n" - " ${NATIVE_BUILDTREES_DIR}\\${vcpkg_execute_required_process_LOGNAME}-err.log\n") + " ${NATIVE_LOG_OUT}\n" + " ${NATIVE_LOG_ERR}\n") endif() endfunction() diff --git a/scripts/get_triplet_environment.cmake b/scripts/get_triplet_environment.cmake index b32f840d2..d498edf4a 100644 --- a/scripts/get_triplet_environment.cmake +++ b/scripts/get_triplet_environment.cmake @@ -6,4 +6,5 @@ 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}") -message("VCPKG_VISUAL_STUDIO_PATH=${VCPKG_VISUAL_STUDIO_PATH}") \ No newline at end of file +message("VCPKG_VISUAL_STUDIO_PATH=${VCPKG_VISUAL_STUDIO_PATH}") +message("VCPKG_CHAINLOAD_TOOLCHAIN_FILE=${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}") -- cgit v1.2.3 From 89983fe102520c7a063ff349ac824995b1832a97 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Sat, 25 Nov 2017 12:47:49 -0800 Subject: [vcpkg-from-github] Improve argument handling --- scripts/cmake/vcpkg_from_github.cmake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_from_github.cmake b/scripts/cmake/vcpkg_from_github.cmake index 5730ce39a..b71ab3838 100644 --- a/scripts/cmake/vcpkg_from_github.cmake +++ b/scripts/cmake/vcpkg_from_github.cmake @@ -54,19 +54,19 @@ function(vcpkg_from_github) set(multipleValuesArgs) cmake_parse_arguments(_vdud "" "${oneValueArgs}" "${multipleValuesArgs}" ${ARGN}) - if(NOT _vdud_OUT_SOURCE_PATH) + if(NOT DEFINED _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)) + if((DEFINED _vdud_REF AND NOT DEFINED _vdud_SHA512) OR (NOT DEFINED _vdud_REF AND DEFINED _vdud_SHA512)) message(FATAL_ERROR "SHA512 must be specified if REF is specified.") endif() - if(NOT _vdud_REPO) + if(NOT DEFINED _vdud_REPO) message(FATAL_ERROR "The GitHub repository must be specified.") endif() - if(NOT _vdud_REF AND NOT _vdud_HEAD_REF) + if(NOT DEFINED _vdud_REF AND NOT DEFINED _vdud_HEAD_REF) message(FATAL_ERROR "At least one of REF and HEAD_REF must be specified.") endif() @@ -90,7 +90,7 @@ function(vcpkg_from_github) endif() endmacro() - if(VCPKG_USE_HEAD_VERSION AND NOT _vdud_HEAD_REF) + if(VCPKG_USE_HEAD_VERSION AND NOT DEFINED _vdud_HEAD_REF) message(STATUS "Package does not specify HEAD_REF. Falling back to non-HEAD version.") set(VCPKG_USE_HEAD_VERSION OFF) endif() -- cgit v1.2.3 From 5335d17f53d491d83d98e80ab0e750ec0f6f430b Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Sat, 25 Nov 2017 15:25:18 -0800 Subject: [vcpkg] Initial experimental support for VCPKG_BUILD_TYPE release --- scripts/cmake/vcpkg_build_cmake.cmake | 32 ++++++----- scripts/cmake/vcpkg_build_msbuild.cmake | 44 +++++++++------- scripts/cmake/vcpkg_configure_cmake.cmake | 48 +++++++++-------- scripts/cmake/vcpkg_configure_meson.cmake | 56 +++++++++++--------- scripts/cmake/vcpkg_fixup_cmake_targets.cmake | 76 +++++++++++++++------------ scripts/get_triplet_environment.cmake | 1 + 6 files changed, 141 insertions(+), 116 deletions(-) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_build_cmake.cmake b/scripts/cmake/vcpkg_build_cmake.cmake index 5dc81ec09..0b4bbd211 100644 --- a/scripts/cmake/vcpkg_build_cmake.cmake +++ b/scripts/cmake/vcpkg_build_cmake.cmake @@ -58,19 +58,23 @@ function(vcpkg_build_cmake) set(TARGET_PARAM) endif() - message(STATUS "Build ${TARGET_TRIPLET}-rel") - vcpkg_execute_required_process( - COMMAND ${CMAKE_COMMAND} --build . --config Release ${TARGET_PARAM} -- ${BUILD_ARGS} - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel - LOGNAME ${_bc_LOGFILE_ROOT}-${TARGET_TRIPLET}-rel - ) - message(STATUS "Build ${TARGET_TRIPLET}-rel done") + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + message(STATUS "Build ${TARGET_TRIPLET}-rel") + vcpkg_execute_required_process( + COMMAND ${CMAKE_COMMAND} --build . --config Release ${TARGET_PARAM} -- ${BUILD_ARGS} + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel + LOGNAME ${_bc_LOGFILE_ROOT}-${TARGET_TRIPLET}-rel + ) + message(STATUS "Build ${TARGET_TRIPLET}-rel done") + endif() - message(STATUS "Build ${TARGET_TRIPLET}-dbg") - vcpkg_execute_required_process( - COMMAND ${CMAKE_COMMAND} --build . --config Debug ${TARGET_PARAM} -- ${BUILD_ARGS} - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg - LOGNAME ${_bc_LOGFILE_ROOT}-${TARGET_TRIPLET}-dbg - ) - message(STATUS "Build ${TARGET_TRIPLET}-dbg done") + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + message(STATUS "Build ${TARGET_TRIPLET}-dbg") + vcpkg_execute_required_process( + COMMAND ${CMAKE_COMMAND} --build . --config Debug ${TARGET_PARAM} -- ${BUILD_ARGS} + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg + LOGNAME ${_bc_LOGFILE_ROOT}-${TARGET_TRIPLET}-dbg + ) + message(STATUS "Build ${TARGET_TRIPLET}-dbg done") + endif() endfunction() diff --git a/scripts/cmake/vcpkg_build_msbuild.cmake b/scripts/cmake/vcpkg_build_msbuild.cmake index 81f442ef7..b8403d277 100644 --- a/scripts/cmake/vcpkg_build_msbuild.cmake +++ b/scripts/cmake/vcpkg_build_msbuild.cmake @@ -87,25 +87,29 @@ function(vcpkg_build_msbuild) /m ) - message(STATUS "Building ${_csc_PROJECT_PATH} for Release") - file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel) - vcpkg_execute_required_process( - COMMAND msbuild ${_csc_PROJECT_PATH} - /p:Configuration=${_csc_RELEASE_CONFIGURATION} - ${_csc_OPTIONS} - ${_csc_OPTIONS_RELEASE} - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel - LOGNAME build-${TARGET_TRIPLET}-rel - ) + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + message(STATUS "Building ${_csc_PROJECT_PATH} for Release") + file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel) + vcpkg_execute_required_process( + COMMAND msbuild ${_csc_PROJECT_PATH} + /p:Configuration=${_csc_RELEASE_CONFIGURATION} + ${_csc_OPTIONS} + ${_csc_OPTIONS_RELEASE} + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel + LOGNAME build-${TARGET_TRIPLET}-rel + ) + endif() - message(STATUS "Building ${_csc_PROJECT_PATH} for Debug") - file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) - vcpkg_execute_required_process( - COMMAND msbuild ${_csc_PROJECT_PATH} - /p:Configuration=${_csc_DEBUG_CONFIGURATION} - ${_csc_OPTIONS} - ${_csc_OPTIONS_DEBUG} - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg - LOGNAME build-${TARGET_TRIPLET}-dbg - ) + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + message(STATUS "Building ${_csc_PROJECT_PATH} for Debug") + file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) + vcpkg_execute_required_process( + COMMAND msbuild ${_csc_PROJECT_PATH} + /p:Configuration=${_csc_DEBUG_CONFIGURATION} + ${_csc_OPTIONS} + ${_csc_OPTIONS_DEBUG} + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg + LOGNAME build-${TARGET_TRIPLET}-dbg + ) + endif() endfunction() diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake index d40550f06..4bcf3d2c9 100644 --- a/scripts/cmake/vcpkg_configure_cmake.cmake +++ b/scripts/cmake/vcpkg_configure_cmake.cmake @@ -199,29 +199,33 @@ function(vcpkg_configure_cmake) ) endif() - message(STATUS "Configuring ${TARGET_TRIPLET}-rel") - file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel) - vcpkg_execute_required_process( - COMMAND ${CMAKE_COMMAND} ${_csc_SOURCE_PATH} ${_csc_OPTIONS} ${_csc_OPTIONS_RELEASE} - -G ${GENERATOR} - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR} - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel - LOGNAME config-${TARGET_TRIPLET}-rel - ) - message(STATUS "Configuring ${TARGET_TRIPLET}-rel done") + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + message(STATUS "Configuring ${TARGET_TRIPLET}-rel") + file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel) + vcpkg_execute_required_process( + COMMAND ${CMAKE_COMMAND} ${_csc_SOURCE_PATH} ${_csc_OPTIONS} ${_csc_OPTIONS_RELEASE} + -G ${GENERATOR} + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR} + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel + LOGNAME config-${TARGET_TRIPLET}-rel + ) + message(STATUS "Configuring ${TARGET_TRIPLET}-rel done") + endif() - message(STATUS "Configuring ${TARGET_TRIPLET}-dbg") - file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) - vcpkg_execute_required_process( - COMMAND ${CMAKE_COMMAND} ${_csc_SOURCE_PATH} ${_csc_OPTIONS} ${_csc_OPTIONS_DEBUG} - -G ${GENERATOR} - -DCMAKE_BUILD_TYPE=Debug - -DCMAKE_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR}/debug - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg - LOGNAME config-${TARGET_TRIPLET}-dbg - ) - message(STATUS "Configuring ${TARGET_TRIPLET}-dbg done") + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + message(STATUS "Configuring ${TARGET_TRIPLET}-dbg") + file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) + vcpkg_execute_required_process( + COMMAND ${CMAKE_COMMAND} ${_csc_SOURCE_PATH} ${_csc_OPTIONS} ${_csc_OPTIONS_DEBUG} + -G ${GENERATOR} + -DCMAKE_BUILD_TYPE=Debug + -DCMAKE_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR}/debug + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg + LOGNAME config-${TARGET_TRIPLET}-dbg + ) + message(STATUS "Configuring ${TARGET_TRIPLET}-dbg done") + endif() 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 143bb74de..9b87261d5 100644 --- a/scripts/cmake/vcpkg_configure_meson.cmake +++ b/scripts/cmake/vcpkg_configure_meson.cmake @@ -42,31 +42,35 @@ function(vcpkg_configure_meson) set(ENV{PATH} "$ENV{PATH};${NINJA_PATH}") # configure release - message(STATUS "Configuring ${TARGET_TRIPLET}-rel") - file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel) - set(ENV{CFLAGS} "${MESON_COMMON_CFLAGS} ${MESON_RELEASE_CFLAGS}") - set(ENV{CXXFLAGS} "${MESON_COMMON_CXXFLAGS} ${MESON_RELEASE_CXXFLAGS}") - set(ENV{LDFLAGS} "${MESON_COMMON_LDFLAGS} ${MESON_RELEASE_LDFLAGS}") - set(ENV{CPPFLAGS} "${MESON_COMMON_CPPFLAGS} ${MESON_RELEASE_CPPFLAGS}") - vcpkg_execute_required_process( - COMMAND ${MESON} ${_vcm_OPTIONS} ${_vcm_OPTIONS_RELEASE} ${_vcm_SOURCE_PATH} - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel - LOGNAME config-${TARGET_TRIPLET}-rel - ) - message(STATUS "Configuring ${TARGET_TRIPLET}-rel done") - - # configure debug - message(STATUS "Configuring ${TARGET_TRIPLET}-dbg") - file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) - set(ENV{CFLAGS} "${MESON_COMMON_CFLAGS} ${MESON_DEBUG_CFLAGS}") - set(ENV{CXXFLAGS} "${MESON_COMMON_CXXFLAGS} ${MESON_DEBUG_CXXFLAGS}") - set(ENV{LDFLAGS} "${MESON_COMMON_LDFLAGS} ${MESON_DEBUG_LDFLAGS}") - set(ENV{CPPFLAGS} "${MESON_COMMON_CPPFLAGS} ${MESON_DEBUG_CPPFLAGS}") - vcpkg_execute_required_process( - COMMAND ${MESON} ${_vcm_OPTIONS} ${_vcm_OPTIONS_DEBUG} ${_vcm_SOURCE_PATH} - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg - LOGNAME config-${TARGET_TRIPLET}-dbg - ) - message(STATUS "Configuring ${TARGET_TRIPLET}-dbg done") + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + message(STATUS "Configuring ${TARGET_TRIPLET}-rel") + file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel) + set(ENV{CFLAGS} "${MESON_COMMON_CFLAGS} ${MESON_RELEASE_CFLAGS}") + set(ENV{CXXFLAGS} "${MESON_COMMON_CXXFLAGS} ${MESON_RELEASE_CXXFLAGS}") + set(ENV{LDFLAGS} "${MESON_COMMON_LDFLAGS} ${MESON_RELEASE_LDFLAGS}") + set(ENV{CPPFLAGS} "${MESON_COMMON_CPPFLAGS} ${MESON_RELEASE_CPPFLAGS}") + vcpkg_execute_required_process( + COMMAND ${MESON} ${_vcm_OPTIONS} ${_vcm_OPTIONS_RELEASE} ${_vcm_SOURCE_PATH} + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel + LOGNAME config-${TARGET_TRIPLET}-rel + ) + message(STATUS "Configuring ${TARGET_TRIPLET}-rel done") + endif() + + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + # configure debug + message(STATUS "Configuring ${TARGET_TRIPLET}-dbg") + file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) + set(ENV{CFLAGS} "${MESON_COMMON_CFLAGS} ${MESON_DEBUG_CFLAGS}") + set(ENV{CXXFLAGS} "${MESON_COMMON_CXXFLAGS} ${MESON_DEBUG_CXXFLAGS}") + set(ENV{LDFLAGS} "${MESON_COMMON_LDFLAGS} ${MESON_DEBUG_LDFLAGS}") + set(ENV{CPPFLAGS} "${MESON_COMMON_CPPFLAGS} ${MESON_DEBUG_CPPFLAGS}") + vcpkg_execute_required_process( + COMMAND ${MESON} ${_vcm_OPTIONS} ${_vcm_OPTIONS_DEBUG} ${_vcm_SOURCE_PATH} + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg + LOGNAME config-${TARGET_TRIPLET}-dbg + ) + message(STATUS "Configuring ${TARGET_TRIPLET}-dbg done") + endif() endfunction() diff --git a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake index 5bf1b2cdb..f86ad0661 100644 --- a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake +++ b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake @@ -27,29 +27,33 @@ function(vcpkg_fixup_cmake_targets) set(DEBUG_CONFIG ${CURRENT_PACKAGES_DIR}/debug/${_vfct_CONFIG_PATH}) set(RELEASE_CONFIG ${CURRENT_PACKAGES_DIR}/${_vfct_CONFIG_PATH}) - if(NOT EXISTS ${DEBUG_CONFIG}) - message(FATAL_ERROR "'${DEBUG_CONFIG}' does not exist.") - endif() + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + if(NOT EXISTS ${DEBUG_CONFIG}) + message(FATAL_ERROR "'${DEBUG_CONFIG}' does not exist.") + endif() - file(MAKE_DIRECTORY ${DEBUG_SHARE}) - file(GLOB FILES ${DEBUG_CONFIG}/*) - file(COPY ${FILES} DESTINATION ${DEBUG_SHARE}) - file(REMOVE_RECURSE ${DEBUG_CONFIG}) + file(MAKE_DIRECTORY ${DEBUG_SHARE}) + file(GLOB FILES ${DEBUG_CONFIG}/*) + file(COPY ${FILES} DESTINATION ${DEBUG_SHARE}) + file(REMOVE_RECURSE ${DEBUG_CONFIG}) + endif() file(GLOB FILES ${RELEASE_CONFIG}/*) file(COPY ${FILES} DESTINATION ${RELEASE_SHARE}) file(REMOVE_RECURSE ${RELEASE_CONFIG}) - get_filename_component(DEBUG_CONFIG_DIR_NAME ${DEBUG_CONFIG} NAME) - string(TOLOWER "${DEBUG_CONFIG_DIR_NAME}" DEBUG_CONFIG_DIR_NAME) - if(DEBUG_CONFIG_DIR_NAME STREQUAL "cmake") - file(REMOVE_RECURSE ${DEBUG_CONFIG}) - else() - get_filename_component(DEBUG_CONFIG_PARENT_DIR ${DEBUG_CONFIG} DIRECTORY) - get_filename_component(DEBUG_CONFIG_DIR_NAME ${DEBUG_CONFIG_PARENT_DIR} NAME) + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + get_filename_component(DEBUG_CONFIG_DIR_NAME ${DEBUG_CONFIG} NAME) string(TOLOWER "${DEBUG_CONFIG_DIR_NAME}" DEBUG_CONFIG_DIR_NAME) if(DEBUG_CONFIG_DIR_NAME STREQUAL "cmake") - file(REMOVE_RECURSE ${DEBUG_CONFIG_PARENT_DIR}) + file(REMOVE_RECURSE ${DEBUG_CONFIG}) + else() + get_filename_component(DEBUG_CONFIG_PARENT_DIR ${DEBUG_CONFIG} DIRECTORY) + get_filename_component(DEBUG_CONFIG_DIR_NAME ${DEBUG_CONFIG_PARENT_DIR} NAME) + string(TOLOWER "${DEBUG_CONFIG_DIR_NAME}" DEBUG_CONFIG_DIR_NAME) + if(DEBUG_CONFIG_DIR_NAME STREQUAL "cmake") + file(REMOVE_RECURSE ${DEBUG_CONFIG_PARENT_DIR}) + endif() endif() endif() @@ -67,8 +71,10 @@ function(vcpkg_fixup_cmake_targets) endif() endif() - if(NOT EXISTS ${DEBUG_SHARE}) - message(FATAL_ERROR "'${DEBUG_SHARE}' does not exist.") + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + if(NOT EXISTS ${DEBUG_SHARE}) + message(FATAL_ERROR "'${DEBUG_SHARE}' does not exist.") + endif() endif() file(GLOB UNUSED_FILES @@ -94,23 +100,25 @@ function(vcpkg_fixup_cmake_targets) file(WRITE ${RELEASE_TARGET} "${_contents}") endforeach() - file(GLOB DEBUG_TARGETS - "${DEBUG_SHARE}/*[Tt]argets-debug.cmake" - "${DEBUG_SHARE}/*[Cc]onfig-debug.cmake" - "${DEBUG_SHARE}/*[Ee]xports-debug.cmake" - ) - foreach(DEBUG_TARGET ${DEBUG_TARGETS}) - get_filename_component(DEBUG_TARGET_NAME ${DEBUG_TARGET} NAME) - - file(READ ${DEBUG_TARGET} _contents) - string(REPLACE "${CURRENT_INSTALLED_DIR}" "\${_IMPORT_PREFIX}" _contents "${_contents}") - string(REGEX REPLACE "\\\${_IMPORT_PREFIX}/bin/([^ \"]+\\.exe)" "\${_IMPORT_PREFIX}/tools/${PORT}/\\1" _contents "${_contents}") - string(REPLACE "\${_IMPORT_PREFIX}/lib" "\${_IMPORT_PREFIX}/debug/lib" _contents "${_contents}") - string(REPLACE "\${_IMPORT_PREFIX}/bin" "\${_IMPORT_PREFIX}/debug/bin" _contents "${_contents}") - file(WRITE ${CURRENT_PACKAGES_DIR}/share/${PORT}/${DEBUG_TARGET_NAME} "${_contents}") - - file(REMOVE ${DEBUG_TARGET}) - endforeach() + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(GLOB DEBUG_TARGETS + "${DEBUG_SHARE}/*[Tt]argets-debug.cmake" + "${DEBUG_SHARE}/*[Cc]onfig-debug.cmake" + "${DEBUG_SHARE}/*[Ee]xports-debug.cmake" + ) + foreach(DEBUG_TARGET ${DEBUG_TARGETS}) + get_filename_component(DEBUG_TARGET_NAME ${DEBUG_TARGET} NAME) + + file(READ ${DEBUG_TARGET} _contents) + string(REPLACE "${CURRENT_INSTALLED_DIR}" "\${_IMPORT_PREFIX}" _contents "${_contents}") + string(REGEX REPLACE "\\\${_IMPORT_PREFIX}/bin/([^ \"]+\\.exe)" "\${_IMPORT_PREFIX}/tools/${PORT}/\\1" _contents "${_contents}") + string(REPLACE "\${_IMPORT_PREFIX}/lib" "\${_IMPORT_PREFIX}/debug/lib" _contents "${_contents}") + string(REPLACE "\${_IMPORT_PREFIX}/bin" "\${_IMPORT_PREFIX}/debug/bin" _contents "${_contents}") + file(WRITE ${CURRENT_PACKAGES_DIR}/share/${PORT}/${DEBUG_TARGET_NAME} "${_contents}") + + file(REMOVE ${DEBUG_TARGET}) + endforeach() + endif() file(GLOB MAIN_TARGETS "${RELEASE_SHARE}/*[Tt]argets.cmake") foreach(MAIN_TARGET ${MAIN_TARGETS}) diff --git a/scripts/get_triplet_environment.cmake b/scripts/get_triplet_environment.cmake index d498edf4a..bc79b16ce 100644 --- a/scripts/get_triplet_environment.cmake +++ b/scripts/get_triplet_environment.cmake @@ -8,3 +8,4 @@ message("VCPKG_CMAKE_SYSTEM_VERSION=${VCPKG_CMAKE_SYSTEM_VERSION}") message("VCPKG_PLATFORM_TOOLSET=${VCPKG_PLATFORM_TOOLSET}") message("VCPKG_VISUAL_STUDIO_PATH=${VCPKG_VISUAL_STUDIO_PATH}") message("VCPKG_CHAINLOAD_TOOLCHAIN_FILE=${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}") +message("VCPKG_BUILD_TYPE=${VCPKG_BUILD_TYPE}") -- cgit v1.2.3 From 14cbe496bcc136aac590f10d79848ec224088e85 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Sat, 25 Nov 2017 15:53:32 -0800 Subject: [vcpkg] Allow compilation inside WSL --- scripts/buildsystems/vcpkg.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 4d82c43b7..8edc2830c 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -42,6 +42,8 @@ else() set(_VCPKG_TARGET_TRIPLET_ARCH arm) elseif(_VCPKG_CL MATCHES "bin/cl.exe$" OR _VCPKG_CL MATCHES "x86/cl.exe$") set(_VCPKG_TARGET_TRIPLET_ARCH x86) + elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64") + set(_VCPKG_TARGET_TRIPLET_ARCH x64) else() message(FATAL_ERROR "Unable to determine target architecture.") endif() @@ -50,6 +52,8 @@ endif() if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone") set(_VCPKG_TARGET_TRIPLET_PLAT uwp) +elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") + set(_VCPKG_TARGET_TRIPLET_PLAT linux) else() set(_VCPKG_TARGET_TRIPLET_PLAT windows) endif() @@ -93,7 +97,7 @@ list(APPEND CMAKE_LIBRARY_PATH set(Boost_COMPILER "-vc140") -if (NOT DEFINED CMAKE_SYSTEM_VERSION) +if (NOT DEFINED CMAKE_SYSTEM_VERSION AND _VCPKG_TARGET_TRIPLET_PLAT MATCHES "windows|uwp") include(${_VCPKG_ROOT_DIR}/scripts/cmake/vcpkg_get_windows_sdk.cmake) # This is used as an implicit parameter for vcpkg_get_windows_sdk set(VCPKG_ROOT_DIR ${_VCPKG_ROOT_DIR}) @@ -134,7 +138,7 @@ function(add_executable name) list(FIND ARGV "IMPORTED" IMPORTED_IDX) list(FIND ARGV "ALIAS" ALIAS_IDX) if(IMPORTED_IDX EQUAL -1 AND ALIAS_IDX EQUAL -1) - if(VCPKG_APPLOCAL_DEPS) + if(VCPKG_APPLOCAL_DEPS AND _VCPKG_TARGET_TRIPLET_PLAT MATCHES "windows|uwp") add_custom_command(TARGET ${name} POST_BUILD COMMAND powershell -noprofile -executionpolicy Bypass -file ${_VCPKG_TOOLCHAIN_DIR}/msbuild/applocal.ps1 -targetBinary $ -- cgit v1.2.3 From 8883e40aaadbba91610342fda42d304a4cad0e68 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Sun, 26 Nov 2017 01:31:58 -0800 Subject: vcpkgCreateDirectory->vcpkgCreateDirectoryIfNotExists --- scripts/VcpkgPowershellUtils.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/VcpkgPowershellUtils.ps1 b/scripts/VcpkgPowershellUtils.ps1 index 0b1a35262..d32c3ae6b 100644 --- a/scripts/VcpkgPowershellUtils.ps1 +++ b/scripts/VcpkgPowershellUtils.ps1 @@ -3,7 +3,7 @@ function vcpkgHasModule([Parameter(Mandatory=$true)][string]$moduleName) return [bool](Get-Module -ListAvailable -Name $moduleName) } -function vcpkgCreateDirectory([Parameter(Mandatory=$true)][string]$dirPath) +function vcpkgCreateDirectoryIfNotExists([Parameter(Mandatory=$true)][string]$dirPath) { if (!(Test-Path $dirPath)) { @@ -102,7 +102,7 @@ function vcpkgDownloadFile( [Parameter(Mandatory=$true)][string]$url, } $downloadDir = split-path -parent $downloadPath - vcpkgCreateDirectory $downloadDir + vcpkgCreateDirectoryIfNotExists $downloadDir $downloadPartPath = "$downloadPath.part" vcpkgRemoveFile $downloadPartPath @@ -144,12 +144,12 @@ function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file, [Parameter(Mandatory=$true)][string]$destinationDir) { $parentPath = split-path -parent $destinationDir - vcpkgCreateDirectory $parentPath + vcpkgCreateDirectoryIfNotExists $parentPath $baseName = (Get-ChildItem $file).BaseName $destinationPartial = "$destinationDir\$baseName-partially_extracted" vcpkgRemoveDirectory $destinationPartial - vcpkgCreateDirectory $destinationPartial + vcpkgCreateDirectoryIfNotExists $destinationPartial if (vcpkgHasCommand -commandName 'Microsoft.PowerShell.Archive\Expand-Archive') { -- cgit v1.2.3 From 92872439b9e76ec881edae187d5fb137f02ce39b Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Sun, 26 Nov 2017 01:32:09 -0800 Subject: [fetchDependency[ Make parameter mandatory --- scripts/fetchDependency.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index 596845acb..6e022928f 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -1,6 +1,6 @@ [CmdletBinding()] param( - [string]$Dependency + [Parameter(Mandatory=$true)][string]$Dependency ) $scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition -- cgit v1.2.3 From e009618ba0850ef54e837e8fb76910245d99b456 Mon Sep 17 00:00:00 2001 From: Mikhail Paulyshka Date: Sun, 26 Nov 2017 14:18:35 +0300 Subject: [cmake] update to 3.10.0 (#2236) --- scripts/fetchDependency.ps1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index 6e022928f..744439bb7 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -20,12 +20,12 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) if($Dependency -eq "cmake") { - $requiredVersion = "3.9.5" - $downloadVersion = "3.9.5" - $url = "https://cmake.org/files/v3.9/cmake-3.9.5-win32-x86.zip" - $downloadPath = "$downloadsDir\cmake-3.9.5-win32-x86.zip" - $expectedDownloadedFileHash = "dd3e183254c12f7c338d3edfa642f1ac84a763b8b9a2feabb4ad5fccece5dff9" - $executableFromDownload = "$downloadsDir\cmake-3.9.5-win32-x86\bin\cmake.exe" + $requiredVersion = "3.10.0" + $downloadVersion = "3.10.0" + $url = "https://cmake.org/files/v3.10/cmake-3.10.0-win32-x86.zip" + $downloadPath = "$downloadsDir\cmake-3.10.0-win32-x86.zip" + $expectedDownloadedFileHash = "dce666e897f95a88d3eed6cddd1faa3f44179d519b33ca6065b385bbc7072419" + $executableFromDownload = "$downloadsDir\cmake-3.10.0-win32-x86\bin\cmake.exe" $extractionType = $ExtractionType_ZIP } elseif($Dependency -eq "nuget") -- cgit v1.2.3 From c4c079f86eac8215040173d6707900d8983ea7fc Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 27 Nov 2017 00:25:29 -0800 Subject: [VcpkgPowershellUtils] Minor tweaks --- scripts/VcpkgPowershellUtils.ps1 | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/VcpkgPowershellUtils.ps1 b/scripts/VcpkgPowershellUtils.ps1 index d32c3ae6b..d431c3b45 100644 --- a/scripts/VcpkgPowershellUtils.ps1 +++ b/scripts/VcpkgPowershellUtils.ps1 @@ -11,6 +11,20 @@ function vcpkgCreateDirectoryIfNotExists([Parameter(Mandatory=$true)][string]$di } } +function vcpkgCreateParentDirectoryIfNotExists([Parameter(Mandatory=$true)][string]$path) +{ + $parentDir = split-path -parent $path + if ([string]::IsNullOrEmpty($parentDir)) + { + return + } + + if (!(Test-Path $dirPath)) + { + New-Item -ItemType Directory -Path $parentDir | Out-Null + } +} + function vcpkgRemoveDirectory([Parameter(Mandatory=$true)][string]$dirPath) { if (Test-Path $dirPath) @@ -101,8 +115,7 @@ function vcpkgDownloadFile( [Parameter(Mandatory=$true)][string]$url, return } - $downloadDir = split-path -parent $downloadPath - vcpkgCreateDirectoryIfNotExists $downloadDir + vcpkgCreateParentDirectoryIfNotExists $downloadPath $downloadPartPath = "$downloadPath.part" vcpkgRemoveFile $downloadPartPath @@ -143,10 +156,10 @@ function vcpkgDownloadFile( [Parameter(Mandatory=$true)][string]$url, function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file, [Parameter(Mandatory=$true)][string]$destinationDir) { - $parentPath = split-path -parent $destinationDir - vcpkgCreateDirectoryIfNotExists $parentPath + vcpkgCreateParentDirectoryIfNotExists $destinationDir $baseName = (Get-ChildItem $file).BaseName - $destinationPartial = "$destinationDir\$baseName-partially_extracted" + $destination = "$destinationDir\$baseName" + $destinationPartial = "$destination-partially_extracted" vcpkgRemoveDirectory $destinationPartial vcpkgCreateDirectoryIfNotExists $destinationPartial @@ -179,10 +192,12 @@ function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file, { Move-Item -Path "$destinationPartial\*" -Destination $destinationDir vcpkgRemoveDirectory $destinationPartial + return $destination } else { Rename-Item -Path $destinationPartial -NewName $baseName + return $destination } } -- cgit v1.2.3 From 2c914ff05af3b2209eb11b6ba61b43eb46033cb3 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 27 Nov 2017 00:42:21 -0800 Subject: Rework vcpkgExtractFile (powershell) --- scripts/VcpkgPowershellUtils.ps1 | 12 +++++------- scripts/fetchDependency.ps1 | 3 ++- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'scripts') diff --git a/scripts/VcpkgPowershellUtils.ps1 b/scripts/VcpkgPowershellUtils.ps1 index d431c3b45..0e53ff620 100644 --- a/scripts/VcpkgPowershellUtils.ps1 +++ b/scripts/VcpkgPowershellUtils.ps1 @@ -19,7 +19,7 @@ function vcpkgCreateParentDirectoryIfNotExists([Parameter(Mandatory=$true)][stri return } - if (!(Test-Path $dirPath)) + if (!(Test-Path $parentDir)) { New-Item -ItemType Directory -Path $parentDir | Out-Null } @@ -157,9 +157,7 @@ function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file, [Parameter(Mandatory=$true)][string]$destinationDir) { vcpkgCreateParentDirectoryIfNotExists $destinationDir - $baseName = (Get-ChildItem $file).BaseName - $destination = "$destinationDir\$baseName" - $destinationPartial = "$destination-partially_extracted" + $destinationPartial = "$destinationDir-partially_extracted" vcpkgRemoveDirectory $destinationPartial vcpkgCreateDirectoryIfNotExists $destinationPartial @@ -192,12 +190,12 @@ function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file, { Move-Item -Path "$destinationPartial\*" -Destination $destinationDir vcpkgRemoveDirectory $destinationPartial - return $destination + return $destinationDir } else { - Rename-Item -Path $destinationPartial -NewName $baseName - return $destination + Move-Item -Path $destinationPartial -Destination $destinationDir + return $destinationDir } } diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index 744439bb7..830ec7064 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -88,7 +88,8 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) { if (-not (Test-Path $executableFromDownload)) { - vcpkgExtractFile -File $downloadPath -DestinationDir $downloadsDir + $extractFolderName = (Get-ChildItem $downloadPath).BaseName + vcpkgExtractFile -File $downloadPath -DestinationDir "$downloadsDir\$extractFolderName" } } elseif($extractionType -eq $ExtractionType_SELF_EXTRACTING_7Z) -- cgit v1.2.3 From b7c9ef55531cba1c014650dbc5ff33fa1b977b40 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 27 Nov 2017 00:45:00 -0800 Subject: Don't return $destinationDir --- scripts/VcpkgPowershellUtils.ps1 | 2 -- 1 file changed, 2 deletions(-) (limited to 'scripts') diff --git a/scripts/VcpkgPowershellUtils.ps1 b/scripts/VcpkgPowershellUtils.ps1 index 0e53ff620..28e818437 100644 --- a/scripts/VcpkgPowershellUtils.ps1 +++ b/scripts/VcpkgPowershellUtils.ps1 @@ -190,12 +190,10 @@ function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file, { Move-Item -Path "$destinationPartial\*" -Destination $destinationDir vcpkgRemoveDirectory $destinationPartial - return $destinationDir } else { Move-Item -Path $destinationPartial -Destination $destinationDir - return $destinationDir } } -- cgit v1.2.3 From b4668e664a4db7b8bc9e9c4c202312e0fb7a8ff9 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Tue, 28 Nov 2017 13:17:10 -0800 Subject: [vcpkg] Only default target triplet to windows if on windows --- scripts/buildsystems/vcpkg.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 8edc2830c..24f6d855e 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -54,7 +54,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" OR CMAKE_SYSTEM_NAME STREQUAL "Wind set(_VCPKG_TARGET_TRIPLET_PLAT uwp) elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") set(_VCPKG_TARGET_TRIPLET_PLAT linux) -else() +elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") set(_VCPKG_TARGET_TRIPLET_PLAT windows) endif() -- cgit v1.2.3 From d38d4a75408e0e9d0820187b16da2e06ce0ee316 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Wed, 29 Nov 2017 23:45:47 -0800 Subject: [vcpkg] Add --x-xunit internal command to print installation results in a VSTS friendly format. --- scripts/internalCI.ps1 | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'scripts') diff --git a/scripts/internalCI.ps1 b/scripts/internalCI.ps1 index 16ce4fc7a..37f4f35a4 100644 --- a/scripts/internalCI.ps1 +++ b/scripts/internalCI.ps1 @@ -1,5 +1,7 @@ $ErrorActionPreference = "Stop" +rm TEST-internal-ci.xml -errorAction SilentlyContinue + New-Item -type directory downloads -errorAction SilentlyContinue | Out-Null ./scripts/bootstrap.ps1 if (-not $?) { throw $? } @@ -7,21 +9,14 @@ if (-not $?) { throw $? } # Clear out any intermediate files from the previous build if (Test-Path buildtrees) { - Get-ChildItem buildtrees/*/* | ? { $_.Name -ne "src" -and $_.Extension -ne ".log"} | Remove-Item -Recurse -Force + Get-ChildItem buildtrees/*/* | ? { $_.Name -ne "src" } | Remove-Item -Recurse -Force } # Purge any outdated packages ./vcpkg remove --outdated --recurse if (-not $?) { throw $? } -./vcpkg.exe install azure-storage-cpp cpprestsdk:x64-windows-static cpprestsdk:x86-uwp -if (-not $?) { throw $? } - -./vcpkg.exe install bond cryptopp zlib expat sdl2 curl sqlite3 libuv protobuf:x64-windows sfml opencv:x64-windows uwebsockets uwebsockets:x64-windows-static +./vcpkg.exe install azure-storage-cpp cpprestsdk:x64-windows-static cpprestsdk:x86-uwp ` +bond cryptopp zlib expat sdl2 curl sqlite3 libuv protobuf:x64-windows sfml opencv:x64-windows uwebsockets uwebsockets:x64-windows-static ` +opencv:x86-uwp boost:x86-uwp --keep-going "--x-xunit=TEST-internal-ci.xml" if (-not $?) { throw $? } - -./vcpkg.exe install opencv:x86-uwp boost:x86-uwp -if (-not $?) { throw $? } - -# ./vcpkg.exe install folly:x64-windows -# if (-not $?) { throw $? } -- cgit v1.2.3 From fdf7c65aa4ea53e580a85c9b984109c4f4446da5 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 30 Nov 2017 16:43:41 -0800 Subject: Exit early if no VS is found --- scripts/bootstrap.ps1 | 2 +- scripts/findAnyMSBuildWithCppPlatformToolset.ps1 | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/bootstrap.ps1 b/scripts/bootstrap.ps1 index ca7b1a0ce..3f40a2ead 100644 --- a/scripts/bootstrap.ps1 +++ b/scripts/bootstrap.ps1 @@ -46,7 +46,7 @@ try & $msbuildExe "/p:VCPKG_VERSION=-$gitHash" "/p:DISABLE_METRICS=$disableMetrics" /p:Configuration=Release /p:Platform=x86 /p:PlatformToolset=$platformToolset /p:TargetPlatformVersion=$windowsSDK /m dirs.proj if ($LASTEXITCODE -ne 0) { - Write-Error "Building vcpkg.exe failed. Please ensure you have installed the Desktop C++ workload and the Windows SDK for Desktop C++." + Write-Error "Building vcpkg.exe failed. Please ensure you have installed Visual Studio with the Desktop C++ workload and the Windows SDK for Desktop C++." return } diff --git a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 index e58b58c04..46ba767b9 100644 --- a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 +++ b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 @@ -8,6 +8,11 @@ $withVSPath = $withVSPath -replace "\\$" # Remove potential trailing backslash $scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition $VisualStudioInstallationInstances = & $scriptsDir\findVisualStudioInstallationInstances.ps1 +if ($VisualStudioInstallationInstances -eq $null) +{ + throw "Could not find Visual Studio. VS2015 or VS2017 (with C++) needs to be installed." +} + Write-Verbose "VS Candidates:`n`r$([system.String]::Join([Environment]::NewLine, $VisualStudioInstallationInstances))" foreach ($instanceCandidateWithEOL in $VisualStudioInstallationInstances) { -- cgit v1.2.3 From d26a6b067c24e324b111849c320bdc4cf681e713 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Sun, 26 Nov 2017 02:51:31 -0800 Subject: Add `vcpkg integrate powershell` for tab completion --- scripts/addPoshVcpkgToPowershellProfile.ps1 | 55 +++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 scripts/addPoshVcpkgToPowershellProfile.ps1 (limited to 'scripts') diff --git a/scripts/addPoshVcpkgToPowershellProfile.ps1 b/scripts/addPoshVcpkgToPowershellProfile.ps1 new file mode 100644 index 000000000..92a7573e4 --- /dev/null +++ b/scripts/addPoshVcpkgToPowershellProfile.ps1 @@ -0,0 +1,55 @@ +[CmdletBinding()] +param() + +function findExistingImportModuleDirectives([Parameter(Mandatory=$true)][string]$path) +{ + if (!(Test-Path $path)) + { + return $false + } + + $fileContents = Get-Content $path + return $fileContents -match 'Import-Module.+?(?=posh-vcpkg)' +} + +$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition +. "$scriptsDir\VcpkgPowershellUtils.ps1" + +$profileEntry = "Import-Module '$scriptsDir\posh-vcpkg'" +$profilePath = $PROFILE # Implicit powershell variable +if (!(Test-Path $profilePath)) +{ + $profileDir = Split-Path $profilePath -Parent + vcpkgCreateDirectoryIfNotExists $profileDir +} + +Write-Host "`nAdding the following line to ${profilePath}:" +Write-Host " $profileEntry" + +# @() Needed to force Array in PowerShell 2.0 +[Array]$existingImports = @(findExistingImportModuleDirectives $profilePath) +if ($existingImports.Count -gt 0) +{ + $existingImportsOut = $existingImports -join "`n " + Write-Host "`nposh-vcpkg is already imported to your PowerShell profile. The following entries were found:" + Write-Host " $existingImportsOut" + Write-Host "`nPlease make sure you have started a new Powershell window for the changes to take effect." + return +} + +# Posh-git does the following check, so we should too. +# https://github.com/dahlbyk/posh-git/blob/master/src/Utils.ps1 +# If the profile script exists and is signed, then we should not modify it +if (Test-Path $profilePath) +{ + $sig = Get-AuthenticodeSignature $profilePath + if ($null -ne $sig.SignerCertificate) + { + Write-Warning "Skipping add of posh-vcpkg import to profile; '$profilePath' appears to be signed." + Write-Warning "Please manually add the line '$profileEntry' to your profile and resign it." + return + } +} + +Add-Content $profilePath -Value "`n$profileEntry" -Encoding UTF8 +Write-Host "`nSuccessfully added posh-vcpkg to your PowerShell profile. Please start a new Powershell window for the changes to take effect." -- cgit v1.2.3 From a4f8515c9e6af66bbdcf704c75e5284daa240040 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Mon, 4 Dec 2017 17:37:08 -0800 Subject: [vcpkg-msbuild-integration] Address #2299 by using full path to powershell. --- scripts/buildsystems/msbuild/vcpkg.targets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/buildsystems/msbuild/vcpkg.targets b/scripts/buildsystems/msbuild/vcpkg.targets index ad1dde89b..d6fbcf179 100644 --- a/scripts/buildsystems/msbuild/vcpkg.targets +++ b/scripts/buildsystems/msbuild/vcpkg.targets @@ -67,11 +67,11 @@ File="$(TLogLocation)$(ProjectName).write.1u.tlog" Lines="^$(TargetPath);$([System.IO.Path]::Combine($(ProjectDir),$(IntDir)))vcpkg.applocal.log" Encoding="Unicode"/> -- cgit v1.2.3 From e7cbb50f3dd323380928f4cb4e5b9bc0945abac8 Mon Sep 17 00:00:00 2001 From: Ilya Finkelshteyn Date: Tue, 5 Dec 2017 14:31:58 -0800 Subject: Fix path to powershell.exe https://github.com/Microsoft/vcpkg/issues/2299 --- scripts/buildsystems/msbuild/vcpkg.targets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/buildsystems/msbuild/vcpkg.targets b/scripts/buildsystems/msbuild/vcpkg.targets index d6fbcf179..092e013b5 100644 --- a/scripts/buildsystems/msbuild/vcpkg.targets +++ b/scripts/buildsystems/msbuild/vcpkg.targets @@ -67,11 +67,11 @@ File="$(TLogLocation)$(ProjectName).write.1u.tlog" Lines="^$(TargetPath);$([System.IO.Path]::Combine($(ProjectDir),$(IntDir)))vcpkg.applocal.log" Encoding="Unicode"/> -- cgit v1.2.3 From 1f3013bea303736d216361a47e2f323577ab9c46 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 8 Dec 2017 15:16:35 -0800 Subject: Improve vcpkgExtractFile. Also merge vcpkgRemoveDirectory/File --- scripts/VcpkgPowershellUtils.ps1 | 41 ++++++++++++++++++---------------------- scripts/fetchDependency.ps1 | 4 ++-- 2 files changed, 20 insertions(+), 25 deletions(-) (limited to 'scripts') diff --git a/scripts/VcpkgPowershellUtils.ps1 b/scripts/VcpkgPowershellUtils.ps1 index 28e818437..45f52b225 100644 --- a/scripts/VcpkgPowershellUtils.ps1 +++ b/scripts/VcpkgPowershellUtils.ps1 @@ -25,7 +25,7 @@ function vcpkgCreateParentDirectoryIfNotExists([Parameter(Mandatory=$true)][stri } } -function vcpkgRemoveDirectory([Parameter(Mandatory=$true)][string]$dirPath) +function vcpkgRemoveItem([Parameter(Mandatory=$true)][string]$dirPath) { if (Test-Path $dirPath) { @@ -33,14 +33,6 @@ function vcpkgRemoveDirectory([Parameter(Mandatory=$true)][string]$dirPath) } } -function vcpkgRemoveFile([Parameter(Mandatory=$true)][string]$filePath) -{ - if (Test-Path $filePath) - { - Remove-Item $filePath -Force - } -} - function vcpkgHasCommand([Parameter(Mandatory=$true)][string]$commandName) { return [bool](Get-Command -Name $commandName -ErrorAction SilentlyContinue) @@ -118,7 +110,7 @@ function vcpkgDownloadFile( [Parameter(Mandatory=$true)][string]$url, vcpkgCreateParentDirectoryIfNotExists $downloadPath $downloadPartPath = "$downloadPath.part" - vcpkgRemoveFile $downloadPartPath + vcpkgRemoveItem $downloadPartPath $wc = New-Object System.Net.WebClient $proxyAuth = !$wc.Proxy.IsBypassed($url) @@ -144,7 +136,7 @@ function vcpkgDownloadFile( [Parameter(Mandatory=$true)][string]$url, catch [System.Exception] { # If BITS fails for any reason, delete any potentially partially downloaded files and continue - vcpkgRemoveFile $downloadPartPath + vcpkgRemoveItem $downloadPartPath } } @@ -154,14 +146,21 @@ function vcpkgDownloadFile( [Parameter(Mandatory=$true)][string]$url, } function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file, - [Parameter(Mandatory=$true)][string]$destinationDir) + [Parameter(Mandatory=$true)][string]$destinationDir, + [Parameter(Mandatory=$true)][string]$outFilename) { - vcpkgCreateParentDirectoryIfNotExists $destinationDir - $destinationPartial = "$destinationDir-partially_extracted" + vcpkgCreateDirectoryIfNotExists $destinationDir + $output = "$destinationDir/$outFilename" + vcpkgRemoveItem $output + $destinationPartial = "$destinationDir/partially-extracted" - vcpkgRemoveDirectory $destinationPartial + vcpkgRemoveItem $destinationPartial vcpkgCreateDirectoryIfNotExists $destinationPartial + $shell = new-object -com shell.application + $zip = $shell.NameSpace($file) + $itemCount = $zip.Items().Count + if (vcpkgHasCommand -commandName 'Microsoft.PowerShell.Archive\Expand-Archive') { Write-Verbose("Extracting with Microsoft.PowerShell.Archive\Expand-Archive") @@ -175,8 +174,6 @@ function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file, else { Write-Verbose("Extracting via shell") - $shell = new-object -com shell.application - $zip = $shell.NameSpace($file) foreach($item in $zip.items()) { # Piping to Out-Null is used to block until finished @@ -184,16 +181,14 @@ function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file, } } - $hasASingleItem = (Get-ChildItem $destinationPartial | Measure-Object).Count -eq 1; - - if ($hasASingleItem) + if ($itemCount -eq 1) { - Move-Item -Path "$destinationPartial\*" -Destination $destinationDir - vcpkgRemoveDirectory $destinationPartial + Move-Item -Path "$destinationPartial\*" -Destination $output + vcpkgRemoveItem $destinationPartial } else { - Move-Item -Path $destinationPartial -Destination $destinationDir + Move-Item -Path $destinationPartial -Destination $output } } diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index 830ec7064..f62fe450c 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -88,8 +88,8 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) { if (-not (Test-Path $executableFromDownload)) { - $extractFolderName = (Get-ChildItem $downloadPath).BaseName - vcpkgExtractFile -File $downloadPath -DestinationDir "$downloadsDir\$extractFolderName" + $outFilename = (Get-ChildItem $downloadPath).BaseName + vcpkgExtractFile -File $downloadPath -DestinationDir $downloadsDir -outFilename $outFilename } } elseif($extractionType -eq $ExtractionType_SELF_EXTRACTING_7Z) -- cgit v1.2.3 From 3c2b2cc60719b110de889b62dd13af5f1a4b883c Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Fri, 8 Dec 2017 22:03:03 -0800 Subject: [vcpkg-cmake-toolchain] Use list(APPEND) instead of set(). Fixes #2336. Fix MPI issue introduced in cmake 3.10. Fixes #2317. Add _VCPKG_ROOT_DIR to persisted variables to reduce disk access during cmake reconfigure. --- scripts/buildsystems/vcpkg.cmake | 50 ++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 17 deletions(-) (limited to 'scripts') diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 24f6d855e..cdef610c1 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -1,6 +1,7 @@ # Mark variables as used so cmake doesn't complain about them mark_as_advanced(CMAKE_TOOLCHAIN_FILE) +# This is a backport of CMAKE_TRY_COMPILE_PLATFORM_VARIABLES to cmake 3.0 get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE ) if( _CMAKE_IN_TRY_COMPILE ) include( "${CMAKE_CURRENT_SOURCE_DIR}/../vcpkg.config.cmake" OPTIONAL ) @@ -61,17 +62,19 @@ endif() set(VCPKG_TARGET_TRIPLET ${_VCPKG_TARGET_TRIPLET_ARCH}-${_VCPKG_TARGET_TRIPLET_PLAT} CACHE STRING "Vcpkg target triplet (ex. x86-windows)") set(_VCPKG_TOOLCHAIN_DIR ${CMAKE_CURRENT_LIST_DIR}) -# Detect .vcpkg-root to figure VCPKG_ROOT_DIR -set(_VCPKG_ROOT_DIR_CANDIDATE ${CMAKE_CURRENT_LIST_DIR}) -while(IS_DIRECTORY ${_VCPKG_ROOT_DIR_CANDIDATE} AND NOT EXISTS "${_VCPKG_ROOT_DIR_CANDIDATE}/.vcpkg-root") - get_filename_component(_VCPKG_ROOT_DIR_TEMP ${_VCPKG_ROOT_DIR_CANDIDATE} DIRECTORY) - if (_VCPKG_ROOT_DIR_TEMP STREQUAL _VCPKG_ROOT_DIR_CANDIDATE) # If unchanged, we have reached the root of the drive - message(FATAL_ERROR "Could not find .vcpkg-root") - else() - SET(_VCPKG_ROOT_DIR_CANDIDATE ${_VCPKG_ROOT_DIR_TEMP}) - endif() -endwhile() -set(_VCPKG_ROOT_DIR ${_VCPKG_ROOT_DIR_CANDIDATE}) +if(NOT DEFINED _VCPKG_ROOT_DIR) + # Detect .vcpkg-root to figure VCPKG_ROOT_DIR + set(_VCPKG_ROOT_DIR_CANDIDATE ${CMAKE_CURRENT_LIST_DIR}) + while(IS_DIRECTORY ${_VCPKG_ROOT_DIR_CANDIDATE} AND NOT EXISTS "${_VCPKG_ROOT_DIR_CANDIDATE}/.vcpkg-root") + get_filename_component(_VCPKG_ROOT_DIR_TEMP ${_VCPKG_ROOT_DIR_CANDIDATE} DIRECTORY) + if (_VCPKG_ROOT_DIR_TEMP STREQUAL _VCPKG_ROOT_DIR_CANDIDATE) # If unchanged, we have reached the root of the drive + message(FATAL_ERROR "Could not find .vcpkg-root") + else() + SET(_VCPKG_ROOT_DIR_CANDIDATE ${_VCPKG_ROOT_DIR_TEMP}) + endif() + endwhile() + set(_VCPKG_ROOT_DIR ${_VCPKG_ROOT_DIR_CANDIDATE} CACHE STRING "Vcpkg root directory") +endif() set(_VCPKG_INSTALLED_DIR ${_VCPKG_ROOT_DIR}/installed) if(CMAKE_BUILD_TYPE MATCHES "^Debug$" OR NOT DEFINED CMAKE_BUILD_TYPE) @@ -95,8 +98,6 @@ list(APPEND CMAKE_LIBRARY_PATH ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/manual-link ) -set(Boost_COMPILER "-vc140") - if (NOT DEFINED CMAKE_SYSTEM_VERSION AND _VCPKG_TARGET_TRIPLET_PLAT MATCHES "windows|uwp") include(${_VCPKG_ROOT_DIR}/scripts/cmake/vcpkg_get_windows_sdk.cmake) # This is used as an implicit parameter for vcpkg_get_windows_sdk @@ -124,11 +125,11 @@ set(CMAKE_SYSTEM_IGNORE_PATH "C:/OpenSSL-Win64/lib/VC/static" ) -set(CMAKE_PROGRAM_PATH ${CMAKE_PROGRAM_PATH} ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools) +list(APPEND CMAKE_PROGRAM_PATH ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools) file(GLOB _VCPKG_TOOLS_DIRS ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/*) foreach(_VCPKG_TOOLS_DIR ${_VCPKG_TOOLS_DIRS}) if(IS_DIRECTORY ${_VCPKG_TOOLS_DIR}) - set(CMAKE_PROGRAM_PATH ${CMAKE_PROGRAM_PATH} ${_VCPKG_TOOLS_DIR}) + list(APPEND CMAKE_PROGRAM_PATH ${_VCPKG_TOOLS_DIR}) endif() endforeach() @@ -167,6 +168,7 @@ macro(find_package name) unset(Boost_USE_STATIC_LIBS) unset(Boost_USE_MULTITHREADED) unset(Boost_USE_STATIC_RUNTIME) + set(Boost_COMPILER "-vc140") _find_package(${ARGV}) elseif("${name}" STREQUAL "ICU") function(_vcpkg_find_in_list) @@ -188,6 +190,17 @@ macro(find_package name) if(TIFF_LIBRARIES) list(APPEND TIFF_LIBRARIES ${LIBLZMA_LIBRARIES}) endif() + elseif("${name}" STREQUAL "MPI") + if(MPI_C_LIB_NAMES) + set(MPI_C_WORKS TRUE) + set(MPI_C_WRAPPER_FOUND TRUE) + endif() + if(MPI_CXX_LIB_NAMES) + set(MPI_CXX_WORKS TRUE) + set(MPI_CXX_WRAPPER_FOUND TRUE) + set(MPI_CXX_VALIDATE_SKIP_MPICXX TRUE) + endif() + _find_package(${ARGV}) else() _find_package(${ARGV}) endif() @@ -202,8 +215,11 @@ set(_UNUSED ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP}) if(NOT _CMAKE_IN_TRY_COMPILE) file(TO_CMAKE_PATH "${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}" _chainload_file) + file(TO_CMAKE_PATH "${_VCPKG_ROOT_DIR}" _root_dir) file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/vcpkg.config.cmake" "set(VCPKG_TARGET_TRIPLET \"${VCPKG_TARGET_TRIPLET}\" CACHE STRING \"\")\n" "set(VCPKG_APPLOCAL_DEPS \"${VCPKG_APPLOCAL_DEPS}\" CACHE STRING \"\")\n" - "set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE \"${_chainload_file}\" CACHE STRING \"\")\n") -endif() \ No newline at end of file + "set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE \"${_chainload_file}\" CACHE STRING \"\")\n" + "set(_VCPKG_ROOT_DIR \"${_root_dir}\" CACHE STRING \"\")\n" + ) +endif() -- cgit v1.2.3 From 19860a093370c5a57bd8c622e5e47177193c7c8e Mon Sep 17 00:00:00 2001 From: cDc Date: Sat, 9 Dec 2017 10:24:19 +0200 Subject: [tinyexif] add TinyEXIF library (#2221) --- scripts/buildsystems/vcpkg.cmake | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'scripts') diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index cdef610c1..22dc5d6b1 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -190,6 +190,12 @@ macro(find_package name) if(TIFF_LIBRARIES) list(APPEND TIFF_LIBRARIES ${LIBLZMA_LIBRARIES}) endif() + elseif("${name}" STREQUAL "tinyxml2") + _find_package(${ARGV}) + if(TARGET tinyxml2_static AND NOT TARGET tinyxml2) + add_library(tinyxml2 INTERFACE IMPORTED) + set_target_properties(tinyxml2 PROPERTIES INTERFACE_LINK_LIBRARIES "tinyxml2_static") + endif() elseif("${name}" STREQUAL "MPI") if(MPI_C_LIB_NAMES) set(MPI_C_WORKS TRUE) -- cgit v1.2.3 From 4567fa570916b0398ac0a65645e2074a4c8f0fd9 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Sat, 9 Dec 2017 17:25:12 -0800 Subject: [vcpkg-cmake-toolchain] Mark _VCPKG_ROOT_DIR as INTERNAL --- scripts/buildsystems/vcpkg.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 22dc5d6b1..71cf4e9b3 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -73,7 +73,7 @@ if(NOT DEFINED _VCPKG_ROOT_DIR) SET(_VCPKG_ROOT_DIR_CANDIDATE ${_VCPKG_ROOT_DIR_TEMP}) endif() endwhile() - set(_VCPKG_ROOT_DIR ${_VCPKG_ROOT_DIR_CANDIDATE} CACHE STRING "Vcpkg root directory") + set(_VCPKG_ROOT_DIR ${_VCPKG_ROOT_DIR_CANDIDATE} CACHE INTERNAL "Vcpkg root directory") endif() set(_VCPKG_INSTALLED_DIR ${_VCPKG_ROOT_DIR}/installed) -- cgit v1.2.3 From 1656cf7fa7f8fe7fa3d803c86fbd9ae8a649b719 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 12 Dec 2017 17:52:57 -0800 Subject: [powershell] Use \ instead of / for paths. Resolves #2358. Resolves #2361 --- scripts/VcpkgPowershellUtils.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/VcpkgPowershellUtils.ps1 b/scripts/VcpkgPowershellUtils.ps1 index 45f52b225..e394e540e 100644 --- a/scripts/VcpkgPowershellUtils.ps1 +++ b/scripts/VcpkgPowershellUtils.ps1 @@ -150,9 +150,9 @@ function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file, [Parameter(Mandatory=$true)][string]$outFilename) { vcpkgCreateDirectoryIfNotExists $destinationDir - $output = "$destinationDir/$outFilename" + $output = "$destinationDir\$outFilename" vcpkgRemoveItem $output - $destinationPartial = "$destinationDir/partially-extracted" + $destinationPartial = "$destinationDir\partially-extracted" vcpkgRemoveItem $destinationPartial vcpkgCreateDirectoryIfNotExists $destinationPartial -- cgit v1.2.3 From 7e1a737ba4ef1fb0377b75c4a64973f821a561d0 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Tue, 19 Dec 2017 16:11:20 -0800 Subject: [vcpkg-integrate-powershell] Fix $false bug. Fixes #2397. --- scripts/addPoshVcpkgToPowershellProfile.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/addPoshVcpkgToPowershellProfile.ps1 b/scripts/addPoshVcpkgToPowershellProfile.ps1 index 92a7573e4..7a12e7d34 100644 --- a/scripts/addPoshVcpkgToPowershellProfile.ps1 +++ b/scripts/addPoshVcpkgToPowershellProfile.ps1 @@ -5,11 +5,12 @@ function findExistingImportModuleDirectives([Parameter(Mandatory=$true)][string] { if (!(Test-Path $path)) { - return $false + return } $fileContents = Get-Content $path - return $fileContents -match 'Import-Module.+?(?=posh-vcpkg)' + $fileContents -match 'Import-Module.+?(?=posh-vcpkg)' + return } $scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition -- cgit v1.2.3 From 6cb6a61aaf5ef2c143f974e9f731778bcd3f5cbe Mon Sep 17 00:00:00 2001 From: Tsukasa Sugiura Date: Wed, 20 Dec 2017 09:18:13 +0900 Subject: Fix find Boost when can not be found Boost that installed with Vcpkg (#2395) * Fix find Boost when can not be found Boost that installed with Vcpkg Fix find Boost when can not be found Boost that installed with Vcpkg. Re-find package Boost uisng user specified options. * Fix regex of generators Fix regex of generators. Add ending position. * Fix Save and Resore Boost_COMPILER * [vcpkg-cmake-integration] Expand saved boost variables --- scripts/buildsystems/vcpkg.cmake | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 71cf4e9b3..b8d3fbdbb 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -31,9 +31,9 @@ else() set(_VCPKG_TARGET_TRIPLET_ARCH x86) elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 Win64$") set(_VCPKG_TARGET_TRIPLET_ARCH x64) - elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 ARM") + elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 ARM$") set(_VCPKG_TARGET_TRIPLET_ARCH arm) - elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017") + elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017$") set(_VCPKG_TARGET_TRIPLET_ARCH x86) else() find_program(_VCPKG_CL cl) @@ -165,11 +165,22 @@ endfunction() macro(find_package name) if("${name}" STREQUAL "Boost") + set(_Boost_USE_STATIC_LIBS ${Boost_USE_STATIC_LIBS}) + set(_Boost_USE_MULTITHREADED ${Boost_USE_MULTITHREADED}) + set(_Boost_USE_STATIC_RUNTIME ${Boost_USE_STATIC_RUNTIME}) + set(_Boost_COMPILER ${Boost_COMPILER}) unset(Boost_USE_STATIC_LIBS) unset(Boost_USE_MULTITHREADED) unset(Boost_USE_STATIC_RUNTIME) set(Boost_COMPILER "-vc140") _find_package(${ARGV}) + if(NOT Boost_FOUND) + set(Boost_USE_STATIC_LIBS ${_Boost_USE_STATIC_LIBS}) + set(Boost_USE_MULTITHREADED ${_Boost_USE_MULTITHREADED}) + set(Boost_USE_STATIC_RUNTIME ${_Boost_USE_STATIC_RUNTIME}) + set(Boost_COMPILER ${_Boost_COMPILER}) + _find_package(${ARGV}) + endif() elseif("${name}" STREQUAL "ICU") function(_vcpkg_find_in_list) list(FIND ARGV "COMPONENTS" COMPONENTS_IDX) -- cgit v1.2.3 From 5e5506e68a9657d18bc4fb4380b5b4dfc849c019 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Thu, 21 Dec 2017 03:47:02 -0800 Subject: [vcpkg-download-distfile] Add input sanitization --- scripts/cmake/vcpkg_download_distfile.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_download_distfile.cmake b/scripts/cmake/vcpkg_download_distfile.cmake index b22d82a16..24503338a 100644 --- a/scripts/cmake/vcpkg_download_distfile.cmake +++ b/scripts/cmake/vcpkg_download_distfile.cmake @@ -39,6 +39,16 @@ function(vcpkg_download_distfile VAR) set(multipleValuesArgs URLS) cmake_parse_arguments(vcpkg_download_distfile "" "${oneValueArgs}" "${multipleValuesArgs}" ${ARGN}) + if(NOT DEFINED vcpkg_download_distfile_URLS) + message(FATAL_ERROR "vcpkg_download_distfile requires a URLS argument.") + endif() + if(NOT DEFINED vcpkg_download_distfile_FILENAME) + message(FATAL_ERROR "vcpkg_download_distfile requires a FILENAME argument.") + endif() + if(NOT DEFINED vcpkg_download_distfile_SHA512) + message(FATAL_ERROR "vcpkg_download_distfile requires a SHA512 argument.") + endif() + set(downloaded_file_path ${DOWNLOADS}/${vcpkg_download_distfile_FILENAME}) set(download_file_path_part "${DOWNLOADS}/temp/${vcpkg_download_distfile_FILENAME}") -- cgit v1.2.3