You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix visionOS build: use target_os=ios with visionOS compiler flags
GN doesn't recognize "xros" as a valid target OS, causing assertion
failures in Skia's GN files (e.g., zlib BUILD.gn "Unsupported ARM OS").
Solution: Use target_os="ios" but pass -target arm64-apple-xros1.0 via
extra_cflags. This leverages iOS/visionOS similarity while targeting
the correct platform.
Research from react-native ecosystem:
- react-native-skia #2280: visionOS blocked by GN limitations
- react-native-webgpu #90: uses CMake instead of GN for visionOS
Changes:
- Use target_os="ios" in visionOS GN args (GPU and CPU variants)
- Remove zlib patch (no longer needed)
- Document visionOS approach in CLAUDE.md
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CLAUDE.md
+20-3Lines changed: 20 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
4
4
5
5
## Overview
6
6
7
-
This repository provides a Python script and GitHub Actions workflow for building Skia static libraries for multiple platforms (macOS, iOS, Windows, Linux, WASM). It automates build environment setup, Skia repository cloning, GN argument configuration, and compilation.
7
+
This repository provides a Python script and GitHub Actions workflow for building Skia static libraries for multiple platforms (macOS, iOS, visionOS, Windows, Linux, WASM). It automates build environment setup, Skia repository cloning, GN argument configuration, and compilation.
8
8
9
9
## Build Commands
10
10
@@ -17,6 +17,7 @@ ulimit -n 2048
17
17
# Build libraries directly
18
18
python3 build-skia.py mac # macOS universal (arm64 + x86_64)
-`MAC_MIN_VERSION` / `IOS_MIN_VERSION` set deployment targets
72
74
-`EXCLUDE_DEPS` lists Skia dependencies to skip during sync
73
75
76
+
## visionOS Support
77
+
78
+
visionOS builds use a workaround because **GN (Google's build tool) doesn't recognize visionOS/xros as a valid target OS**. This causes assertion failures in Skia's GN files (e.g., `third_party/zlib/BUILD.gn`).
79
+
80
+
**Our approach:** Use `target_os = "ios"` with visionOS-specific compiler flags:
81
+
-`-target arm64-apple-xros1.0` tells clang to use the visionOS target triple
82
+
- The visionOS SDK is automatically selected based on the target triple
83
+
84
+
This approach was informed by research into:
85
+
-[react-native-skia #2280](https://github.com/Shopify/react-native-skia/issues/2280) - visionOS support blocked by GN limitations
86
+
-[react-native-webgpu #90](https://github.com/wcandillon/react-native-webgpu/pull/90) - successfully supports visionOS using CMake instead of GN
87
+
88
+
**Alternative approach (not used):** Build with CMake instead of GN, like react-native-webgpu does for Dawn. This would require significant changes to the build script.
89
+
74
90
## CI
75
91
76
92
The GitHub Actions workflow (`.github/workflows/build-skia.yml`) builds all platforms in parallel and creates releases tagged with the Skia branch name. Change `SKIA_BRANCH` env var to target different Skia versions.
77
93
78
94
```bash
79
-
gh workflow run build-skia.yml # Trigger a build manually
80
-
gh run list # Check CI status
95
+
gh workflow run build-skia.yml # Build all platforms
96
+
gh workflow run build-skia.yml -f platforms=visionos # Build only visionOS
0 commit comments