-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Improve support for iOS targets. #14444
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -119,6 +119,7 @@ class _VerPickleLoadable(Protocol): | |
| 'is_freebsd', | ||
| 'is_haiku', | ||
| 'is_hurd', | ||
| 'is_ios', | ||
| 'is_irix', | ||
| 'is_linux', | ||
| 'is_netbsd', | ||
|
|
@@ -127,6 +128,8 @@ class _VerPickleLoadable(Protocol): | |
| 'is_parent_path', | ||
| 'is_qnx', | ||
| 'is_sunos', | ||
| 'is_tvos', | ||
| 'is_watchos', | ||
| 'is_windows', | ||
| 'is_wsl', | ||
| 'iter_regexin_iter', | ||
|
|
@@ -625,6 +628,18 @@ def is_osx() -> bool: | |
| return platform.system().lower() == 'darwin' | ||
|
|
||
|
|
||
| def is_ios() -> bool: | ||
| return platform.system().lower() == 'ios' | ||
|
|
||
|
|
||
| def is_tvos() -> bool: | ||
| return platform.system().lower() == 'tvos' | ||
|
|
||
|
|
||
| def is_watchos() -> bool: | ||
| return platform.system().lower() == 'watchos' | ||
|
|
||
|
|
||
|
Comment on lines
+631
to
+642
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you run Meson on these platforms, ie, can you use ios, tvos, and watchos to compile? If the answer is no then these can never be correct, since they will always point at the build machine. Side note: I'd really like to get rid of these because they often end up creating bugs for cross compilation.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can't run Meson on iOS, as there's no compiler tooling that is run on device. However, you can set up a cross platform build environment that pretends to be iOS, and I've successfully used that approach to build binary Python wheels for Pillow, Numpy, and a handful of other packages. It might be possible to build a full iOS app with Meson, but I haven't tried. My interest here is entirely tied to I haven't tried using Meson with tvOS and watchOS, but the situation there will be much the same (i.e., cross compilation environments). I added entries for those platforms here because there are already references to tvOS and watchOS in other sections of the code, so I figured I'd retain the symmetry.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we could rephrase the question. universal.py contains some logic for determining what operating system the meson application is running on. This is sometimes important to know how to interact with the operating system, to take one example we use These are obvious cases where it doesn't matter what the build machine or host machine is. It's not about what we're compiling, it's about how we're communicating with the operating system / filesystem / task scheduler. And that much is a constant, even if I'm running on Windows (!) and rigged a cross platform build environment that identifies itself as FreeBSD (!!!). I still need to communicate with cmd, run For other purposes, it's probably not very useful to ask what the operating system platform is, but rather ask what the build machine and host machine claim to be. And that includes, what does the build machine masquerade as via running in a simulator such as wine or the iOS simulator or qemu-user. We currently don't clearly separate these cases. We have a lot of code that queries mesonlib, rather than querying an interpreter So, I guess the question to ask is, are there situations where we'd want to write new code in meson which asks "am I running the meson application on an iPhone and it's important to distinguish this from a MacBook"? Or do we just want to write new code that knows "we are natively building an iOS artifact" / "we are cross compiling an iOS artifact"?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And since we aren't currently using these new functions, it's easy to defer the decision to add them until some other time, when someone comes up with a good reason why they definitely need it.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok - I think I understand the intention; there's definitely a gap here in terms of identifying cross-platform build environments and differentiating the build and host environment, but that's way outside my pay grade :-) FWIW, meson won't ever be running on an iOS device (or, if it is, it would be mostly pointless, because there's no compiler or ability to call subprocess). The situation on Android is a little different, but But - I've gone back and checked my original usage, and it turns out I'm not actually using these methods anyway - all the practical usage is checking the env object. On that basis, I'll strip these methods out. |
||
| def is_linux() -> bool: | ||
| return platform.system().lower() == 'linux' | ||
|
|
||
|
|
||
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.
The change from single to double quotes looks unrelated (and we generally prefer single quotes)