diff options
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/VcpkgPowershellUtils.ps1 | 20 | ||||
| -rw-r--r-- | scripts/buildsystems/vcpkg.cmake | 12 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_find_acquire_program.cmake | 17 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_fixup_cmake_targets.cmake | 22 | ||||
| -rw-r--r-- | scripts/fetchTool.ps1 | 19 | ||||
| -rw-r--r-- | scripts/vcpkgTools.xml | 34 |
6 files changed, 73 insertions, 51 deletions
diff --git a/scripts/VcpkgPowershellUtils.ps1 b/scripts/VcpkgPowershellUtils.ps1 index d9c9e3760..92e0f21d0 100644 --- a/scripts/VcpkgPowershellUtils.ps1 +++ b/scripts/VcpkgPowershellUtils.ps1 @@ -110,9 +110,9 @@ function vcpkgGetSHA256([Parameter(Mandatory=$true)][string]$filePath) function vcpkgCheckEqualFileHash( [Parameter(Mandatory=$true)][string]$filePath, [Parameter(Mandatory=$true)][string]$expectedHash, - [Parameter(Mandatory=$true)][string]$actualHash ) + [Parameter(Mandatory=$true)][string]$actualHash) { - if ($expectedDownloadedFileHash -ne $downloadedFileHash) + if ($expectedHash -ne $actualHash) { Write-Host ("`nFile does not have expected hash:`n" + " File path: [ $filePath ]`n" + @@ -150,7 +150,6 @@ function vcpkgDownloadFile( [Parameter(Mandatory=$true)][string]$url, $downloadPartPath = "$downloadPath.part" vcpkgRemoveItem $downloadPartPath - $wc = New-Object System.Net.WebClient if (!$wc.Proxy.IsBypassed($url)) { @@ -161,7 +160,7 @@ function vcpkgDownloadFile( [Parameter(Mandatory=$true)][string]$url, Move-Item -Path $downloadPartPath -Destination $downloadPath } -function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file, +function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$archivePath, [Parameter(Mandatory=$true)][string]$destinationDir, [Parameter(Mandatory=$true)][string]$outFilename) { @@ -176,18 +175,18 @@ function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file, if (vcpkgHasCommand -commandName 'Microsoft.PowerShell.Archive\Expand-Archive') { Write-Verbose("Extracting with Microsoft.PowerShell.Archive\Expand-Archive") - Microsoft.PowerShell.Archive\Expand-Archive -path $file -destinationpath $destinationPartial + Microsoft.PowerShell.Archive\Expand-Archive -path $archivePath -destinationpath $destinationPartial } elseif (vcpkgHasCommand -commandName 'Pscx\Expand-Archive') { Write-Verbose("Extracting with Pscx\Expand-Archive") - Pscx\Expand-Archive -path $file -OutputPath $destinationPartial + Pscx\Expand-Archive -path $archivePath -OutputPath $destinationPartial } else { Write-Verbose("Extracting via shell") $shell = new-object -com shell.application - $zip = $shell.NameSpace($(Get-Item $file).fullname) + $zip = $shell.NameSpace($(Get-Item $archivePath).fullname) foreach($item in $zip.items()) { # Piping to Out-Null is used to block until finished @@ -195,11 +194,14 @@ function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$file, } } - $itemCount = @(Get-ChildItem "$destinationPartial").Count + $items = @(Get-ChildItem "$destinationPartial") + $itemCount = $items.Count if ($itemCount -eq 1) { - Move-Item -Path "$destinationPartial\*" -Destination $output + $item = $items | Select-Object -first 1 + Write-Host "$item" + Move-Item -Path "$destinationPartial\$item" -Destination $output vcpkgRemoveItem $destinationPartial } else diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 10e3c3f13..0c32b22fb 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -44,7 +44,7 @@ else() elseif(_VCPKG_CL MATCHES "arm/cl.exe$") set(_VCPKG_TARGET_TRIPLET_ARCH arm) elseif(_VCPKG_CL MATCHES "arm64/cl.exe$") - set(_VCPKG_TARGET_TRIPLET_ARCH arm64) + set(_VCPKG_TARGET_TRIPLET_ARCH arm64) 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") @@ -110,16 +110,6 @@ list(APPEND CMAKE_LIBRARY_PATH ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/manual-link ) -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}) - vcpkg_get_windows_sdk(WINDOWS_SDK_VERSION) - unset(VCPKG_ROOT_DIR) - set(CMAKE_SYSTEM_VERSION ${WINDOWS_SDK_VERSION} CACHE STRING "Windows SDK version") - message(STATUS "Found Windows SDK ${WINDOWS_SDK_VERSION}") -endif() - file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles) set(CMAKE_SYSTEM_IGNORE_PATH "${_programfiles}/OpenSSL" diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake index 083b86fc2..64d0c7599 100644 --- a/scripts/cmake/vcpkg_find_acquire_program.cmake +++ b/scripts/cmake/vcpkg_find_acquire_program.cmake @@ -40,6 +40,7 @@ function(vcpkg_find_acquire_program VAR) endif() unset(NOEXTRACT) + unset(_vfa_RENAME) unset(SUBDIR) unset(REQUIRED_INTERPRETER) @@ -67,11 +68,13 @@ function(vcpkg_find_acquire_program VAR) set(HASH df7aaba094e17832688c88993997612a2e2c96cc3dc14ca3e8347b44c7762115f5a7fc6d7f20be402553aaa4c9e43ddfcf6228f581cfe89289bae550de151b36) elseif(VAR MATCHES "YASM") set(PROGNAME yasm) - set(PATHS ${DOWNLOADS}/tools/yasm) - set(URL "http://www.tortall.net/projects/yasm/releases/yasm-1.3.0-win32.exe") - set(ARCHIVE "yasm.exe") + set(SUBDIR 1.3.0.6) + set(PATHS ${DOWNLOADS}/tools/yasm/${SUBDIR}) + set(URL "https://www.tortall.net/projects/yasm/snapshots/v1.3.0.6.g1962/yasm-1.3.0.6.g1962.exe") + set(ARCHIVE "yasm-1.3.0.6.g1962.exe") + set(_vfa_RENAME "yasm.exe") set(NOEXTRACT ON) - set(HASH 850b26be5bbbdaeaf45ac39dd27f69f1a85e600c35afbd16b9f621396b3c7a19863ea3ff316b025b578fce0a8280eef2203306a2b3e46ee1389abb65313fb720) + set(HASH c1945669d983b632a10c5ff31e86d6ecbff143c3d8b2c433c0d3d18f84356d2b351f71ac05fd44e5403651b00c31db0d14615d7f9a6ecce5750438d37105c55b) elseif(VAR MATCHES "PYTHON3") set(PROGNAME python) set(SUBDIR "python3") @@ -205,7 +208,11 @@ function(vcpkg_find_acquire_program VAR) file(MAKE_DIRECTORY ${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR}) if(DEFINED NOEXTRACT) - file(COPY ${ARCHIVE_PATH} DESTINATION ${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR}) + if(DEFINED _vfa_RENAME) + file(INSTALL ${ARCHIVE_PATH} DESTINATION ${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR} RENAME ${_vfa_RENAME}) + else() + file(COPY ${ARCHIVE_PATH} DESTINATION ${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR}) + endif() else() get_filename_component(ARCHIVE_EXTENSION ${ARCHIVE} EXT) string(TOLOWER "${ARCHIVE_EXTENSION}" ARCHIVE_EXTENSION) diff --git a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake index 7f1f827c2..475047737 100644 --- a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake +++ b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake @@ -81,7 +81,7 @@ function(vcpkg_fixup_cmake_targets) endif() endif() - file(GLOB UNUSED_FILES + file(GLOB_RECURSE UNUSED_FILES "${DEBUG_SHARE}/*[Tt]argets.cmake" "${DEBUG_SHARE}/*[Cc]onfig.cmake" "${DEBUG_SHARE}/*[Cc]onfigVersion.cmake" @@ -91,10 +91,10 @@ function(vcpkg_fixup_cmake_targets) file(REMOVE ${UNUSED_FILES}) endif() - file(GLOB RELEASE_TARGETS + file(GLOB_RECURSE RELEASE_TARGETS "${RELEASE_SHARE}/*-release.cmake" ) - foreach(RELEASE_TARGET ${RELEASE_TARGETS}) + foreach(RELEASE_TARGET IN LISTS RELEASE_TARGETS) file(READ ${RELEASE_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}") @@ -102,25 +102,25 @@ function(vcpkg_fixup_cmake_targets) endforeach() if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") - file(GLOB DEBUG_TARGETS + file(GLOB_RECURSE DEBUG_TARGETS "${DEBUG_SHARE}/*-debug.cmake" ) - foreach(DEBUG_TARGET ${DEBUG_TARGETS}) - get_filename_component(DEBUG_TARGET_NAME ${DEBUG_TARGET} NAME) + foreach(DEBUG_TARGET IN LISTS DEBUG_TARGETS) + file(RELATIVE_PATH DEBUG_TARGET_REL "${DEBUG_SHARE}" "${DEBUG_TARGET}") 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}/${_vfct_TARGET_PATH}/${DEBUG_TARGET_NAME} "${_contents}") + file(WRITE ${RELEASE_SHARE}/${DEBUG_TARGET_REL} "${_contents}") file(REMOVE ${DEBUG_TARGET}) endforeach() endif() - file(GLOB MAIN_TARGETS "${RELEASE_SHARE}/*[Tt]argets.cmake") - foreach(MAIN_TARGET ${MAIN_TARGETS}) + file(GLOB_RECURSE MAIN_TARGETS "${RELEASE_SHARE}/*[Tt]argets.cmake") + foreach(MAIN_TARGET IN LISTS MAIN_TARGETS) file(READ ${MAIN_TARGET} _contents) string(REGEX REPLACE "get_filename_component\\(_IMPORT_PREFIX \"\\\${CMAKE_CURRENT_LIST_FILE}\" PATH\\)(\nget_filename_component\\(_IMPORT_PREFIX \"\\\${_IMPORT_PREFIX}\" PATH\\))*" @@ -133,8 +133,8 @@ function(vcpkg_fixup_cmake_targets) file(WRITE ${MAIN_TARGET} "${_contents}") endforeach() - file(GLOB MAIN_CONFIGS "${RELEASE_SHARE}/*[Cc]onfig.cmake") - foreach(MAIN_CONFIG ${MAIN_CONFIGS}) + file(GLOB_RECURSE MAIN_CONFIGS "${RELEASE_SHARE}/*[Cc]onfig.cmake") + foreach(MAIN_CONFIG IN LISTS MAIN_CONFIGS) file(READ ${MAIN_CONFIG} _contents) string(REGEX REPLACE "get_filename_component\\(_IMPORT_PREFIX \"\\\${CMAKE_CURRENT_LIST_FILE}\" PATH\\)(\nget_filename_component\\(_IMPORT_PREFIX \"\\\${_IMPORT_PREFIX}\" PATH\\))*" diff --git a/scripts/fetchTool.ps1 b/scripts/fetchTool.ps1 index ff9b5d9bf..26eedac3b 100644 --- a/scripts/fetchTool.ps1 +++ b/scripts/fetchTool.ps1 @@ -25,7 +25,7 @@ function fetchToolInternal([Parameter(Mandatory=$true)][string]$tool) throw "Unkown tool $tool" } - $exePath = "$downloadsDir\$(@($toolData.exeRelativePath)[0])" + $exePath = "$downloadsDir\$($toolData.exeRelativePath)" if (Test-Path $exePath) { @@ -35,22 +35,22 @@ function fetchToolInternal([Parameter(Mandatory=$true)][string]$tool) $isArchive = vcpkgHasProperty -object $toolData -propertyName "archiveRelativePath" if ($isArchive) { - $downloadPath = "$downloadsDir\$(@($toolData.archiveRelativePath)[0])" + $downloadPath = "$downloadsDir\$($toolData.archiveRelativePath)" } else { - $downloadPath = "$downloadsDir\$(@($toolData.exeRelativePath)[0])" + $downloadPath = "$downloadsDir\$($toolData.exeRelativePath)" } - [String]$url = @($toolData.url)[0] + [String]$url = $toolData.url if (!(Test-Path $downloadPath)) { Write-Host "Downloading $tool..." vcpkgDownloadFile $url $downloadPath - Write-Host "Downloading $tool has completed successfully." + Write-Host "Downloading $tool... done." } - $expectedDownloadedFileHash = @($toolData.sha256)[0] + $expectedDownloadedFileHash = $toolData.sha256 $downloadedFileHash = vcpkgGetSHA256 $downloadPath vcpkgCheckEqualFileHash -filePath $downloadPath -expectedHash $expectedDownloadedFileHash -actualHash $downloadedFileHash @@ -58,13 +58,14 @@ function fetchToolInternal([Parameter(Mandatory=$true)][string]$tool) { $outFilename = (Get-ChildItem $downloadPath).BaseName Write-Host "Extracting $tool..." - vcpkgExtractFile -File $downloadPath -DestinationDir $downloadsDir -outFilename $outFilename - Write-Host "Extracting $tool has completed successfully." + vcpkgExtractFile -ArchivePath $downloadPath -DestinationDir $downloadsDir -outFilename $outFilename + Write-Host "Extracting $tool... done." } if (-not (Test-Path $exePath)) { - throw ("Could not detect or download " + $tool) + Write-Error "Could not detect or download $tool" + throw } return $exePath diff --git a/scripts/vcpkgTools.xml b/scripts/vcpkgTools.xml index 9c78e92d9..477584c5a 100644 --- a/scripts/vcpkgTools.xml +++ b/scripts/vcpkgTools.xml @@ -6,12 +6,20 @@ <url>https://cmake.org/files/v3.10/cmake-3.10.2-win32-x86.zip</url> <sha256>f5f7e41a21d0e9b655aca58498b08e17ecd27796bf82837e2c84435359169dd6</sha256> <archiveRelativePath>cmake-3.10.2-win32-x86.zip</archiveRelativePath> - <exeRelativePath os="osx">cmake-3.10.2-Darwin-x86_64/CMake.app/Contents/bin/cmake</exeRelativePath> - <url os="osx">https://cmake.org/files/v3.10/cmake-3.10.2-Darwin-x86_64.tar.gz</url> - <archiveRelativePath os="osx">cmake-3.10.2-Darwin-x86_64.tar.gz</archiveRelativePath> - <exeRelativePath os="linux">cmake-3.10.2-Linux-x86_64/bin/cmake</exeRelativePath> - <url os="linux">https://cmake.org/files/v3.10/cmake-3.10.2-Linux-x86_64.tar.gz</url> - <archiveRelativePath os="linux">cmake-3.10.2-Linux-x86_64.tar.gz</archiveRelativePath> + </tool> + <tool name="cmake" os="osx"> + <requiredVersion>3.10.2</requiredVersion> + <exeRelativePath>cmake-3.10.2-Darwin-x86_64/CMake.app/Contents/bin/cmake</exeRelativePath> + <url>https://cmake.org/files/v3.10/cmake-3.10.2-Darwin-x86_64.tar.gz</url> + <sha256>e748eb7698f8e2783c2eea9ab81eebf66da0238bbf8e8fa722a67a38f2110718</sha256> + <archiveRelativePath>cmake-3.10.2-Darwin-x86_64.tar.gz</archiveRelativePath> + </tool> + <tool name="cmake" os="linux"> + <requiredVersion>3.10.2</requiredVersion> + <exeRelativePath>cmake-3.10.2-Linux-x86_64/bin/cmake</exeRelativePath> + <url>https://cmake.org/files/v3.10/cmake-3.10.2-Linux-x86_64.tar.gz</url> + <sha256>7a82b46c35f4e68a0807e8dc04e779dee3f36cd42c6387fd13b5c29fe62a69ea</sha256> + <archiveRelativePath>cmake-3.10.2-Linux-x86_64.tar.gz</archiveRelativePath> </tool> <tool name="git"> <requiredVersion>2.16.2</requiredVersion> @@ -46,4 +54,18 @@ <sha256>2a3afe19c180f8373fa02ff00254d5394fec0349f5804e0ad2f6067854ff28ac</sha256> <archiveRelativePath>7za920.zip</archiveRelativePath> </tool> + <tool name="ninja" os="linux"> + <requiredVersion>1.8.2</requiredVersion> + <exeRelativePath>ninja</exeRelativePath> + <url>https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip</url> + <sha256>d2fea9ff33b3ef353161ed906f260d565ca55b8ca0568fa07b1d2cab90a84a07</sha256> + <archiveRelativePath>ninja-linux.zip</archiveRelativePath> + </tool> + <tool name="ninja" os="osx"> + <requiredVersion>1.8.2</requiredVersion> + <exeRelativePath>ninja</exeRelativePath> + <url>https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-mac.zip</url> + <sha256>0347d55c66061652b26f48769d566761630ffde3143793b29064a57f356542cc</sha256> + <archiveRelativePath>ninja-mac.zip</archiveRelativePath> + </tool> </tools> |
