Skip to content

Commit 3472312

Browse files
authored
Merge pull request #78862 from compnerd/sdksettings
utils: start generating a SDKSettings.json on Windows
2 parents 0dc31a8 + ce4ad6f commit 3472312

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

utils/build.ps1

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,9 +1845,32 @@ function Build-Runtime([Platform]$Platform, $Arch) {
18451845
CMAKE_SHARED_LINKER_FLAGS = if ($Platform -eq "Windows") { @("/INCREMENTAL:NO", "/OPT:REF", "/OPT:ICF") } else { @() };
18461846
})
18471847
}
1848+
}
1849+
1850+
function Write-SDKSettingsPlist([Platform]$Platform, $Arch) {
1851+
if ($Platform -eq [Platform]::Windows) {
1852+
Invoke-Program "$(Get-PythonExecutable)" -c "import plistlib; print(str(plistlib.dumps({ 'DefaultProperties': { 'DEFAULT_USE_RUNTIME': 'MD' } }), encoding='utf-8'))" `
1853+
-OutFile "$($Arch.SDKInstallRoot)\SDKSettings.plist"
1854+
} else {
1855+
Invoke-Program "$(Get-PythonExecutable)" -c "import plistlib; print(str(plistlib.dumps({ 'DefaultProperties': { } }), encoding='utf-8'))" `
1856+
-OutFile "$($Arch.SDKInstallRoot)\SDKSettings.plist"
1857+
}
18481858

1849-
Invoke-Program "$(Get-PythonExecutable)" -c "import plistlib; print(str(plistlib.dumps({ 'DefaultProperties': { 'DEFAULT_USE_RUNTIME': 'MD' } }), encoding='utf-8'))" `
1850-
-OutFile "$($Arch.SDKInstallRoot)\SDKSettings.plist"
1859+
$SDKSettings = @{
1860+
CanonicalName = "$($Arch.LLVMTarget)"
1861+
DisplayName = "$($Platform.ToString())"
1862+
IsBaseSDK = "NO"
1863+
Version = "${ProductVersion}"
1864+
VersionMap = @{}
1865+
DefaultProperties = @{
1866+
PLATFORM_NAME = "$($Platform.ToString())"
1867+
DEFAULT_COMPILER = "${ToolchainIdentifier}"
1868+
}
1869+
}
1870+
if ($Platform -eq [Platform]::Windows) {
1871+
$SDKSettings.DefaultProperties.DEFAULT_USE_RUNTIME = "MD"
1872+
}
1873+
$SDKSettings | ConvertTo-JSON | Out-FIle -FilePath "$($Arch.SDKInstallRoot)\SDKSettings.json"
18511874
}
18521875

18531876
function Build-Dispatch([Platform]$Platform, $Arch, [switch]$Test = $false) {
@@ -2137,6 +2160,7 @@ function Install-Platform([Platform]$Platform, $Arch) {
21372160

21382161
# Copy plist files (same across architectures)
21392162
Copy-File "$($Arch.PlatformInstallRoot)\Info.plist" ([IO.Path]::Combine((Get-InstallDir $HostArch), "Platforms", "${Platform}.platform"))
2163+
Copy-File "$($Arch.SDKInstallRoot)\SDKSettings.json" ([IO.Path]::Combine((Get-InstallDir $HostArch), "Platforms", "${Platform}.platform", "Developer", "SDKs", "${Platform}.sdk"))
21402164
Copy-File "$($Arch.SDKInstallRoot)\SDKSettings.plist" ([IO.Path]::Combine((Get-InstallDir $HostArch), "Platforms", "${Platform}.platform", "Developer", "SDKs", "${Platform}.sdk"))
21412165

21422166
# Copy XCTest
@@ -2814,6 +2838,7 @@ if (-not $SkipBuild) {
28142838
Invoke-BuildStep Build-Foundation Windows $Arch
28152839
Invoke-BuildStep Build-XCTest Windows $Arch
28162840
Invoke-BuildStep Build-Testing Windows $Arch
2841+
Invoke-BuildStep Write-SDKSettingsPlist Windows $Arch
28172842
Invoke-BuildStep Write-PlatformInfoPlist $Arch
28182843
}
28192844

@@ -2832,6 +2857,7 @@ if (-not $SkipBuild) {
28322857
Invoke-BuildStep Build-Foundation Android $Arch
28332858
Invoke-BuildStep Build-XCTest Android $Arch
28342859
Invoke-BuildStep Build-Testing Android $Arch
2860+
Invoke-BuildStep Write-SDKSettingsPlist Android $Arch
28352861
Invoke-BuildStep Write-PlatformInfoPlist $Arch
28362862
}
28372863
}

0 commit comments

Comments
 (0)