-
-
Notifications
You must be signed in to change notification settings - Fork 640
Add basic support for tvOS #2460
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
Conversation
| ["linux"] = { "linux", "posix", "desktop" }, | ||
| ["macosx"] = { "macosx", "darwin", "posix", "desktop" }, | ||
| ["solaris"] = { "solaris", "posix", "desktop" }, | ||
| ["tvos"] = { "tvos", "darwin", "posix", "mobile" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is something I'm not quite sure on, what tags should tvOS have?
An Apple TV isn't a desktop device and it isn't a mobile device, but an Apple TV's internals are very similar to an iPhone, and iOS and tvOS share a lot of common history and functionality. So because of the familiarity to iOS I tagged it as mobile but I'm open to other suggestions
| Under macOS this sets the minimum version of the operating system required for the app to run and is equivalent to setting the `-mmacosx-version-min` (or newer `-mmacos-version-min`) compiler flag. | ||
|
|
||
| The same is true for iOS, iPadOS, tvOS, and watchOS system targets except it is equivalent to setting the `-miphoneos-version-min` (or newer `ios-version-min`) compiler flag. | ||
| The same is true for iOS, iPadOS, and watchOS system targets except it is equivalent to setting the `-miphoneos-version-min` (or newer `-mios-version-min`) compiler flag. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a pre-existing issue, and not directly relevant to this PR so I haven't touched it, but I want to say that mentioning watchOS in this sentence is not super correct in my opinion.
First, Premake doesn't directly support watchOS, so mentioning it at all without also saying Premake doesn't support it seems wrong.
Second, watchOS doesn't even use this compiler flag as Clang has a separate -mwatchos-version-min compiler flag just for watchOS, unless Clang has some weird internal logic where it falls back to using the iOS flag when the watchOS flag isn't specified
| local name = iif(cfg.system == p.MACOSX, "macosx", "iphoneos") | ||
| local name = "macosx" | ||
| if cfg.system == p.IOS then | ||
| name = "iphoneos" | ||
| elseif cfg.system == p.TVOS then | ||
| name = "appletvos" | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly
| local name = iif(cfg.system == p.MACOSX, "macosx", "iphoneos") | |
| local name = "macosx" | |
| if cfg.system == p.IOS then | |
| name = "iphoneos" | |
| elseif cfg.system == p.TVOS then | |
| name = "appletvos" | |
| end | |
| local names = { | |
| p.MACOSX = "macosx", | |
| p.IOS = "iphoneos", | |
| p.TVOS = "appletvos" | |
| } | |
| local name = names[cfg.system] |
What does this PR do?
This PR adds basic support for targeting tvOS.
For reference, when you're writing code that targets both iOS and tvOS, there are a bunch of small differences you have to worry about, but from an Xcode configuration point of view, there are only a few differences between iOS and tvOS:
appletvosSDK instead of theiphoneosSDK.TVOS_DEPLOYMENT_TARGETto set the min OS version supported, instead ofIPHONEOS_DEPLOYMENT_TARGET.iosfamily, so that can just be ignored.So the amount of changes required for Premake to support tvOS is relatively small, with a large percent of the additions in this PR being duplications of iOS unit tests with minor changes.
How does this PR change Premake's behavior?
A new target OS has been added.
Anything else we should know?
To show how similar iOS and tvOS are from a builds perspective, I was literally using this small snippet of bash code to smash the small amount of changes needed from an iOS build, and that got things building successfully for tvOS:
I would love to get tvOS support upstreamed, so I don't need to do ugly hacks like this anymore haha
Did you check all the boxes?
closes #XXXXin comment to auto-close issue when PR is merged)You can now support Premake on our OpenCollective. Your contributions help us spend more time responding to requests like these!