diff --git a/Sources/SWBAndroidPlatform/Plugin.swift b/Sources/SWBAndroidPlatform/Plugin.swift index f282f26e8..c2f89e298 100644 --- a/Sources/SWBAndroidPlatform/Plugin.swift +++ b/Sources/SWBAndroidPlatform/Plugin.swift @@ -109,6 +109,14 @@ struct AndroidPlatformExtension: PlatformInfoExtension { ]) ] } + + func platformName(triple: LLVMTriple) -> String? { + if triple.system == "linux" && triple.environment?.hasPrefix("android") == true { + return "android" + } + + return nil + } } @_spi(Testing) public struct AndroidSDKRegistryExtension: SDKRegistryExtension { diff --git a/Sources/SWBGenericUnixPlatform/Plugin.swift b/Sources/SWBGenericUnixPlatform/Plugin.swift index 5e103d242..2f9d1b35a 100644 --- a/Sources/SWBGenericUnixPlatform/Plugin.swift +++ b/Sources/SWBGenericUnixPlatform/Plugin.swift @@ -92,6 +92,17 @@ struct GenericUnixPlatformInfoExtension: PlatformInfoExtension { ]) } } + + func platformName(triple: LLVMTriple) -> String? { + switch triple.system { + case "linux" where triple.environment?.hasPrefix("gnu") == true || triple.environment == "musl", + "freebsd", + "openbsd": + return triple.system + default: + return nil + } + } } struct GenericUnixSDKRegistryExtension: SDKRegistryExtension { diff --git a/Sources/SWBQNXPlatform/Plugin.swift b/Sources/SWBQNXPlatform/Plugin.swift index 37b9bde20..bd15f6b22 100644 --- a/Sources/SWBQNXPlatform/Plugin.swift +++ b/Sources/SWBQNXPlatform/Plugin.swift @@ -66,6 +66,14 @@ struct QNXPlatformExtension: PlatformInfoExtension { ]) ] } + + func platformName(triple: LLVMTriple) -> String? { + if triple.system == "nto" { + return "qnx" + } + + return nil + } } struct QNXSDKRegistryExtension: SDKRegistryExtension { diff --git a/Sources/SWBWindowsPlatform/Plugin.swift b/Sources/SWBWindowsPlatform/Plugin.swift index c4e07e673..aebcf472a 100644 --- a/Sources/SWBWindowsPlatform/Plugin.swift +++ b/Sources/SWBWindowsPlatform/Plugin.swift @@ -148,6 +148,14 @@ struct WindowsPlatformExtension: PlatformInfoExtension { return [] } } + + public func platformName(triple: LLVMTriple) -> String? { + if triple.system == "windows" { + return triple.system + } + + return nil + } } struct WindowsSDKRegistryExtension: SDKRegistryExtension {