diff options
| author | eao197 <eao197@gmail.com> | 2018-05-30 19:25:16 +0300 |
|---|---|---|
| committer | eao197 <eao197@gmail.com> | 2018-05-30 19:25:16 +0300 |
| commit | 99eb78cf2dd8b000ac195dd9ebba4fb344dc5baa (patch) | |
| tree | 18072db815a8f417c4d63a00ae95286642f0dff3 /scripts | |
| parent | 34257a50ceda0bfa05e59b532f71223b70f39d52 (diff) | |
| parent | 842252373992a9c7b74f041607b47754d61cc0c8 (diff) | |
| download | vcpkg-99eb78cf2dd8b000ac195dd9ebba4fb344dc5baa.tar.gz vcpkg-99eb78cf2dd8b000ac195dd9ebba4fb344dc5baa.zip | |
Merge https://github.com/Microsoft/vcpkg
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/VcpkgPowershellUtils.ps1 | 318 | ||||
| -rw-r--r-- | scripts/addPoshVcpkgToPowershellProfile.ps1 | 8 | ||||
| -rw-r--r-- | scripts/bootstrap.ps1 | 314 | ||||
| -rw-r--r-- | scripts/bootstrap.sh | 19 | ||||
| -rw-r--r-- | scripts/cleanEnvironmentHelper.ps1 (renamed from scripts/VcpkgPowershellUtils-ClearEnvironment.ps1) | 0 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_find_acquire_program.cmake | 2 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_from_github.cmake | 73 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_get_windows_sdk.cmake | 14 | ||||
| -rw-r--r-- | scripts/fetchTool.ps1 | 107 | ||||
| -rw-r--r-- | scripts/findAnyMSBuildWithCppPlatformToolset.ps1 | 58 | ||||
| -rw-r--r-- | scripts/findVisualStudioInstallationInstances.ps1 | 61 | ||||
| -rw-r--r-- | scripts/getProgramFiles32bit.ps1 | 17 | ||||
| -rw-r--r-- | scripts/getProgramFilesPlatformBitness.ps1 | 17 | ||||
| -rw-r--r-- | scripts/getWindowsSDK.ps1 | 126 | ||||
| -rw-r--r-- | scripts/internalCI.ps1 | 22 | ||||
| -rw-r--r-- | scripts/toolchains/linux.cmake | 14 | ||||
| -rw-r--r-- | scripts/vcpkgTools.xml | 35 |
17 files changed, 402 insertions, 803 deletions
diff --git a/scripts/VcpkgPowershellUtils.ps1 b/scripts/VcpkgPowershellUtils.ps1 deleted file mode 100644 index fdd89e7b9..000000000 --- a/scripts/VcpkgPowershellUtils.ps1 +++ /dev/null @@ -1,318 +0,0 @@ -function vcpkgHasModule([Parameter(Mandatory=$true)][string]$moduleName) -{ - return [bool](Get-Module -ListAvailable -Name $moduleName) -} - -function vcpkgHasProperty([Parameter(Mandatory=$true)][AllowNull()]$object, [Parameter(Mandatory=$true)]$propertyName) -{ - if ($object -eq $null) - { - return $false - } - - return [bool]($object.psobject.Properties | where { $_.Name -eq "$propertyName"}) -} - -function vcpkgCreateDirectoryIfNotExists([Parameter(Mandatory=$true)][string]$dirPath) -{ - if (!(Test-Path $dirPath)) - { - New-Item -ItemType Directory -Path $dirPath | Out-Null - } -} - -function vcpkgCreateParentDirectoryIfNotExists([Parameter(Mandatory=$true)][string]$path) -{ - $parentDir = split-path -parent $path - if ([string]::IsNullOrEmpty($parentDir)) - { - return - } - - if (!(Test-Path $parentDir)) - { - New-Item -ItemType Directory -Path $parentDir | Out-Null - } -} - -function vcpkgIsDirectory([Parameter(Mandatory=$true)][string]$path) -{ - return (Get-Item $path) -is [System.IO.DirectoryInfo] -} - -function vcpkgRemoveItem([Parameter(Mandatory=$true)][string]$path) -{ - if ([string]::IsNullOrEmpty($path)) - { - return - } - - if (Test-Path $path) - { - # Remove-Item -Recurse occasionally fails. This is a workaround - if (vcpkgIsDirectory $path) - { - & cmd.exe /c rd /s /q $path - } - else - { - Remove-Item $path -Force - } - } -} - -function vcpkgHasCommand([Parameter(Mandatory=$true)][string]$commandName) -{ - return [bool](Get-Command -Name $commandName -ErrorAction SilentlyContinue) -} - -function vcpkgHasCommandParameter([Parameter(Mandatory=$true)][string]$commandName, [Parameter(Mandatory=$true)][string]$parameterName) -{ - return (Get-Command $commandName).Parameters.Keys -contains $parameterName -} - -function vcpkgGetCredentials() -{ - if (vcpkgHasCommandParameter -commandName 'Get-Credential' -parameterName 'Message') - { - return Get-Credential -Message "Enter credentials for Proxy Authentication" - } - else - { - Write-Host "Enter credentials for Proxy Authentication" - return Get-Credential - } -} - -function vcpkgGetSHA512([Parameter(Mandatory=$true)][string]$filePath) -{ - if (vcpkgHasCommand -commandName 'Microsoft.PowerShell.Utility\Get-FileHash') - { - Write-Verbose("Hashing with Microsoft.PowerShell.Utility\Get-FileHash") - $hash = (Microsoft.PowerShell.Utility\Get-FileHash -Path $filePath -Algorithm SHA512).Hash - } - elseif(vcpkgHasCommand -commandName 'Pscx\Get-Hash') - { - Write-Verbose("Hashing with Pscx\Get-Hash") - $hash = (Pscx\Get-Hash -Path $filePath -Algorithm SHA512).HashString - } - else - { - Write-Verbose("Hashing with .NET") - $hashAlgorithm = [Security.Cryptography.HashAlgorithm]::Create("SHA512") - $fileAsByteArray = [io.File]::ReadAllBytes($filePath) - $hashByteArray = $hashAlgorithm.ComputeHash($fileAsByteArray) - $hash = -Join ($hashByteArray | ForEach-Object {"{0:x2}" -f $_}) - } - - return $hash.ToLower() -} - -function vcpkgCheckEqualFileHash( [Parameter(Mandatory=$true)][string]$url, - [Parameter(Mandatory=$true)][string]$filePath, - [Parameter(Mandatory=$true)][string]$expectedHash) -{ - $actualHash = vcpkgGetSHA512 $filePath - if ($expectedHash -ne $actualHash) - { - Write-Host ("`nFile does not have expected hash:`n" + - " url: [ $url ]`n" + - " File path: [ $filePath ]`n" + - " Expected hash: [ $expectedHash ]`n" + - " Actual hash: [ $actualHash ]`n") - throw - } -} - -function vcpkgDownloadFile( [Parameter(Mandatory=$true)][string]$url, - [Parameter(Mandatory=$true)][string]$downloadPath, - [Parameter(Mandatory=$true)][string]$sha512) -{ - if ($url -match "github") - { - if ([System.Enum]::IsDefined([Net.SecurityProtocolType], "Tls12")) - { - [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 - } - else - { - Write-Warning "Github has dropped support for TLS versions prior to 1.2, which is not available on your system" - Write-Warning "Please manually download $url to $downloadPath" - Write-Warning "To solve this issue for future downloads, you can also install Windows Management Framework 5.1+" - throw "Download failed" - } - } - - vcpkgCreateParentDirectoryIfNotExists $downloadPath - - $downloadPartPath = "$downloadPath.part" - vcpkgRemoveItem $downloadPartPath - - $wc = New-Object System.Net.WebClient - if (!$wc.Proxy.IsBypassed($url)) - { - $wc.Proxy.Credentials = vcpkgGetCredentials - } - - $wc.DownloadFile($url, $downloadPartPath) - vcpkgCheckEqualFileHash -url $url -filePath $downloadPartPath -expectedHash $sha512 - Move-Item -Path $downloadPartPath -Destination $downloadPath -} - -function vcpkgDownloadFileWithAria2( [Parameter(Mandatory=$true)][string]$aria2exe, - [Parameter(Mandatory=$true)][string]$url, - [Parameter(Mandatory=$true)][string]$downloadPath, - [Parameter(Mandatory=$true)][string]$sha512) -{ - vcpkgCreateParentDirectoryIfNotExists $downloadPath - $downloadPartPath = "$downloadPath.part" - vcpkgRemoveItem $downloadPartPath - - $parentDir = split-path -parent $downloadPath - $filename = split-path -leaf $downloadPath - - if ((Test-Path $url) -or ($url.StartsWith("file://"))) # if is local file - { - vcpkgDownloadFile $url $downloadPath $sha512 - return - } - - $ec = vcpkgInvokeCommand "$aria2exe" "--dir `"$parentDir`" --out `"$filename.part`" $url" - if ($ec -ne 0) - { - Write-Host "Could not download $url" - throw - } - - vcpkgCheckEqualFileHash -url $url -filePath $downloadPartPath -expectedHash $sha512 - Move-Item -Path $downloadPartPath -Destination $downloadPath -} - -function vcpkgExtractFileWith7z([Parameter(Mandatory=$true)][string]$sevenZipExe, - [Parameter(Mandatory=$true)][string]$archivePath, - [Parameter(Mandatory=$true)][string]$destinationDir) -{ - vcpkgRemoveItem $destinationDir - $destinationPartial = "$destinationDir.partial" - vcpkgRemoveItem $destinationPartial - vcpkgCreateDirectoryIfNotExists $destinationPartial - $ec = vcpkgInvokeCommand "$sevenZipExe" "x `"$archivePath`" -o`"$destinationPartial`" -y" - if ($ec -ne 0) - { - Write-Host "Could not extract $archivePath" - throw - } - Rename-Item -Path "$destinationPartial" -NewName $destinationDir -} - -function vcpkgExtractZipFile( [Parameter(Mandatory=$true)][string]$archivePath, - [Parameter(Mandatory=$true)][string]$destinationDir) -{ - vcpkgRemoveItem $destinationDir - $destinationPartial = "$destinationDir.partial" - vcpkgRemoveItem $destinationPartial - vcpkgCreateDirectoryIfNotExists $destinationPartial - - - if (vcpkgHasCommand -commandName 'Microsoft.PowerShell.Archive\Expand-Archive') - { - Write-Verbose("Extracting with Microsoft.PowerShell.Archive\Expand-Archive") - 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 $archivePath -OutputPath $destinationPartial - } - else - { - Write-Verbose("Extracting via shell") - $shell = new-object -com shell.application - $zip = $shell.NameSpace($(Get-Item $archivePath).fullname) - foreach($item in $zip.items()) - { - # Piping to Out-Null is used to block until finished - $shell.Namespace($destinationPartial).copyhere($item) | Out-Null - } - } - - Rename-Item -Path "$destinationPartial" -NewName $destinationDir -} - -function vcpkgInvokeCommand() -{ - param ( [Parameter(Mandatory=$true)][string]$executable, - [string]$arguments = "") - - Write-Verbose "Executing: ${executable} ${arguments}" - $process = Start-Process -FilePath "`"$executable`"" -ArgumentList $arguments -PassThru -NoNewWindow - Wait-Process -InputObject $process - $ec = $process.ExitCode - Write-Verbose "Execution terminated with exit code $ec." - return $ec -} - -function vcpkgInvokeCommandClean() -{ - param ( [Parameter(Mandatory=$true)][string]$executable, - [string]$arguments = "") - - Write-Verbose "Clean-Executing: ${executable} ${arguments}" - $scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition - $cleanEnvScript = "$scriptsDir\VcpkgPowershellUtils-ClearEnvironment.ps1" - $tripleQuotes = "`"`"`"" - $argumentsWithEscapedQuotes = $arguments -replace "`"", $tripleQuotes - $command = ". $tripleQuotes$cleanEnvScript$tripleQuotes; & $tripleQuotes$executable$tripleQuotes $argumentsWithEscapedQuotes" - $arg = "-NoProfile", "-ExecutionPolicy Bypass", "-command $command" - - $process = Start-Process -FilePath powershell.exe -ArgumentList $arg -PassThru -NoNewWindow - Wait-Process -InputObject $process - $ec = $process.ExitCode - Write-Verbose "Execution terminated with exit code $ec." - return $ec -} - -function vcpkgFormatElapsedTime([TimeSpan]$ts) -{ - if ($ts.TotalHours -ge 1) - { - return [string]::Format( "{0:N2} h", $ts.TotalHours); - } - - if ($ts.TotalMinutes -ge 1) - { - return [string]::Format( "{0:N2} min", $ts.TotalMinutes); - } - - if ($ts.TotalSeconds -ge 1) - { - return [string]::Format( "{0:N2} s", $ts.TotalSeconds); - } - - if ($ts.TotalMilliseconds -ge 1) - { - return [string]::Format( "{0:N2} ms", $ts.TotalMilliseconds); - } - - throw $ts -} - -function vcpkgFindFileRecursivelyUp() -{ - param( - [ValidateNotNullOrEmpty()] - [Parameter(Mandatory=$true)][string]$startingDir, - [ValidateNotNullOrEmpty()] - [Parameter(Mandatory=$true)][string]$filename - ) - - $currentDir = $startingDir - - while (!($currentDir -eq "") -and !(Test-Path "$currentDir\$filename")) - { - Write-Verbose "Examining $currentDir for $filename" - $currentDir = Split-path $currentDir -Parent - } - Write-Verbose "Examining $currentDir for $filename - Found" - return $currentDir -} diff --git a/scripts/addPoshVcpkgToPowershellProfile.ps1 b/scripts/addPoshVcpkgToPowershellProfile.ps1 index dcbd2e0be..1dd27aacf 100644 --- a/scripts/addPoshVcpkgToPowershellProfile.ps1 +++ b/scripts/addPoshVcpkgToPowershellProfile.ps1 @@ -14,14 +14,13 @@ function findExistingImportModuleDirectives([Parameter(Mandatory=$true)][string] } $scriptsDir = split-path -parent $script: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 +if (!(Test-Path $profileDir)) { - $profileDir = Split-Path $profilePath -Parent - vcpkgCreateDirectoryIfNotExists $profileDir + New-Item -ItemType Directory -Path $profileDir | Out-Null } Write-Host "`nAdding the following line to ${profilePath}:" @@ -38,6 +37,7 @@ if ($existingImports.Count -gt 0) return } +# Modifying the profile will invalidate any signatures. # 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 diff --git a/scripts/bootstrap.ps1 b/scripts/bootstrap.ps1 index c8ba503d8..149134dff 100644 --- a/scripts/bootstrap.ps1 +++ b/scripts/bootstrap.ps1 @@ -5,34 +5,41 @@ param( ) Set-StrictMode -Version Latest $scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition -. "$scriptsDir\VcpkgPowershellUtils.ps1" -$vcpkgRootDir = vcpkgFindFileRecursivelyUp $scriptsDir .vcpkg-root -Write-Verbose("vcpkg Path " + $vcpkgRootDir) +$withVSPath = $withVSPath -replace "\\$" # Remove potential trailing backslash -$gitHash = "unknownhash" -$oldpath = $env:path -try +function vcpkgHasProperty([Parameter(Mandatory=$true)][AllowNull()]$object, [Parameter(Mandatory=$true)]$propertyName) { - [xml]$asXml = Get-Content "$scriptsDir\vcpkgTools.xml" - $toolData = $asXml.SelectSingleNode("//tools/tool[@name=`"git`"]") - $gitFromDownload = "$vcpkgRootDir\downloads\$($toolData.exeRelativePath)" - $gitDir = split-path -parent $gitFromDownload + if ($object -eq $null) + { + return $false + } + + return [bool]($object.psobject.Properties | Where-Object { $_.Name -eq "$propertyName"}) +} - $env:path += ";$gitDir" - if (Get-Command "git" -ErrorAction SilentlyContinue) +function getProgramFiles32bit() +{ + $out = ${env:PROGRAMFILES(X86)} + if ($out -eq $null) { - $gitHash = git log HEAD -n 1 --format="%cd-%H" --date=short - if ($LASTEXITCODE -ne 0) - { - $gitHash = "unknownhash" - } + $out = ${env:PROGRAMFILES} } + + if ($out -eq $null) + { + throw "Could not find [Program Files 32-bit]" + } + + return $out } -finally + +$vcpkgRootDir = $scriptsDir +while (!($vcpkgRootDir -eq "") -and !(Test-Path "$vcpkgRootDir\.vcpkg-root")) { - $env:path = $oldpath + Write-Verbose "Examining $vcpkgRootDir for .vcpkg-root" + $vcpkgRootDir = Split-path $vcpkgRootDir -Parent } -Write-Verbose("Git repo version string is " + $gitHash) +Write-Verbose "Examining $vcpkgRootDir for .vcpkg-root - Found" $vcpkgSourcesPath = "$vcpkgRootDir\toolsrc" @@ -42,22 +49,282 @@ if (!(Test-Path $vcpkgSourcesPath)) return } -$msbuildExeWithPlatformToolset = & $scriptsDir\findAnyMSBuildWithCppPlatformToolset.ps1 $withVSPath +function getVisualStudioInstances() +{ + $programFiles = getProgramFiles32bit + $results = New-Object System.Collections.ArrayList + $vswhereExe = "$programFiles\Microsoft Visual Studio\Installer\vswhere.exe" + if (Test-Path $vswhereExe) + { + $output = & $vswhereExe -prerelease -legacy -products * -format xml + [xml]$asXml = $output + + foreach ($instance in $asXml.instances.instance) + { + $installationPath = $instance.InstallationPath -replace "\\$" # Remove potential trailing backslash + $installationVersion = $instance.InstallationVersion + + $isPrerelease = -7 + if (vcpkgHasProperty -object $instance -propertyName "isPrerelease") + { + $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 + } + } + else + { + Write-Verbose "Could not locate vswhere at $vswhereExe" + } + + if ("$env:vs140comntools" -ne "") + { + $installationPath = Split-Path -Parent $(Split-Path -Parent "$env:vs140comntools") + $clExe = "$installationPath\VC\bin\cl.exe" + $vcvarsallbat = "$installationPath\VC\vcvarsall.bat" + + if ((Test-Path $clExe) -And (Test-Path $vcvarsallbat)) + { + $results.Add("PreferenceWeight1::Legacy::14.0::$installationPath") > $null + } + } + + $installationPath = "$programFiles\Microsoft Visual Studio 14.0" + $clExe = "$installationPath\VC\bin\cl.exe" + $vcvarsallbat = "$installationPath\VC\vcvarsall.bat" + + if ((Test-Path $clExe) -And (Test-Path $vcvarsallbat)) + { + $results.Add("PreferenceWeight1::Legacy::14.0::$installationPath") > $null + } + + $results.Sort() + $results.Reverse() + + return $results +} + +function findAnyMSBuildWithCppPlatformToolset([string]$withVSPath) +{ + $VisualStudioInstances = getVisualStudioInstances + if ($VisualStudioInstances -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, $VisualStudioInstances))" + foreach ($instanceCandidate in $VisualStudioInstances) + { + Write-Verbose "Inspecting: $instanceCandidate" + $split = $instanceCandidate -split "::" + # $preferenceWeight = $split[0] + # $releaseType = $split[1] + $version = $split[2] + $path = $split[3] + + if ($withVSPath -ne "" -and $withVSPath -ne $path) + { + Write-Verbose "Skipping: $instanceCandidate" + continue + } + + $majorVersion = $version.Substring(0,2); + if ($majorVersion -eq "15") + { + $VCFolder= "$path\VC\Tools\MSVC\" + if (Test-Path $VCFolder) + { + Write-Verbose "Picking: $instanceCandidate" + return "$path\MSBuild\15.0\Bin\MSBuild.exe", "v141" + } + } + + if ($majorVersion -eq "14") + { + $clExe= "$path\VC\bin\cl.exe" + if (Test-Path $clExe) + { + Write-Verbose "Picking: $instanceCandidate" + $programFilesPath = getProgramFiles32bit + 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." +} +function getWindowsSDK( [Parameter(Mandatory=$False)][switch]$DisableWin10SDK = $False, + [Parameter(Mandatory=$False)][switch]$DisableWin81SDK = $False) +{ + if ($DisableWin10SDK -and $DisableWin81SDK) + { + throw "Both Win10SDK and Win81SDK were disabled." + } + + Write-Verbose "Finding WinSDK" + + $validInstances = New-Object System.Collections.ArrayList + + # Windows 10 SDK + function CheckWindows10SDK($path) + { + if ($path -eq $null) + { + return + } + + $folder = (Join-Path $path "Include") + if (!(Test-Path $folder)) + { + Write-Verbose "$folder - Not Found" + return + } + + Write-Verbose "$folder - Found" + $win10sdkVersions = @(Get-ChildItem $folder | Where-Object {$_.Name -match "^10"} | Sort-Object) + [array]::Reverse($win10sdkVersions) # Newest SDK first + + foreach ($win10sdkV in $win10sdkVersions) + { + $windowsheader = "$folder\$win10sdkV\um\windows.h" + if (!(Test-Path $windowsheader)) + { + Write-Verbose "$windowsheader - Not Found" + continue + } + Write-Verbose "$windowsheader - Found" + + $ddkheader = "$folder\$win10sdkV\shared\sdkddkver.h" + if (!(Test-Path $ddkheader)) + { + Write-Verbose "$ddkheader - Not Found" + continue + } + + Write-Verbose "$ddkheader - Found" + $win10sdkVersionString = $win10sdkV.ToString() + Write-Verbose "Found $win10sdkVersionString" + $validInstances.Add($win10sdkVersionString) > $null + } + } + + Write-Verbose "`n" + Write-Verbose "Looking for Windows 10 SDK" + $regkey10 = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots\' -Name 'KitsRoot10' -ErrorAction SilentlyContinue + $regkey10Wow6432 = Get-ItemProperty -Path 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows Kits\Installed Roots\' -Name 'KitsRoot10' -ErrorAction SilentlyContinue + if (vcpkgHasProperty -object $regkey10 "KitsRoot10") { CheckWindows10SDK($regkey10.KitsRoot10) } + if (vcpkgHasProperty -object $regkey10Wow6432 "KitsRoot10") { CheckWindows10SDK($regkey10Wow6432.KitsRoot10) } + CheckWindows10SDK("$env:ProgramFiles\Windows Kits\10") + CheckWindows10SDK("${env:ProgramFiles(x86)}\Windows Kits\10") + + # Windows 8.1 SDK + function CheckWindows81SDK($path) + { + if ($path -eq $null) + { + return + } + + $folder = "$path\Include" + if (!(Test-Path $folder)) + { + Write-Verbose "$folder - Not Found" + return + } + + Write-Verbose "$folder - Found" + $win81sdkVersionString = "8.1" + Write-Verbose "Found $win81sdkVersionString" + $validInstances.Add($win81sdkVersionString) > $null + } + + Write-Verbose "`n" + Write-Verbose "Looking for Windows 8.1 SDK" + $regkey81 = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots\' -Name 'KitsRoot81' -ErrorAction SilentlyContinue + $regkey81Wow6432 = Get-ItemProperty -Path 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows Kits\Installed Roots\' -Name 'KitsRoot81' -ErrorAction SilentlyContinue + if (vcpkgHasProperty -object $regkey81 "KitsRoot81") { CheckWindows81SDK($regkey81.KitsRoot81) } + if (vcpkgHasProperty -object $regkey81Wow6432 "KitsRoot81") { CheckWindows81SDK($regkey81Wow6432.KitsRoot81) } + CheckWindows81SDK("$env:ProgramFiles\Windows Kits\8.1") + CheckWindows81SDK("${env:ProgramFiles(x86)}\Windows Kits\8.1") + + Write-Verbose "`n`n`n" + Write-Verbose "The following Windows SDKs were found:" + foreach ($instance in $validInstances) + { + Write-Verbose $instance + } + + # Selecting + foreach ($instance in $validInstances) + { + if (!$DisableWin10SDK -and $instance -match "10.") + { + return $instance + } + + if (!$DisableWin81SDK -and $instance -match "8.1") + { + return $instance + } + } + + throw "Could not detect a Windows SDK / TargetPlatformVersion" +} + +$msbuildExeWithPlatformToolset = findAnyMSBuildWithCppPlatformToolset $withVSPath $msbuildExe = $msbuildExeWithPlatformToolset[0] $platformToolset = $msbuildExeWithPlatformToolset[1] -$windowsSDK = & $scriptsDir\getWindowsSDK.ps1 +$windowsSDK = getWindowsSDK $arguments = ( -"`"/p:VCPKG_VERSION=-$gitHash`"", +"`"/p:VCPKG_VERSION=-nohash`"", "`"/p:DISABLE_METRICS=$disableMetrics`"", "/p:Configuration=Release", "/p:Platform=x86", "/p:PlatformToolset=$platformToolset", "/p:TargetPlatformVersion=$windowsSDK", +"/verbosity:minimal", "/m", +"/nologo", "`"$vcpkgSourcesPath\dirs.proj`"") -join " " +function vcpkgInvokeCommandClean() +{ + param ( [Parameter(Mandatory=$true)][string]$executable, + [string]$arguments = "") + + Write-Verbose "Clean-Executing: ${executable} ${arguments}" + $scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition + $cleanEnvScript = "$scriptsDir\cleanEnvironmentHelper.ps1" + $tripleQuotes = "`"`"`"" + $argumentsWithEscapedQuotes = $arguments -replace "`"", $tripleQuotes + $command = ". $tripleQuotes$cleanEnvScript$tripleQuotes; & $tripleQuotes$executable$tripleQuotes $argumentsWithEscapedQuotes" + $arg = "-NoProfile", "-ExecutionPolicy Bypass", "-command $command" + + $process = Start-Process -FilePath powershell.exe -ArgumentList $arg -PassThru -NoNewWindow + Wait-Process -InputObject $process + $ec = $process.ExitCode + Write-Verbose "Execution terminated with exit code $ec." + return $ec +} + # vcpkgInvokeCommandClean cmd "/c echo %PATH%" +Write-Host "`nBuilding vcpkg.exe ...`n" $ec = vcpkgInvokeCommandClean $msbuildExe $arguments if ($ec -ne 0) @@ -65,6 +332,7 @@ if ($ec -ne 0) 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 } +Write-Host "`nBuilding vcpkg.exe... done.`n" Write-Verbose("Placing vcpkg.exe in the correct location") diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 66efb1d62..e999fa55e 100644 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -30,7 +30,14 @@ vcpkgCheckEqualFileHash() { url=$1; filePath=$2; expectedHash=$3 - actualHash=$(shasum -a 512 "$filePath") # sha512sum not available on osx + if command -v "sha512sum" >/dev/null 2>&1 ; then + actualHash=$(sha512sum "$filePath") + else + # sha512sum is not available by default on osx + # shasum is not available by default on Fedora + actualHash=$(shasum -a 512 "$filePath") + fi + actualHash="${actualHash%% *}" # shasum returns [hash filename], so get the first word if ! [ "$expectedHash" = "$actualHash" ]; then @@ -90,7 +97,7 @@ fetchTool() return 1 fi - xmlFileAsString=`cat $vcpkgRootDir/scripts/vcpkgTools.xml` + xmlFileAsString=`cat "$vcpkgRootDir/scripts/vcpkgTools.xml"` toolRegexStart="<tool name=\"$tool\" os=\"$os\">" toolData="$(extractStringBetweenDelimiters "$xmlFileAsString" "$toolRegexStart" "</tool>")" if [ "$toolData" = "" ]; then @@ -150,7 +157,9 @@ selectCXX() if [ "x$CXX" = "x" ]; then CXX=g++ - if which g++-7 >/dev/null 2>&1; then + if which g++-8 >/dev/null 2>&1; then + CXX=g++-8 + elif which g++-7 >/dev/null 2>&1; then CXX=g++-7 elif which g++-6 >/dev/null 2>&1; then CXX=g++-6 @@ -159,7 +168,7 @@ selectCXX() gccversion="$("$CXX" -v 2>&1)" gccversion="$(extractStringBetweenDelimiters "$gccversion" "gcc version " ".")" - if [ "$gccversion" = "5" ]; then + if [ "$gccversion" -lt "6" ]; then echo "CXX ($CXX) is too old; please install a newer compiler such as g++-7." echo "sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y" echo "sudo apt-get update -y" @@ -185,4 +194,4 @@ mkdir -p "$buildDir" (cd "$buildDir" && "$cmakeExe" --build .) rm -rf "$vcpkgRootDir/vcpkg" -cp "$buildDir/vcpkg" "$vcpkgRootDir/"
\ No newline at end of file +cp "$buildDir/vcpkg" "$vcpkgRootDir/" diff --git a/scripts/VcpkgPowershellUtils-ClearEnvironment.ps1 b/scripts/cleanEnvironmentHelper.ps1 index 0a133f5f8..0a133f5f8 100644 --- a/scripts/VcpkgPowershellUtils-ClearEnvironment.ps1 +++ b/scripts/cleanEnvironmentHelper.ps1 diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake index 30ecb0573..39a722d93 100644 --- a/scripts/cmake/vcpkg_find_acquire_program.cmake +++ b/scripts/cmake/vcpkg_find_acquire_program.cmake @@ -115,6 +115,8 @@ function(vcpkg_find_acquire_program VAR) set(SUBDIR "ninja-1.8.2") if(CMAKE_HOST_WIN32) set(PATHS "${DOWNLOADS}/tools/ninja/${SUBDIR}") + elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") + set(PATHS "${DOWNLOADS}/tools/${SUBDIR}-osx") else() set(PATHS "${DOWNLOADS}/tools/${SUBDIR}-linux") endif() diff --git a/scripts/cmake/vcpkg_from_github.cmake b/scripts/cmake/vcpkg_from_github.cmake index c6a23cff6..28ada0631 100644 --- a/scripts/cmake/vcpkg_from_github.cmake +++ b/scripts/cmake/vcpkg_from_github.cmake @@ -51,7 +51,7 @@ ## * [beast](https://github.com/Microsoft/vcpkg/blob/master/ports/beast/portfile.cmake) function(vcpkg_from_github) set(oneValueArgs OUT_SOURCE_PATH REPO REF SHA512 HEAD_REF) - set(multipleValuesArgs) + set(multipleValuesArgs PATCHES) cmake_parse_arguments(_vdud "" "${oneValueArgs}" "${multipleValuesArgs}" ${ARGN}) if(NOT DEFINED _vdud_OUT_SOURCE_PATH) @@ -73,21 +73,17 @@ function(vcpkg_from_github) string(REGEX REPLACE ".*/" "" REPO_NAME ${_vdud_REPO}) string(REGEX REPLACE "/.*" "" ORG_NAME ${_vdud_REPO}) - macro(set_SOURCE_PATH BASE BASEREF) - set(SOURCE_PATH "${BASE}/${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}) - string(REPLACE "/" "-" REF ${REF}) - set(SOURCE_PATH "${BASE}/${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}/${REPO_NAME}-${BASEREF}' does not exist") - endif() + macro(set_TEMP_SOURCE_PATH BASE BASEREF) + set(TEMP_SOURCE_PATH "${BASE}/${REPO_NAME}-${BASEREF}") + if(NOT EXISTS ${TEMP_SOURCE_PATH}) + # Sometimes GitHub strips a leading 'v' off the REF. + string(REGEX REPLACE "^v" "" REF ${BASEREF}) + string(REPLACE "/" "-" REF ${REF}) + set(TEMP_SOURCE_PATH "${BASE}/${REPO_NAME}-${REF}") + if(NOT EXISTS ${TEMP_SOURCE_PATH}) + message(FATAL_ERROR "Could not determine source path: '${BASE}/${REPO_NAME}-${BASEREF}' does not exist") endif() + endif() endmacro() if(VCPKG_USE_HEAD_VERSION AND NOT DEFINED _vdud_HEAD_REF) @@ -108,8 +104,44 @@ function(vcpkg_from_github) SHA512 "${_vdud_SHA512}" FILENAME "${ORG_NAME}-${REPO_NAME}-${SANITIZED_REF}.tar.gz" ) - vcpkg_extract_source_archive_ex(ARCHIVE "${ARCHIVE}") - set_SOURCE_PATH(${CURRENT_BUILDTREES_DIR}/src ${SANITIZED_REF}) + + # Take the last 10 chars of the REF + set(REF_MAX_LENGTH 10) + string(LENGTH ${SANITIZED_REF} REF_LENGTH) + math(EXPR FROM_REF ${REF_LENGTH}-${REF_MAX_LENGTH}) + if(FROM_REF LESS 0) + set(FROM_REF 0) + endif() + string(SUBSTRING ${SANITIZED_REF} ${FROM_REF} ${REF_LENGTH} SHORTENED_SANITIZED_REF) + + # Hash the archive hash along with the patches. Take the first 10 chars of the hash + set(PATCHSET_HASH "${_vdud_SHA512}") + foreach(PATCH IN LISTS _vdud_PATCHES) + file(SHA512 ${PATCH} CURRENT_HASH) + string(APPEND PATCHSET_HASH ${CURRENT_HASH}) + endforeach() + + string(SHA512 PATCHSET_HASH ${PATCHSET_HASH}) + string(SUBSTRING ${PATCHSET_HASH} 0 10 PATCHSET_HASH) + set(SOURCE_PATH "${CURRENT_BUILDTREES_DIR}/src/${SHORTENED_SANITIZED_REF}-${PATCHSET_HASH}") + + if(NOT EXISTS ${SOURCE_PATH}) + set(TEMP_DIR "${CURRENT_BUILDTREES_DIR}/src/TEMP") + file(REMOVE_RECURSE ${TEMP_DIR}) + vcpkg_extract_source_archive_ex(ARCHIVE "${ARCHIVE}" WORKING_DIRECTORY ${TEMP_DIR}) + set_TEMP_SOURCE_PATH(${CURRENT_BUILDTREES_DIR}/src/TEMP ${SANITIZED_REF}) + + vcpkg_apply_patches( + SOURCE_PATH ${TEMP_SOURCE_PATH} + PATCHES ${_vdud_PATCHES} + ) + + file(RENAME ${TEMP_SOURCE_PATH} ${SOURCE_PATH}) + file(REMOVE_RECURSE ${TEMP_DIR}) + endif() + + set(${_vdud_OUT_SOURCE_PATH} "${SOURCE_PATH}" PARENT_SCOPE) + return() endif() @@ -167,5 +199,10 @@ function(vcpkg_from_github) set(VCPKG_HEAD_VERSION ${_version} PARENT_SCOPE) endif() - set_SOURCE_PATH(${CURRENT_BUILDTREES_DIR}/src/head ${SANITIZED_HEAD_REF}) + set_TEMP_SOURCE_PATH(${CURRENT_BUILDTREES_DIR}/src/head ${SANITIZED_HEAD_REF}) + vcpkg_apply_patches( + SOURCE_PATH ${TEMP_SOURCE_PATH} + PATCHES ${_vdud_PATCHES} + ) + set(${_vdud_OUT_SOURCE_PATH} "${TEMP_SOURCE_PATH}" PARENT_SCOPE) endfunction() diff --git a/scripts/cmake/vcpkg_get_windows_sdk.cmake b/scripts/cmake/vcpkg_get_windows_sdk.cmake index a8aad64a9..e7d72a125 100644 --- a/scripts/cmake/vcpkg_get_windows_sdk.cmake +++ b/scripts/cmake/vcpkg_get_windows_sdk.cmake @@ -1,16 +1,6 @@ # Returns Windows SDK number via out variable "ret" function(vcpkg_get_windows_sdk ret) - execute_process( - COMMAND powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& {& '${VCPKG_ROOT_DIR}/scripts/getWindowsSDK.ps1'}" 2>&1 - INPUT_FILE NUL - OUTPUT_VARIABLE WINDOWS_SDK - RESULT_VARIABLE error_code) - - if (error_code) - message(FATAL_ERROR "Could not find Windows SDK") - endif() - - # Remove trailing newline and non-numeric characters - string(REGEX REPLACE "[^0-9.]" "" WINDOWS_SDK "${WINDOWS_SDK}") + set(WINDOWS_SDK $ENV{WindowsSDKVersion}) + string(REPLACE "\\" "" WINDOWS_SDK "${WINDOWS_SDK}") set(${ret} ${WINDOWS_SDK} PARENT_SCOPE) endfunction()
\ No newline at end of file diff --git a/scripts/fetchTool.ps1 b/scripts/fetchTool.ps1 deleted file mode 100644 index dd3f0f9f4..000000000 --- a/scripts/fetchTool.ps1 +++ /dev/null @@ -1,107 +0,0 @@ -[CmdletBinding()] -param( - [Parameter(Mandatory=$true)][string]$tool -) - -Set-StrictMode -Version Latest -$scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition -. "$scriptsDir\VcpkgPowershellUtils.ps1" - -Write-Verbose "Fetching tool: $tool" -$vcpkgRootDir = vcpkgFindFileRecursivelyUp $scriptsDir .vcpkg-root - -$downloadsDir = "$vcpkgRootDir\downloads" -vcpkgCreateDirectoryIfNotExists $downloadsDir - -function fetchToolInternal([Parameter(Mandatory=$true)][string]$tool) -{ - $tool = $tool.toLower() - - [xml]$asXml = Get-Content "$scriptsDir\vcpkgTools.xml" - $toolData = $asXml.SelectSingleNode("//tools/tool[@name=`"$tool`"]") # Case-sensitive! - - if ($toolData -eq $null) - { - throw "Unknown tool $tool" - } - - $toolPath="$downloadsDir\tools\$tool-$($toolData.version)-windows" - $exePath = "$toolPath\$($toolData.exeRelativePath)" - - if (Test-Path $exePath) - { - return $exePath - } - - $isArchive = vcpkgHasProperty -object $toolData -propertyName "archiveName" - if ($isArchive) - { - $downloadPath = "$downloadsDir\$($toolData.archiveName)" - } - else - { - $downloadPath = "$toolPath\$($toolData.exeRelativePath)" - } - - [String]$url = $toolData.url - if (!(Test-Path $downloadPath)) - { - Write-Host "Downloading $tool..." - - # Download aria2 with .NET. aria2 will be used to download everything else. - if ($tool -eq "aria2") - { - vcpkgDownloadFile $url $downloadPath $toolData.sha512 - } - else - { - $aria2exe = fetchToolInternal "aria2" - vcpkgDownloadFileWithAria2 $aria2exe $url $downloadPath $toolData.sha512 - } - - Write-Host "Downloading $tool... done." - } - else - { - vcpkgCheckEqualFileHash -url $url -filePath $downloadPath -expectedHash $toolData.sha512 - } - - if ($isArchive) - { - Write-Host "Extracting $tool..." - # Extract 7zip920 with shell because we need it to extract 7zip - # Extract aria2 with shell because we need it to download 7zip - if ($tool -eq "7zip920" -or $tool -eq "aria2") - { - vcpkgExtractZipFile -ArchivePath $downloadPath -DestinationDir $toolPath - } - elseif ($tool -eq "7zip") - { - $sevenZip920 = fetchToolInternal "7zip920" - $ec = vcpkgInvokeCommand "$sevenZip920" "x `"$downloadPath`" -o`"$toolPath`" -y" - if ($ec -ne 0) - { - Write-Host "Could not extract $downloadPath" - throw - } - } - else - { - $sevenZipExe = fetchToolInternal "7zip" - vcpkgExtractFileWith7z -sevenZipExe "$sevenZipExe" -ArchivePath $downloadPath -DestinationDir $toolPath - } - Write-Host "Extracting $tool... done." - } - - if (-not (Test-Path $exePath)) - { - Write-Error "Could not detect or download $tool" - throw - } - - return $exePath -} - -$path = fetchToolInternal $tool -Write-Verbose "Fetching tool: $tool. Done." -return "<sol>::$path::<eol>" diff --git a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 deleted file mode 100644 index d7fd24e24..000000000 --- a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 +++ /dev/null @@ -1,58 +0,0 @@ -[CmdletBinding()] -param( - [Parameter(Mandatory=$False)] - [string]$withVSPath = "" -) - -Set-StrictMode -Version Latest -$scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition - -$withVSPath = $withVSPath -replace "\\$" # Remove potential trailing backslash - -$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) -{ - $instanceCandidate = $instanceCandidateWithEOL -replace "<sol>::" -replace "::<eol>" - Write-Verbose "Inspecting: $instanceCandidate" - $split = $instanceCandidate -split "::" - # $preferenceWeight = $split[0] - # $releaseType = $split[1] - $version = $split[2] - $path = $split[3] - - if ($withVSPath -ne "" -and $withVSPath -ne $path) - { - Write-Verbose "Skipping: $instanceCandidate" - continue - } - - $majorVersion = $version.Substring(0,2); - if ($majorVersion -eq "15") - { - $VCFolder= "$path\VC\Tools\MSVC\" - if (Test-Path $VCFolder) - { - Write-Verbose "Picking: $instanceCandidate" - return "$path\MSBuild\15.0\Bin\MSBuild.exe", "v141" - } - } - - if ($majorVersion -eq "14") - { - $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 deleted file mode 100644 index cb51c345d..000000000 --- a/scripts/findVisualStudioInstallationInstances.ps1 +++ /dev/null @@ -1,61 +0,0 @@ -[CmdletBinding()] -param( - -) -Set-StrictMode -Version Latest -$scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition -. "$scriptsDir\VcpkgPowershellUtils.ps1" - -$vswhereExe = (& $scriptsDir\fetchTool.ps1 "vswhere") -replace "<sol>::" -replace "::<eol>" - -$output = & $vswhereExe -prerelease -legacy -products * -format xml -[xml]$asXml = $output - -$results = New-Object System.Collections.ArrayList -foreach ($instance in $asXml.instances.instance) -{ - $installationPath = $instance.InstallationPath -replace "\\$" # Remove potential trailing backslash - $installationVersion = $instance.InstallationVersion - - $isPrerelease = -7 - if (vcpkgHasProperty -object $instance -propertyName "isPrerelease") - { - $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("<sol>::${releaseType}::${installationVersion}::${installationPath}::<eol>") > $null -} - -# If nothing is found, attempt to find VS2015 Build Tools (not detected by vswhere.exe) -if ($results.Count -eq 0) -{ - $programFiles = & $scriptsDir\getProgramFiles32bit.ps1 - $installationPath = "$programFiles\Microsoft Visual Studio 14.0" - $clExe = "$installationPath\VC\bin\cl.exe" - $vcvarsallbat = "$installationPath\VC\vcvarsall.bat" - - if ((Test-Path $clExe) -And (Test-Path $vcvarsallbat)) - { - return "<sol>::PreferenceWeight1::Legacy::14.0::$installationPath::<eol>" - } -} - - -$results.Sort() -$results.Reverse() - -return $results
\ No newline at end of file diff --git a/scripts/getProgramFiles32bit.ps1 b/scripts/getProgramFiles32bit.ps1 deleted file mode 100644 index 6b71915b1..000000000 --- a/scripts/getProgramFiles32bit.ps1 +++ /dev/null @@ -1,17 +0,0 @@ -[CmdletBinding()] -param( - -) - -$out = ${env:PROGRAMFILES(X86)} -if ($out -eq $null) -{ - $out = ${env:PROGRAMFILES} -} - -if ($out -eq $null) -{ - throw "Could not find [Program Files 32-bit]" -} - -return $out
\ No newline at end of file diff --git a/scripts/getProgramFilesPlatformBitness.ps1 b/scripts/getProgramFilesPlatformBitness.ps1 deleted file mode 100644 index 2be4c1137..000000000 --- a/scripts/getProgramFilesPlatformBitness.ps1 +++ /dev/null @@ -1,17 +0,0 @@ -[CmdletBinding()] -param( - -) - -$out = ${env:ProgramW6432} -if ($out -eq $null) -{ - $out = ${env:PROGRAMFILES} -} - -if ($out -eq $null) -{ - throw "Could not find [Program Files Platform Bitness]" -} - -return $out
\ No newline at end of file diff --git a/scripts/getWindowsSDK.ps1 b/scripts/getWindowsSDK.ps1 deleted file mode 100644 index d5e2f59a2..000000000 --- a/scripts/getWindowsSDK.ps1 +++ /dev/null @@ -1,126 +0,0 @@ -[CmdletBinding()] -param( - [Parameter(Mandatory=$False)] - [switch]$DisableWin10SDK = $False, - - [Parameter(Mandatory=$False)] - [switch]$DisableWin81SDK = $False -) - -Set-StrictMode -Version Latest -$scriptsDir = split-path -parent $script:MyInvocation.MyCommand.Definition -. "$scriptsDir\VcpkgPowershellUtils.ps1" - -if ($DisableWin10SDK -and $DisableWin81SDK) -{ - throw "Both Win10SDK and Win81SDK were disabled." -} - -Write-Verbose "Executing $($MyInvocation.MyCommand.Name)" - -$validInstances = New-Object System.Collections.ArrayList - -# Windows 10 SDK -function CheckWindows10SDK($path) -{ - if ($path -eq $null) - { - return - } - - $folder = (Join-Path $path "Include") - if (!(Test-Path $folder)) - { - Write-Verbose "$folder - Not Found" - return - } - - Write-Verbose "$folder - Found" - $win10sdkVersions = @(Get-ChildItem $folder | Where-Object {$_.Name -match "^10"} | Sort-Object) - [array]::Reverse($win10sdkVersions) # Newest SDK first - - foreach ($win10sdkV in $win10sdkVersions) - { - $windowsheader = "$folder\$win10sdkV\um\windows.h" - if (!(Test-Path $windowsheader)) - { - Write-Verbose "$windowsheader - Not Found" - continue - } - Write-Verbose "$windowsheader - Found" - - $ddkheader = "$folder\$win10sdkV\shared\sdkddkver.h" - if (!(Test-Path $ddkheader)) - { - Write-Verbose "$ddkheader - Not Found" - continue - } - - Write-Verbose "$ddkheader - Found" - $win10sdkVersionString = $win10sdkV.ToString() - Write-Verbose "Found $win10sdkVersionString" - $validInstances.Add($win10sdkVersionString) > $null - } -} - -Write-Verbose "`n" -Write-Verbose "Looking for Windows 10 SDK" -$regkey10 = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots\' -Name 'KitsRoot10' -ErrorAction SilentlyContinue -$regkey10Wow6432 = Get-ItemProperty -Path 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows Kits\Installed Roots\' -Name 'KitsRoot10' -ErrorAction SilentlyContinue -if (vcpkgHasProperty -object $regkey10 "KitsRoot10") { CheckWindows10SDK($regkey10.KitsRoot10) } -if (vcpkgHasProperty -object $regkey10Wow6432 "KitsRoot10") { CheckWindows10SDK($regkey10Wow6432.KitsRoot10) } -CheckWindows10SDK("$env:ProgramFiles\Windows Kits\10") -CheckWindows10SDK("${env:ProgramFiles(x86)}\Windows Kits\10") - -# Windows 8.1 SDK -function CheckWindows81SDK($path) -{ - if ($path -eq $null) - { - return - } - - $folder = "$path\Include" - if (!(Test-Path $folder)) - { - Write-Verbose "$folder - Not Found" - return - } - - Write-Verbose "$folder - Found" - $win81sdkVersionString = "8.1" - Write-Verbose "Found $win81sdkVersionString" - $validInstances.Add($win81sdkVersionString) > $null -} - -Write-Verbose "`n" -Write-Verbose "Looking for Windows 8.1 SDK" -$regkey81 = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots\' -Name 'KitsRoot81' -ErrorAction SilentlyContinue -$regkey81Wow6432 = Get-ItemProperty -Path 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows Kits\Installed Roots\' -Name 'KitsRoot81' -ErrorAction SilentlyContinue -if (vcpkgHasProperty -object $regkey81 "KitsRoot81") { CheckWindows81SDK($regkey81.KitsRoot81) } -if (vcpkgHasProperty -object $regkey81Wow6432 "KitsRoot81") { CheckWindows81SDK($regkey81Wow6432.KitsRoot81) } -CheckWindows81SDK("$env:ProgramFiles\Windows Kits\8.1") -CheckWindows81SDK("${env:ProgramFiles(x86)}\Windows Kits\8.1") - -Write-Verbose "`n`n`n" -Write-Verbose "The following Windows SDKs were found:" -foreach ($instance in $validInstances) -{ - Write-Verbose $instance -} - -# Selecting -foreach ($instance in $validInstances) -{ - if (!$DisableWin10SDK -and $instance -match "10.") - { - return $instance - } - - if (!$DisableWin81SDK -and $instance -match "8.1") - { - return $instance - } -} - -throw "Could not detect a Windows SDK / TargetPlatformVersion" diff --git a/scripts/internalCI.ps1 b/scripts/internalCI.ps1 deleted file mode 100644 index 9529c3766..000000000 --- a/scripts/internalCI.ps1 +++ /dev/null @@ -1,22 +0,0 @@ -$ErrorActionPreference = "Stop" - -rm TEST-internal-ci.xml -errorAction SilentlyContinue - -New-Item -type directory downloads -errorAction SilentlyContinue | Out-Null -./scripts/bootstrap.ps1 -if (-not $?) { throw $? } - -# Clear out any intermediate files from the previous build -if (Test-Path buildtrees) -{ - 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 ` -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" --recurse -if (-not $?) { throw $? } diff --git a/scripts/toolchains/linux.cmake b/scripts/toolchains/linux.cmake index ea4f15d60..1ad180b4b 100644 --- a/scripts/toolchains/linux.cmake +++ b/scripts/toolchains/linux.cmake @@ -2,3 +2,17 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") set(CMAKE_CROSSCOMPILING OFF CACHE BOOL "")
endif()
set(CMAKE_SYSTEM_NAME Linux CACHE STRING "")
+
+get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
+if(NOT _CMAKE_IN_TRY_COMPILE)
+ set(CMAKE_CXX_FLAGS " ${VCPKG_CXX_FLAGS}" CACHE STRING "")
+ set(CMAKE_C_FLAGS " ${VCPKG_C_FLAGS}" CACHE STRING "")
+
+ set(CMAKE_CXX_FLAGS_DEBUG "${VCPKG_CXX_FLAGS_DEBUG}" CACHE STRING "")
+ set(CMAKE_C_FLAGS_DEBUG "${VCPKG_C_FLAGS_DEBUG}" CACHE STRING "")
+ set(CMAKE_CXX_FLAGS_RELEASE "${VCPKG_CXX_FLAGS_RELEASE}" CACHE STRING "")
+ set(CMAKE_C_FLAGS_RELEASE "${VCPKG_C_FLAGS_RELEASE}" CACHE STRING "")
+
+ set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${VCPKG_LINKER_FLAGS}" CACHE STRING "")
+ set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${VCPKG_LINKER_FLAGS}" CACHE STRING "")
+endif()
diff --git a/scripts/vcpkgTools.xml b/scripts/vcpkgTools.xml index daaf29214..9d5487577 100644 --- a/scripts/vcpkgTools.xml +++ b/scripts/vcpkgTools.xml @@ -22,11 +22,23 @@ <archiveName>cmake-3.10.2-Linux-x86_64.tar.gz</archiveName> </tool> <tool name="git" os="windows"> - <version>2.16.2</version> + <version>2.17.0</version> <exeRelativePath>cmd\git.exe</exeRelativePath> - <url>https://github.com/git-for-windows/git/releases/download/v2.16.2.windows.1/MinGit-2.16.2-32-bit.zip</url> - <sha512>004e1dc1904f2e2d5c3534d0a56f58bf030b1146f5b263d6d191e60f72cd35455977c588604708125a1e93268ee8f7a5ab32ed6115adc028257b12d5926f350a</sha512> - <archiveName>MinGit-2.16.2-32-bit.zip</archiveName> + <url>https://github.com/git-for-windows/git/releases/download/v2.17.0.windows.1/MinGit-2.17.0-32-bit.zip</url> + <sha512>a34575ab1b4f553e62535e38492904b512df4d6a837cf4abf205dbcdd05edf1eef450cc5b15a4f63f901424d5f3cd1f78b6b22437d0d4f8cd9ce4e42e82617b9</sha512> + <archiveName>MinGit-2.17.0-32-bit.zip</archiveName> + </tool> + <tool name="git" os="linux"> + <version>2.7.4</version> + <exeRelativePath></exeRelativePath> + <url></url> + <sha512></sha512> + </tool> + <tool name="git" os="osx"> + <version>2.7.4</version> + <exeRelativePath></exeRelativePath> + <url></url> + <sha512></sha512> </tool> <tool name="vswhere" os="windows"> <version>2.4.1</version> @@ -49,17 +61,10 @@ </tool> <tool name="7zip" os="windows"> <version>18.01.0</version> - <exeRelativePath>7za.exe</exeRelativePath> - <url>https://www.7-zip.org/a/7z1801-extra.7z</url> - <sha512>9133fc551d76515e37fdd4dd8c1e28d464aea493548246b44565a42bba46715764f41f9cfa14d470d298c3a6e9829d200f8be5168cb67cf8f23d8042fca833bc</sha512> - <archiveName>7z1801-extra.7z</archiveName> - </tool> - <tool name="7zip920" os="windows"> - <version>9.20.0</version> - <exeRelativePath>7za.exe</exeRelativePath> - <url>https://www.7-zip.org/a/7za920.zip</url> - <sha512>84e830c91a0e8ae499cc4814080da6569d8a6acbddc585c8b62abc86c809793aeb669b0a741063a379fd281ade85f120bc27efeb67d63bf961be893eec8bc3b3</sha512> - <archiveName>7za920.zip</archiveName> + <exeRelativePath>7-Zip.CommandLine.18.1.0\tools\7za.exe</exeRelativePath> + <url>https://www.nuget.org/api/v2/package/7-Zip.CommandLine/18.1.0</url> + <sha512>8c75314102e68d2b2347d592f8e3eb05812e1ebb525decbac472231633753f1d4ca31c8e6881a36144a8da26b2571305b3ae3f4e2b85fc4a290aeda63d1a13b8</sha512> + <archiveName>7-zip.commandline.18.1.0.nupkg</archiveName> </tool> <tool name="aria2" os="windows"> <version>18.01.0</version> |
