Skip to content

WIP Added Vision Pro build support#502

Draft
handzlikchris wants to merge 7 commits intoCesiumGS:mainfrom
handzlikchris:vision-pro-support
Draft

WIP Added Vision Pro build support#502
handzlikchris wants to merge 7 commits intoCesiumGS:mainfrom
handzlikchris:vision-pro-support

Conversation

@handzlikchris
Copy link

Added Vision Pro build support, this is done by:

  • getting Reinterop to build libs to Generated-VisionOS
  • building native library with IOS configuration
  • changing XCode SDK to xros (after generation, workaround)
  • fixing issue where Unity would not copy generated Cesium libs to Xcode project (by setting CPU to ARM64 explicitly)
  • excluding some native libs from final XCode build (workaround)

Still work in progress but should be good starting place for anyone looking to use Cesium for Unity on Vision Pro / Polyspatial.

Approach taken here contains some workarounds - happy to continue on this one but would need some guidance.

  1. Cesium native is built using IOS config and XCode project is later re-targetted to xros, ideally we'd have separate xros toolchain for cmake, eg extern/xros-toolchain.cmake when I tried to build that it'd fail when resolving triplets
*** The output from the command was:
Computing installation plan...
The following packages will be built and installed:
    asyncplusplus:arm64-ios-unity@1.1#2 -- /Volumes/External/src/cesium-unity-samples-vp/Packages/com.cesium.unity/native~/vcpkg/ports/asyncplusplus
  * vcpkg-cmake:arm64-osx@2024-04-23
  * vcpkg-cmake-config:arm64-osx@2024-05-23
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet arm64-osx...
Compiler found: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
Unable to determine toolchain use for arm64-ios-unity with with CMAKE_SYSTEM_NAME visionOS. Did you mean to use VCPKG_CHAINLOAD_TOOLCHAIN_FILE?
note: updating vcpkg by rerunning bootstrap-vcpkg may resolve this failure.

Could resolve that properly to build for VisionOS from start.

  1. Needed to hardcode some generated libs to be exlcuded from build
"libjpeg.a",
"libwebp.a"

As they fail to compile (duplicated symbols) - not 100% sure if that exclusion will cause issues.

Also looks like native project for this PR installs into Plugins folder quite a lot of libraries that I've not seen built in other forum threads, notably 86 libs build for libabsl_XXX.a eg libabsl_bad_any_cast_impl.a, libabsl_string_view.a, libabsl_throw_delegate.a

@eirikwah
Copy link

eirikwah commented Sep 6, 2024

Thank you for starting a PR for this. I don't have time to help right now (AVP-support in my project does not have high priority right now), however I would like to add this information:

A complete solution (not verified by me yet) is mentioned here: #409 (comment) (pointing to https://github.com/HoloLabInc/ProjectSpirare-for-Unity/tree/main/unity/SpirareBrowser-visionOS-3DMaps#edit-cesium-for-unity and https://github.com/HoloLabInc/ProjectSpirare-for-Unity/blob/main/unity/SpirareBrowser-visionOS-3DMaps/Assets/App/Editor/CesiumPostProcessBuildForVisionOS.cs)

Here are some other links that describes some of the problems and some possible solutions:

@kring
Copy link
Member

kring commented Sep 6, 2024

Thanks for the PR @handzlikchris!

Unable to determine toolchain use for arm64-ios-unity with with CMAKE_SYSTEM_NAME visionOS. Did you mean to use VCPKG_CHAINLOAD_TOOLCHAIN_FILE?

Hmm it kind of seems like vcpkg doesn't understand visionOS as a system name. Information on this seems to be really sparse in my attempts to search so far. Worst case, it'll be necessary to define a custom toolchain.

A stupid question first, though... is visionOS really different from iOS? What I mean is, for fairly low-level code like cesium-native and its dependencies, is it possible to target a "least common denominator" of iOS and visionOS such that we don't need separate binaries for each? Or are they really such different operating systems?

