Skip to content

Add support for visionOS #50

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

Closed
wants to merge 6 commits into from
Closed

Conversation

johnzhou721
Copy link
Contributor

Fixes #49.

I couldn't figure out what the minimum version arg for visionOS is, so I omitted it from the FFI patch I created.

Also, it looks like xxx-CFLAGS is useless in the Makefile so I removed these as well.

PR Checklist:

  • [X ] All new features have been tested
  • All new features have been documented
  • [X ] I have read the CONTRIBUTING.md file
  • [X ] I will abide by the code of conduct

Signed-off-by: Xinyuan Zhou <[email protected]>
@johnzhou721
Copy link
Contributor Author

Note my email in the signed-off-by is same as github but differenet from the ``commit author'' -- I use BOTH email addresses.

I forgot what the sign-off-by is called, recall seeing it in the contributor's guide before but can't find it now. Am I still required to do it?

Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! This looks pretty good as a first pass; there's a couple of things that need to be cleaned up before we can merge it.

The first is the minimum version issue. I suspect you're completely correct that the minimum isn't actually required; however, it's an area where it's worth being explicit, if only so if/when we do need to add a version minimum later, we're not hunting for where that version minimum is required. Given the rapid development of the platform, I think it's not unreasonable to set 2.0 as the minimum; but if you think it's worth including v1.0 devices as well, then I wouldn't object to that either.

The other issue that needs resolution is CI.

Firstly, it looks like your mpdecimal patch has inadvertently broken watchOS support by changing the capitalisation on L16 of the patch.

Secondly, there's also a need to add visionOS to the CI matrix, so that we get visionOS binaries built as part of CI and release processes.

As for the question about commit signing - what you've got here is fine. Having the commit signed is a nice-to-have, but we don't rigorously enforce that requirement.

+ target = 'arm64-apple-xros-simulator'
+ directory = 'darwin_xros'
+ sdk = 'xrsimulator'
+ version_min = ''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency, my inlination here would be to enforce visionOS 2.0 as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above.

@johnzhou721
Copy link
Contributor Author

Thanks for reviewing my patch!

watchOS is TextEdit autocorrect...

@johnzhou721
Copy link
Contributor Author

OK Python-Apple-Support for xrOS is also coming together for the first time in forever...

Actual device already compiled, waiting for simulator to do it

After that I'll start a PR on that repo as well.

Will fix those things tomorrow, except the version issue which I don't know the flag for.

@freakboy3742 freakboy3742 mentioned this pull request Apr 13, 2025
4 tasks
@johnzhou721
Copy link
Contributor Author

I just added 3 commits for these stuff. Hope it looks great! Will test on my own box tomorrow

@johnzhou721
Copy link
Contributor Author

@freakboy3742 Can you approve CI? Thanks!

Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - and looks like it's passing CI.

The one last issue is almost entirely cosmetic, but it's one of those cosmetic details with a big UI impact - the naming of the platform.

Apple uses iphoneos and iphonesimulator to refer to platform that everyone calls
"iOS". They use appletvos and appletvsimulator to refer to "tvOS".

By extension, while xros and xrsimulator are the names used internally by Apple's tooling, "visionOS" is the name everyone actually knows. On that basis - I'd suggest that the public names (i.e., the Makefile and CI targets) should use the visionOS name, rather than xros or xrOS.

Apologies for not picking this earlier - it only stood out when the CI reported success on the xrOS build. The change should be mostly search and replace though.

@johnzhou721
Copy link
Contributor Author

Great! Also Python-Apple-Support -- I have a newer pkg-config m4 file so the patch over there is failing again. Before I figure out this issue with the m4 macro version on my own computer, could you please run autoreconf on your platform on your cpython?

Also xros is also the name of a vape so I guess... not good. Will commit

@freakboy3742
Copy link
Member

Great! Also Python-Apple-Support -- I have a newer pkg-config m4 file so the patch over there is failing again. Before I figure out this issue with the m4 macro version on my own computer, could you please run autoreconf on your platform on your cpython?

Will do - but as a heads up, it's a lot easier to keep comments about repos constrained to the repos they affect. I get notified on every change on every BeeWare repo; if you drop a comment on Python-Apple-support, I'll see it there.

@johnzhou721
Copy link
Contributor Author

nvm -- will do tomorrow it's getting later

@johnzhou721
Copy link
Contributor Author

Done!

@johnzhou721
Copy link
Contributor Author

Since we're dealing with XZ Utils here: Beware (or should I say BeeWare) of ALL of my patches, because I might be Jia Tan, only that I'm probably more sus than Jia Tan with a 1-day account,

@johnzhou721
Copy link
Contributor Author

