Skip to content
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

Add support for visionOS #176

Open
knight556 opened this issue Jun 25, 2023 · 11 comments
Open

Add support for visionOS #176

knight556 opened this issue Jun 25, 2023 · 11 comments
Assignees
Labels

Comments

@knight556
Copy link

knight556 commented Jun 25, 2023

Feature request
Please add support for the xrOS platform and simulator.

@leetal
Copy link
Owner

leetal commented Jun 25, 2023

Please have a look at the PR @ #175 :)

@floppyhammer
Copy link

clang: error: cannot specify '-mtargetos=xros1.0' along with '-target arm64-apple-xros1.0'

The latest toolchain file doesn't work for me. I'm using a nightly version of CMake (cmake-3.27.20230807) with the PR supportting visionOS merged.

@floppyhammer
Copy link

Okay, I found a solution. You just cannot specify both of -mtargetos (which is specified in Apple-Clang.cmake) and -target. Commenting the lines to set APPLE_TARGET_TRIPLE_INT around here https://github.com/leetal/ios-cmake/blob/b0e8b29da5025cc728b442b3f6b88e1f923b885b/ios.toolchain.cmake#L500C1-L507C10 works for me.

@floppyhammer
Copy link

It turned out the above-mentioned solution doesn't work. You can get the library to compile this way, but you cannot link it with other libraries built with Xcode.

error: binaries with multiple platforms are not supported

It's probably due to the wrong build target given by CMake.

I ended up leaving the toolchain file and modifying Apple-Clang.cmake instead.

  elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/XROS")
  #  set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mtargetos=xros")
  elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/XRSimulator")
  #  set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mtargetos=xros")

Now it links without a problem.

@leetal
Copy link
Owner

leetal commented Aug 10, 2023

The "poor-mans-choice workaround" could be to actually filter any -mtargetos=xros from the C[XX]_FLAGS prior to building (if building visionOS) with the toolchain. But then we'd be "breaking" (read fix) the upstream features which i really don't want either.. Hard one to crack..

@danoli3
Copy link

danoli3 commented Feb 7, 2024

Remove APPLE_TARGET_TRIPLE_INT for successful compile

@paulocoutinhox
Copy link

+1

@knight556
Copy link
Author

Any progress on this ticket?

@danoli3
Copy link

danoli3 commented Mar 8, 2024

Yes this actually is still a problem when linking the XROS Sim and XROS causing issues.

Problem still occurring. Looking into

  Run Build Command(s): /opt/homebrew/Cellar/cmake/3.28.1/bin/cmake -E env VERBOSE=1 /usr/bin/make -f Makefile cmTC_cf39d/fast
    /Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/cmTC_cf39d.dir/build.make CMakeFiles/cmTC_cf39d.dir/build
    Building C object CMakeFiles/cmTC_cf39d.dir/testCCompiler.c.o
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang   --target=-apple-xros1.0   -fvisibility=hidden -fvisibility-inlines-hidden   -std=gnu17 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS1.0.sdk -mtargetos=xros1.0 -fPIC -MD -MT CMakeFiles/cmTC_cf39d.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_cf39d.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_cf39d.dir/testCCompiler.c.o -c /Users/~/SOURCE/openFrameworksmacOS/scripts/apothecary/apothecary/build/zlib/build_xros_VISIONOS/CMakeFiles/CMakeScratch/TryCompile-BLvmqO/testCCompiler.c
    clang: error: cannot specify '-mtargetos=xros1.0' along with '--target=-apple-xros1.0'
    make[1]: *** [CMakeFiles/cmTC_cf39d.dir/testCCompiler.c.o] Error 1
    make: *** [cmTC_cf39d/fast] Error 
    ```
    
 Yeah essentially need to remove the "-mtargetos=xros1.0" 

@danoli3
Copy link

danoli3 commented Mar 8, 2024

Okay looks like CMake are on the case:
https://gitlab.kitware.com/cmake/cmake/-/issues/25188

Fix in Cmake 3.28.4

@danoli3
Copy link

danoli3 commented Mar 22, 2024

Kitware/CMake@361e5fd

Merged in Cmake 3.29.0 just released today!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants