WIP Added Vision Pro build support#502
Conversation
…de project after to xros
…be copied to xcode Libraries folder
…ode build - likely will cause issues
|
Thanks for the PR @handzlikchris!
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? |
|
@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 |
| if (platform.platformGroup == BuildTargetGroup.iOS) | ||
| if (platform.platformGroup == BuildTargetGroup.iOS || platform.platformGroup == BuildTargetGroup.VisionOS) | ||
| { | ||
| library.Toolchain = "extern/ios-toolchain.cmake"; |
There was a problem hiding this comment.
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.
|
has it been succesful for anyone? We are also currently trying to display cesium unity on vision pro |
|
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 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 ? |
|
@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
However, after about 15 minutes running the app crashes. I didn't investigate but suspect memory management issues. Thanks to @handzlikchris for this PR. |
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! |
@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 |
|
We did try to use the silicon binary converter, but had the same issues you're describing. |
|
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". |
Added Vision Pro build support, this is done by:
Generated-VisionOSStill 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.
extern/xros-toolchain.cmakewhen I tried to build that it'd fail when resolving tripletsCould resolve that properly to build for VisionOS from start.
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.aeglibabsl_bad_any_cast_impl.a,libabsl_string_view.a,libabsl_throw_delegate.a