Skip to content

utils: start generating a SDKSettings.json on Windows #78862

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions utils/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1845,9 +1845,32 @@ function Build-Runtime([Platform]$Platform, $Arch) {
CMAKE_SHARED_LINKER_FLAGS = if ($Platform -eq "Windows") { @("/INCREMENTAL:NO", "/OPT:REF", "/OPT:ICF") } else { @() };
})
}
}

function Write-SDKSettingsPlist([Platform]$Platform, $Arch) {
if ($Platform -eq [Platform]::Windows) {
Invoke-Program "$(Get-PythonExecutable)" -c "import plistlib; print(str(plistlib.dumps({ 'DefaultProperties': { 'DEFAULT_USE_RUNTIME': 'MD' } }), encoding='utf-8'))" `
-OutFile "$($Arch.SDKInstallRoot)\SDKSettings.plist"
} else {
Invoke-Program "$(Get-PythonExecutable)" -c "import plistlib; print(str(plistlib.dumps({ 'DefaultProperties': { } }), encoding='utf-8'))" `
-OutFile "$($Arch.SDKInstallRoot)\SDKSettings.plist"
}

Invoke-Program "$(Get-PythonExecutable)" -c "import plistlib; print(str(plistlib.dumps({ 'DefaultProperties': { 'DEFAULT_USE_RUNTIME': 'MD' } }), encoding='utf-8'))" `
-OutFile "$($Arch.SDKInstallRoot)\SDKSettings.plist"
$SDKSettings = @{
CanonicalName = "$($Arch.LLVMTarget)"
DisplayName = "$($Platform.ToString())"
IsBaseSDK = "NO"
Version = "${ProductVersion}"
VersionMap = @{}
DefaultProperties = @{
PLATFORM_NAME = "$($Platform.ToString())"
DEFAULT_COMPILER = "${ToolchainIdentifier}"
}
}
if ($Platform -eq [Platform]::Windows) {
$SDKSettings.DefaultProperties.DEFAULT_USE_RUNTIME = "MD"
}
$SDKSettings | ConvertTo-JSON | Out-FIle -FilePath "$($Arch.SDKInstallRoot)\SDKSettings.json"
}

function Build-Dispatch([Platform]$Platform, $Arch, [switch]$Test = $false) {
Expand Down Expand Up @@ -2136,6 +2159,7 @@ function Install-Platform([Platform]$Platform, $Arch) {

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

# Copy XCTest
Expand Down Expand Up @@ -2813,6 +2837,7 @@ if (-not $SkipBuild) {
Invoke-BuildStep Build-Foundation Windows $Arch
Invoke-BuildStep Build-XCTest Windows $Arch
Invoke-BuildStep Build-Testing Windows $Arch
Invoke-BuildStep Write-SDKSettingsPlist Windows $Arch
Invoke-BuildStep Write-PlatformInfoPlist $Arch
}

Expand All @@ -2831,6 +2856,7 @@ if (-not $SkipBuild) {
Invoke-BuildStep Build-Foundation Android $Arch
Invoke-BuildStep Build-XCTest Android $Arch
Invoke-BuildStep Build-Testing Android $Arch
Invoke-BuildStep Write-SDKSettingsPlist Android $Arch
Invoke-BuildStep Write-PlatformInfoPlist $Arch
}
}
Expand Down