@handzlikchris
Copy link
Author

@kring That's good question. To be honest I don't know how different VisionOS is from IOS. I don't have much experience with cmake, though that it may be a low-hanging fruit to change target to VisionOS for someone with more knowledge there.

If not - it may well be that building for IOS is good enough

@handzlikchris
Copy link
Author

Thank you for starting a PR for this. I don't have time to help right now (AVP-support in my project does not have high priority right now), however I would like to add this information:

A complete solution (not verified by me yet) is mentioned here: #409 (comment) (pointing to https://github.com/HoloLabInc/ProjectSpirare-for-Unity/tree/main/unity/SpirareBrowser-visionOS-3DMaps#edit-cesium-for-unity and https://github.com/HoloLabInc/ProjectSpirare-for-Unity/blob/main/unity/SpirareBrowser-visionOS-3DMaps/Assets/App/Editor/CesiumPostProcessBuildForVisionOS.cs)

Here are some other links that describes some of the problems and some possible solutions:

That's great find, thanks - I'll check it out

if (platform.platformGroup == BuildTargetGroup.iOS)
if (platform.platformGroup == BuildTargetGroup.iOS || platform.platformGroup == BuildTargetGroup.VisionOS)
{
library.Toolchain = "extern/ios-toolchain.cmake";
Copy link

@Merichbier Merichbier May 27, 2025

Choose a reason for hiding this comment

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

We suppose that using same toolchain as iOS will work. However CMAKE_SYSTEM_NAME are not the same:
iOS vs visionOS
https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-ios-tvos-visionos-or-watchos

We are also trying to run Cesium for Unity on Vision OS. I'm not in the office today, but I will investigate this tomorrow.

@raggnic
Copy link

raggnic commented Jul 9, 2025

has it been succesful for anyone? We are also currently trying to display cesium unity on vision pro

@ThibXR
Copy link

ThibXR commented Aug 6, 2025

Hi! I'm also unable to get Cesium running on VisionOS. It looks like recent updates to visionOS and/or Cesium have made previous solutions obsolete.

I tried applying some of the suggestions from here, like this one : https://github.com/HoloLabInc/ProjectSpirare-for-Unity/tree/main/unity/SpirareBrowser-visionOS-3DMaps#edit-cesium-for-unity
But XCode always failed to build, stating that libraries originally made for iOS can't be used.

I also tried using this tool : https://github.com/morin-innovation/silicon-binary-converter to convert the iOS libraries for visionOS. It compiles, but Cesium ends up generating nothing, and no errors are shown in the debug logs...

Did anyone succesfully used Cesium with visionOS 2.5 and Cesium 1.16 ?

@pschulzk
Copy link

@raggnic I confirm that I'm able to run https://github.com/HoloLabInc/ProjectSpirare-for-Unity/tree/main/unity/SpirareBrowser-visionOS-3DMaps (thank you, @kaorun55) with

  • Unity 2022.3.20f1
  • macOS Sequoia 15.6
  • visionOS 2.6

However, after about 15 minutes running the app crashes. I didn't investigate but suspect memory management issues.

Thanks to @handzlikchris for this PR.
I'm very eager to see official visionOS support progressing since the industrial use cases for Cesium with visionOS are extremely promising.

@davidcwps
Copy link

Hi! I'm also unable to get Cesium running on VisionOS. It looks like recent updates to visionOS and/or Cesium have made previous solutions obsolete.

I tried applying some of the suggestions from here, like this one : https://github.com/HoloLabInc/ProjectSpirare-for-Unity/tree/main/unity/SpirareBrowser-visionOS-3DMaps#edit-cesium-for-unity But XCode always failed to build, stating that libraries originally made for iOS can't be used.

I also tried using this tool : https://github.com/morin-innovation/silicon-binary-converter to convert the iOS libraries for visionOS. It compiles, but Cesium ends up generating nothing, and no errors are shown in the debug logs...

Did anyone succesfully used Cesium with visionOS 2.5 and Cesium 1.16 ?

We're currently running visionOS 26.2, Cesium 1.22 and Unity 6000.3.5f2 using the aforementioned workarounds and managed to resolve the linker error your describing by passing the "-ld64" flag in the "Other Linker Flags" Xcode build setting of the UnityFramework target. From my understanding, LD64 is an older linker than the one Xcode defaults to (LD_prime).

Here's a simple post processing build script we're using to automate this:

 public static class XcodeLinkerFlagsPostprocess
    {
        private const string FLAG = "-ld64";

        public const string PBX_PATH = "Unity-VisionOS.xcodeproj/project.pbxproj";
        public static PBXProject GetPBXProject(string projectPath)
        {
            string pbxProjPath = Path.Combine(projectPath, PBX_PATH);
            PBXProject proj = new PBXProject();
            proj.ReadFromFile(pbxProjPath);
            return proj;
        }

        [PostProcessBuild]
        public static void OnPostProcessBuild(BuildTarget buildTarget, string pathToBuiltProject)
        {
            if (buildTarget != BuildTarget.VisionOS) return;

            var pbxProjPath = Path.Combine(pathToBuiltProject, PBX_PATH);
            var proj = GetPBXProject(pathToBuiltProject);

            var targetGuid = proj.GetUnityFrameworkTargetGuid();

            AddLinkerFlag(proj, targetGuid, FLAG);
            File.WriteAllText(pbxProjPath, proj.WriteToString());
        }

        private static void AddLinkerFlag(PBXProject proj, string targetGuid, string flag)
        {
            // OTHER_LDFLAGS is an array build setting in Xcode
            var existing = proj.GetBuildPropertyForAnyConfig(targetGuid, "OTHER_LDFLAGS");
            if (existing != null && existing.Split(' ').Contains(flag))
                return;

            proj.AddBuildProperty(targetGuid, "OTHER_LDFLAGS", flag);
        }
    }

This doesn't fix the underlying problem of course, the most robust solution would be to actually build the libs for visionOS, as @handzlikchris tried.

Hope this helps!

@Xericore
Copy link

We're currently running visionOS 26.2, Cesium 1.22 and Unity 6000.3.5f2 using the aforementioned workarounds and managed to resolve the linker error your describing by passing the "-ld64" flag in the "Other Linker Flags" Xcode build setting of the UnityFramework target. From my understanding, LD64 is an older linker than the one Xcode defaults to (LD_prime).

@davidcwps Thanks for sharing! I'm currently trying to achieve the same result. Unity builds, but right now I'm stuck in xcode with 100 errors that look like this: "Undefined symbol: _DotNet_CesiumForUnity_Cesium3DTile_getBounds" etc. The -ld64 is visible in the Other Linker Flags in xcode. I'm using visionOS 26.2, Cesium 1.22 (with modifications described in ProjectSpirare) and Unity 6000.3.9f1.

Did you use the silicon-binary-converter to convert the iOS libraries to visionOS? Calling for example
silicon-binary-converter --platform visionos libzstd.a libzstd.a
results in this error for any file in /Plugins/iOS/lib
silicon_binary_converter/Transmogrifier.swift:49: Fatal error: The file is not a correct arm64 binary. Try thinning (via lipo) or unarchiving (via ar) first.

@davidcwps
Copy link

We did try to use the silicon binary converter, but had the same issues you're describing.
Could you post one of the Xcode error logs here so we can take a look? The -ld64 flag helped with libraries built for iOS.

@Xericore
Copy link

Thanks for the quick reply. I managed to find the issue. In Unity Editor, I had to select all libraries in "Cesium for Unity/Plugins/iOS/lib" as well as "libCesiumForUnityNative" and enable the checkbox for VisionOS in "Include Platforms".

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.

9 participants