Actually I changed everything except for the SDKs to use visionOS, looks like Apple's tooling handles visoinOS as well,

@freakboy3742 freakboy3742 mentioned this pull request Apr 14, 2025
4 tasks
Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few more comments inline, mostly related to xros/visionOS consistency.

Unfortunately, because you've created this PR from a main branch, I can't push any changes; so I've opened #52 that represents the changes from this PR, plus the changes from this review, plus one last change to account for the consistent use of xros in target triples.

# - XZ - build XZ for all platforms
# - XZ-iOS - build XZ for iOS
# - XZ-tvOS - build XZ for tvOS
# - XZ-watchOS - build XZ for watchOS
# - XZ-xrOS - build XZ for xrOS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# - XZ-xrOS - build XZ for xrOS
# - XZ-visionOS - build XZ for visionOS

More generally, there's an indentation issue across these comments - the - build... comments should all be aligned.

| sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \
| hiux* | abug | nacl* | netware* | windows* \
- | os9* | macos* | osx* | ios* | tvos* | watchos* \
+ | os9* | macos* | osx* | ios* | tvos* | watchos* | xros* | visionos* \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
+ | os9* | macos* | osx* | ios* | tvos* | watchos* | xros* | visionos* \
+ | os9* | macos* | osx* | ios* | tvos* | watchos* | xros* \

os2-emx-)
;;
- ios*-simulator* | tvos*-simulator* | watchos*-simulator*)
+ ios*-simulator* | tvos*-simulator* | watchos*-simulator* | xros*-simulator* | visionos*-simulator*)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
+ ios*-simulator* | tvos*-simulator* | watchos*-simulator* | xros*-simulator* | visionos*-simulator*)
+ ios*-simulator* | tvos*-simulator* | watchos*-simulator* | xros*-simulator*)

@@ -1713,3 +1713,3 @@
| hiux* | abug | nacl* | netware* | windows* \
- | os9* | macos* | osx* | ios* | tvos* | watchos* \
+ | os9* | macos* | osx* | ios* | tvos* | watchos* | xros* | visionos* \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
+ | os9* | macos* | osx* | ios* | tvos* | watchos* | xros* | visionos* \
+ | os9* | macos* | osx* | ios* | tvos* | watchos* | xros* \

@@ -1792,6 +1792,8 @@
os2-emx)
;;
*-eabi* | *-gnueabi*)
+ ;;
+ ios*-simulator | tvos*-simulator | watchos*-simulator)
+ ios*-simulator | tvos*-simulator | watchos*-simulator | xros*-simulator | visionos*-simulator)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
+ ios*-simulator | tvos*-simulator | watchos*-simulator | xros*-simulator | visionos*-simulator)
+ ios*-simulator | tvos*-simulator | watchos*-simulator | xros*-simulator)

TARGETS-visionOS=xrsimulator.arm64 xros.arm64
VERSION_MIN-visionOS=2.0
# Apple made lives harder by NOT having a -version-min flag
PYTHON_CONFIGURE-xrOS=ac_cv_func_sigaltstack=no
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable won't be used as-defined... which does raise the question of whether it is needed at all.

Suggested change
PYTHON_CONFIGURE-xrOS=ac_cv_func_sigaltstack=no
PYTHON_CONFIGURE-visionOS=ac_cv_func_sigaltstack=no

version_min = '-mwatchos-version-min=4.0'
+
+class visionos_simulator_arm64_platform(arm64_platform):
+ target = 'arm64-apple-visionos-simulator'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
+ target = 'arm64-apple-visionos-simulator'
+ target = 'arm64-apple-xros2.0-simulator'



+class visionos_device_arm64_platform(arm64_platform):
+ target = 'arm64-apple-visionos'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
+ target = 'arm64-apple-visionos'
+ target = 'arm64-apple-xros2.0'

I'd also leave a comment against version_min (in both configs) indicating that the minimum version is defined by the target triple.

# visionOS targets
TARGETS-visionOS=xrsimulator.arm64 xros.arm64
VERSION_MIN-visionOS=2.0
# Apple made lives harder by NOT having a -version-min flag
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Apple made lives harder by NOT having a -version-min flag
# visionOS doesn't expose -mxros-version-min or similar; it uses the version
# number in the -target triple, or a definition like:
# CFLAGS-visionOS=-arch arm64 -mtargetos=xros$(VERSION_MIN-visionOS)
# For consistency with existing tooling, we use the -target form.

@freakboy3742
Copy link
Member

Closing in favor of #52, due to this PR being from a main branch.

@johnzhou721 johnzhou721 mentioned this pull request Apr 14, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support visionOS
2 participants