diff --git a/utils/build.ps1 b/utils/build.ps1 index e228e6b468cce..e7f4d163ea730 100644 --- a/utils/build.ps1 +++ b/utils/build.ps1 @@ -62,6 +62,10 @@ The version number of the Windows SDK to be used. Overrides the value resolved by the Visual Studio command prompt. If no such Windows SDK is installed, it will be downloaded from nuget. +.PARAMETER IncludeDS2 +Include the ds2 remote debug server in the SDK. +This component is currently only supported in Android builds. + .PARAMETER SkipBuild If set, does not run the build phase. @@ -125,6 +129,7 @@ param( [switch] $SkipBuild = $false, [switch] $SkipRedistInstall = $false, [switch] $SkipPackaging = $false, + [switch] $IncludeDS2 = $false, [string[]] $Test = @(), [string] $Stage = "", [string] $BuildTo = "", @@ -335,6 +340,14 @@ function Get-AndroidNDKPath { return $androidNDKPath } +function Get-FlexExecutable { + return Join-Path -Path $BinaryCache -ChildPath "win_flex_bison\win_flex.exe" +} + +function Get-BisonExecutable { + return Join-Path -Path $BinaryCache -ChildPath "win_flex_bison\win_bison.exe" +} + function Get-InstallDir($Arch) { if ($Arch -eq $HostArch) { $ProgramFilesName = "Program Files" @@ -446,6 +459,7 @@ enum BuildComponent { Compilers FoundationMacros TestingMacros + RegsGen2 } function Get-BuildProjectBinaryCache([BuildComponent]$Project) { @@ -739,6 +753,15 @@ function Fetch-Dependencies { Extract-ZipFile -ZipFileName "android-ndk-$AndroidNDKVersion-windows.zip" -BinaryCache $BinaryCache -ExtractPath "android-ndk-$AndroidNDKVersion" -CreateExtractPath $false } + if ($IncludeDS2) { + $WinFlexBisonVersion = "2.5.25" + $WinFlexBisonURL = "https://github.com/lexxmark/winflexbison/releases/download/v$WinFlexBisonVersion/win_flex_bison-$WinFlexBisonVersion.zip" + $WinFlexBisonHash = "8D324B62BE33604B2C45AD1DD34AB93D722534448F55A16CA7292DE32B6AC135" + DownloadAndVerify $WinFlexBisonURL "$BinaryCache\win_flex_bison-$WinFlexBisonVersion.zip" $WinFlexBisonHash + + Extract-ZipFile -ZipFileName "win_flex_bison-$WinFlexBisonVersion.zip" -BinaryCache $BinaryCache -ExtractPath "win_flex_bison" + } + if ($WinSDKVersion) { try { # Check whether VsDevShell can already resolve the requested Windows SDK Version @@ -1490,6 +1513,39 @@ function Build-XML2([Platform]$Platform, $Arch) { } } +function Build-RegsGen2($Arch) { + $ArchName = $Arch.LLVMName + + Build-CMakeProject ` + -Src $SourceCache\ds2\Tools\RegsGen2 ` + -Bin "$(Get-BuildProjectBinaryCache RegsGen2)" ` + -Arch $Arch ` + -BuildTargets default ` + -UseMSVCCompilers C,CXX ` + -Defines @{ + BISON_EXECUTABLE = "$(Get-BisonExecutable)"; + FLEX_EXECUTABLE = "$(Get-FlexExecutable)"; + } +} + +function Build-DS2([Platform]$Platform, $Arch) { + $ArchName = $Arch.LLVMTarget.Replace("$AndroidAPILevel","") + + Build-CMakeProject ` + -Src "$SourceCache\ds2" ` + -Bin "$($Arch.BinaryCache)\$Platform\ds2" ` + -InstallTo "$($Arch.PlatformInstallRoot)\Developer\Library\$ArchName" ` + -Arch $Arch ` + -Platform $Platform ` + -BuildTargets default ` + -Defines @{ + CMAKE_SYSTEM_NAME = $Platform.ToString(); + DS2_REGSGEN2 = "$(Get-BuildProjectBinaryCache RegsGen2)/regsgen2.exe"; + BISON_EXECUTABLE = "$(Get-BisonExecutable)"; + FLEX_EXECUTABLE = "$(Get-FlexExecutable)"; + } +} + function Build-CURL([Platform]$Platform, $Arch) { $ArchName = $Arch.LLVMName @@ -2459,6 +2515,9 @@ if (-not $SkipBuild) { if ($IsCrossCompiling) { Invoke-BuildStep Build-Compilers -Build $BuildArch } + if ($IncludeDS2) { + Invoke-BuildStep Build-RegsGen2 $BuildArch + } Invoke-BuildStep Build-CMark $HostArch Invoke-BuildStep Build-Compilers $HostArch @@ -2491,6 +2550,9 @@ if (-not $SkipBuild) { } foreach ($Arch in $AndroidSDKArchs) { + if ($IncludeDS2) { + Invoke-BuildStep Build-DS2 Android $Arch + } Invoke-BuildStep Build-ZLib Android $Arch Invoke-BuildStep Build-XML2 Android $Arch Invoke-BuildStep Build-CURL Android $Arch