@@ -62,6 +62,10 @@ The version number of the Windows SDK to be used.
6262Overrides the value resolved by the Visual Studio command prompt.
6363If no such Windows SDK is installed, it will be downloaded from nuget.
6464
65+ . PARAMETER IncludeDS2
66+ Include the ds2 remote debug server in the SDK.
67+ This component is currently only supported in Android builds.
68+
6569. PARAMETER SkipBuild
6670If set, does not run the build phase.
6771
@@ -125,6 +129,7 @@ param(
125129 [switch ] $SkipBuild = $false ,
126130 [switch ] $SkipRedistInstall = $false ,
127131 [switch ] $SkipPackaging = $false ,
132+ [switch ] $IncludeDS2 = $false ,
128133 [string []] $Test = @ (),
129134 [string ] $Stage = " " ,
130135 [string ] $BuildTo = " " ,
@@ -335,6 +340,16 @@ function Get-AndroidNDKPath {
335340 return $androidNDKPath
336341}
337342
343+ function Get-FlexExecutable {
344+ $flexExecutable = Join-Path - Path $BinaryCache - ChildPath " win_flex_bison\win_flex.exe"
345+ return $flexExecutable
346+ }
347+
348+ function Get-BisonExecutable {
349+ $bisonExecutable = Join-Path - Path $BinaryCache - ChildPath " win_flex_bison\win_bison.exe"
350+ return $bisonExecutable
351+ }
352+
338353function Get-InstallDir ($Arch ) {
339354 if ($Arch -eq $HostArch ) {
340355 $ProgramFilesName = " Program Files"
@@ -431,6 +446,7 @@ enum HostComponent {
431446 LMDB
432447 SymbolKit
433448 DocC
449+ RegsGen2
434450}
435451
436452function Get-HostProjectBinaryCache ([HostComponent ]$Project ) {
@@ -739,6 +755,15 @@ function Fetch-Dependencies {
739755 Extract- ZipFile - ZipFileName " android-ndk-$AndroidNDKVersion -windows.zip" - BinaryCache $BinaryCache - ExtractPath " android-ndk-$AndroidNDKVersion " - CreateExtractPath $false
740756 }
741757
758+ if ($IncludeDS2 ) {
759+ $WinFlexBisonVersion = " 2.5.25"
760+ $WinFlexBisonURL = " https://github.com/lexxmark/winflexbison/releases/download/v$WinFlexBisonVersion /win_flex_bison-$WinFlexBisonVersion .zip"
761+ $WinFlexBisonHash = " 8D324B62BE33604B2C45AD1DD34AB93D722534448F55A16CA7292DE32B6AC135"
762+ DownloadAndVerify $WinFlexBisonURL " $BinaryCache \win_flex_bison-$WinFlexBisonVersion .zip" $WinFlexBisonHash
763+
764+ Extract- ZipFile - ZipFileName " win_flex_bison-$WinFlexBisonVersion .zip" - BinaryCache $BinaryCache - ExtractPath " win_flex_bison"
765+ }
766+
742767 if ($WinSDKVersion ) {
743768 try {
744769 # Check whether VsDevShell can already resolve the requested Windows SDK Version
@@ -1490,6 +1515,39 @@ function Build-XML2([Platform]$Platform, $Arch) {
14901515 }
14911516}
14921517
1518+ function Build-RegsGen2 ($Arch ) {
1519+ $ArchName = $Arch.LLVMName
1520+
1521+ Build-CMakeProject `
1522+ - Src $SourceCache \ds2\Tools\RegsGen2 `
1523+ - Bin " $ ( Get-HostProjectBinaryCache RegsGen2) " `
1524+ - Arch $Arch `
1525+ - BuildTargets default `
1526+ - UseMSVCCompilers C, CXX `
1527+ - Defines @ {
1528+ BISON_EXECUTABLE = " $ ( Get-BisonExecutable ) " ;
1529+ FLEX_EXECUTABLE = " $ ( Get-FlexExecutable ) " ;
1530+ }
1531+ }
1532+
1533+ function Build-DS2 ([Platform ]$Platform , $Arch ) {
1534+ $ArchName = $Arch.LLVMTarget.Replace (" $AndroidAPILevel " , " " )
1535+
1536+ Build-CMakeProject `
1537+ - Src " $SourceCache \ds2" `
1538+ - Bin " $ ( $Arch.BinaryCache ) \$Platform \ds2" `
1539+ - InstallTo " $ ( $Arch.PlatformInstallRoot ) \Developer\Library\$ArchName " `
1540+ - Arch $Arch `
1541+ - Platform $Platform `
1542+ - BuildTargets default `
1543+ - Defines @ {
1544+ CMAKE_SYSTEM_NAME = $Platform.ToString ();
1545+ DS2_REGSGEN2 = " $ ( Get-HostProjectBinaryCache RegsGen2) /regsgen2.exe" ;
1546+ BISON_EXECUTABLE = " $ ( Get-BisonExecutable ) " ;
1547+ FLEX_EXECUTABLE = " $ ( Get-FlexExecutable ) " ;
1548+ }
1549+ }
1550+
14931551function Build-CURL ([Platform ]$Platform , $Arch ) {
14941552 $ArchName = $Arch.LLVMName
14951553
@@ -2471,6 +2529,10 @@ if ($Clean) {
24712529 }
24722530}
24732531
2532+ if (-not $SkipBuild -and $IncludeDS2 ) {
2533+ Invoke-BuildStep Build-RegsGen2 $HostArch
2534+ }
2535+
24742536if (-not $SkipBuild ) {
24752537 foreach ($Arch in $WindowsSDKArchs ) {
24762538 Invoke-BuildStep Build-ZLib Windows $Arch
@@ -2491,6 +2553,9 @@ if (-not $SkipBuild) {
24912553 }
24922554
24932555 foreach ($Arch in $AndroidSDKArchs ) {
2556+ if ($IncludeDS2 ) {
2557+ Invoke-BuildStep Build-DS2 Android $Arch
2558+ }
24942559 Invoke-BuildStep Build-ZLib Android $Arch
24952560 Invoke-BuildStep Build-XML2 Android $Arch
24962561 Invoke-BuildStep Build-CURL Android $Arch
0 commit comments