Skip to content

Commit 2b817f3

Browse files
authored
Merge pull request #76113 from andrurogerz/android-sdk-ds2
[android] conditionally build DS2 for the Android SDK
2 parents 791c1fd + a6684fd commit 2b817f3

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

utils/build.ps1

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ The version number of the Windows SDK to be used.
6262
Overrides the value resolved by the Visual Studio command prompt.
6363
If 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
6670
If 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,14 @@ function Get-AndroidNDKPath {
335340
return $androidNDKPath
336341
}
337342

343+
function Get-FlexExecutable {
344+
return Join-Path -Path $BinaryCache -ChildPath "win_flex_bison\win_flex.exe"
345+
}
346+
347+
function Get-BisonExecutable {
348+
return Join-Path -Path $BinaryCache -ChildPath "win_flex_bison\win_bison.exe"
349+
}
350+
338351
function Get-InstallDir($Arch) {
339352
if ($Arch -eq $HostArch) {
340353
$ProgramFilesName = "Program Files"
@@ -446,6 +459,7 @@ enum BuildComponent {
446459
Compilers
447460
FoundationMacros
448461
TestingMacros
462+
RegsGen2
449463
}
450464

451465
function Get-BuildProjectBinaryCache([BuildComponent]$Project) {
@@ -739,6 +753,15 @@ function Fetch-Dependencies {
739753
Extract-ZipFile -ZipFileName "android-ndk-$AndroidNDKVersion-windows.zip" -BinaryCache $BinaryCache -ExtractPath "android-ndk-$AndroidNDKVersion" -CreateExtractPath $false
740754
}
741755

756+
if ($IncludeDS2) {
757+
$WinFlexBisonVersion = "2.5.25"
758+
$WinFlexBisonURL = "https://github.com/lexxmark/winflexbison/releases/download/v$WinFlexBisonVersion/win_flex_bison-$WinFlexBisonVersion.zip"
759+
$WinFlexBisonHash = "8D324B62BE33604B2C45AD1DD34AB93D722534448F55A16CA7292DE32B6AC135"
760+
DownloadAndVerify $WinFlexBisonURL "$BinaryCache\win_flex_bison-$WinFlexBisonVersion.zip" $WinFlexBisonHash
761+
762+
Extract-ZipFile -ZipFileName "win_flex_bison-$WinFlexBisonVersion.zip" -BinaryCache $BinaryCache -ExtractPath "win_flex_bison"
763+
}
764+
742765
if ($WinSDKVersion) {
743766
try {
744767
# Check whether VsDevShell can already resolve the requested Windows SDK Version
@@ -1490,6 +1513,39 @@ function Build-XML2([Platform]$Platform, $Arch) {
14901513
}
14911514
}
14921515

1516+
function Build-RegsGen2($Arch) {
1517+
$ArchName = $Arch.LLVMName
1518+
1519+
Build-CMakeProject `
1520+
-Src $SourceCache\ds2\Tools\RegsGen2 `
1521+
-Bin "$(Get-BuildProjectBinaryCache RegsGen2)" `
1522+
-Arch $Arch `
1523+
-BuildTargets default `
1524+
-UseMSVCCompilers C,CXX `
1525+
-Defines @{
1526+
BISON_EXECUTABLE = "$(Get-BisonExecutable)";
1527+
FLEX_EXECUTABLE = "$(Get-FlexExecutable)";
1528+
}
1529+
}
1530+
1531+
function Build-DS2([Platform]$Platform, $Arch) {
1532+
$ArchName = $Arch.LLVMTarget.Replace("$AndroidAPILevel","")
1533+
1534+
Build-CMakeProject `
1535+
-Src "$SourceCache\ds2" `
1536+
-Bin "$($Arch.BinaryCache)\$Platform\ds2" `
1537+
-InstallTo "$($Arch.PlatformInstallRoot)\Developer\Library\$ArchName" `
1538+
-Arch $Arch `
1539+
-Platform $Platform `
1540+
-BuildTargets default `
1541+
-Defines @{
1542+
CMAKE_SYSTEM_NAME = $Platform.ToString();
1543+
DS2_REGSGEN2 = "$(Get-BuildProjectBinaryCache RegsGen2)/regsgen2.exe";
1544+
BISON_EXECUTABLE = "$(Get-BisonExecutable)";
1545+
FLEX_EXECUTABLE = "$(Get-FlexExecutable)";
1546+
}
1547+
}
1548+
14931549
function Build-CURL([Platform]$Platform, $Arch) {
14941550
$ArchName = $Arch.LLVMName
14951551

@@ -2459,6 +2515,9 @@ if (-not $SkipBuild) {
24592515
if ($IsCrossCompiling) {
24602516
Invoke-BuildStep Build-Compilers -Build $BuildArch
24612517
}
2518+
if ($IncludeDS2) {
2519+
Invoke-BuildStep Build-RegsGen2 $BuildArch
2520+
}
24622521

24632522
Invoke-BuildStep Build-CMark $HostArch
24642523
Invoke-BuildStep Build-Compilers $HostArch
@@ -2491,6 +2550,9 @@ if (-not $SkipBuild) {
24912550
}
24922551

24932552
foreach ($Arch in $AndroidSDKArchs) {
2553+
if ($IncludeDS2) {
2554+
Invoke-BuildStep Build-DS2 Android $Arch
2555+
}
24942556
Invoke-BuildStep Build-ZLib Android $Arch
24952557
Invoke-BuildStep Build-XML2 Android $Arch
24962558
Invoke-BuildStep Build-CURL Android $Arch

0 commit comments

Comments
 (0)