Skip to content

Commit ce4ad6f

Browse files
committed
utils: start generating a SDKSettings.json on Windows
When building SDKs, generate a SDKSettings.json file to silence a spurious warning from swift-driver.
1 parent 74a8c58 commit ce4ad6f

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) {
@@ -2136,6 +2159,7 @@ function Install-Platform([Platform]$Platform, $Arch) {
21362159

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

21412165
# Copy XCTest
@@ -2813,6 +2837,7 @@ if (-not $SkipBuild) {
28132837
Invoke-BuildStep Build-Foundation Windows $Arch
28142838
Invoke-BuildStep Build-XCTest Windows $Arch
28152839
Invoke-BuildStep Build-Testing Windows $Arch
2840+
Invoke-BuildStep Write-SDKSettingsPlist Windows $Arch
28162841
Invoke-BuildStep Write-PlatformInfoPlist $Arch
28172842
}
28182843

@@ -2831,6 +2856,7 @@ if (-not $SkipBuild) {
28312856
Invoke-BuildStep Build-Foundation Android $Arch
28322857
Invoke-BuildStep Build-XCTest Android $Arch
28332858
Invoke-BuildStep Build-Testing Android $Arch
2859+
Invoke-BuildStep Write-SDKSettingsPlist Android $Arch
28342860
Invoke-BuildStep Write-PlatformInfoPlist $Arch
28352861
}
28362862
}

0 commit comments

Comments
 (0)