# SupportedPlatform for Linux etc

**URL:** <https://forums.swift.org/t/supportedplatform-for-linux-etc/46692>\
**Category:** Using Swift\
**Tags:** spm\
**Created:** [March 18, 2021, 5:25pm UTC](https://forums.swift.org/t/supportedplatform-for-linux-etc/46692 "2021-03-18T17:25:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![realh](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/realh/32/15275_2.png) [@realh](https://forums.swift.org/u/realh)\
**Post date:** [March 18, 2021, 5:25pm UTC](https://forums.swift.org/t/supportedplatform-for-linux-etc/46692/1 "2021-03-18T17:25:19Z")

</div>

I'm a bit confused about the support for non-Apple platforms in Package.swift/PackageDescription. The docs for `SupportedPlatform` mention Linux etc as members of the `Platform` struct, so there seems to be an intent to support Linux here, but in practice there is no support at the moment. The relationship between `Platform` and `SupportedPlatform` is undocumented and internal, so there doesn't seem to be a way to declare a `SupportedPlatform` for anything non-Apple to pass to the `Package` initializer.

I realise having a `LinuxVersion` that's meaningful in this context is near impossible, but that shouldn't be a problem for Windows, Android etc.

---

<div class="post-metadata">

**Author:** ![SDGGiesbrecht](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/sdggiesbrecht/32/4768_2.png) [@SDGGiesbrecht](https://forums.swift.org/u/SDGGiesbrecht)\
**Post date:** [March 18, 2021, 9:57pm UTC](https://forums.swift.org/t/supportedplatform-for-linux-etc/46692/2 "2021-03-18T21:57:31Z")

</div>

- [`SupportedPlatform`](https://github.com/apple/swift-package-manager/blob/1a3b735e7d98952be4fbbe8d1915eb0f5493e68d/Sources/PackageDescription/SupportedPlatforms.swift#L53-L70) is used in the second argmuent of `Package(name:platforms:...)` to constrain deployment target versions on platforms _which contain the Swift libraries as part of the operating system_. Thus it carries version information, and only applies to certain platforms. More details in this post: [How should SupportedPlatform work? - #2 by SDGGiesbrecht](https://forums.swift.org/t/how-should-supportedplatform-work/45213/2)

- [`Platform`](https://github.com/apple/swift-package-manager/blob/1a3b735e7d98952be4fbbe8d1915eb0f5493e68d/Sources/PackageDescription/SupportedPlatforms.swift#L53-L70) is used in `.when(platform:)` conditions attached to target dependencies and build settings. Here all platforms can be used as a condition, and no version is attached because deployment targets are irrelevant.

> [@realh](#):
>
> I realise having a `LinuxVersion` that's meaningful in this context is near impossible, but that shouldn't be a problem for Windows, Android etc.

It isn’t meaningful (yet) on any of these platforms, because you have to ship the core libraries with your build product, and thus the deployment target is already fixed by the SDK you compiled against (or the toolchain you are using if the SDK isn’t separate from it).
