Skip to content

[Not for merge]: Support building for visionOS #1957

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/vision-os.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: visionOS

on:
push:
branches:
- vision-os

workflow_dispatch:

concurrency:
group: vision-os-${{ github.ref }}
cancel-in-progress: true

jobs:
visionOS:
runs-on: ${{ matrix.os }}
name: vision-os
strategy:
fail-fast: false
matrix:
os: [macos-latest]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: vision-os

- name: Configure CMake
shell: bash
run: |
./build-vision-os.sh
55 changes: 55 additions & 0 deletions build-vision-os.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env bash

set -e

dir=build-vision-os
mkdir -p $dir
cd $dir
onnxruntime_version=1.20.2
onnxruntime_xros_arm64=onnxruntime-vision_os-xros_arm64-$onnxruntime_version/onnxruntime.framework

SHERPA_ONNX_HF=huggingface.co

if [ "$SHERPA_ONNX_HF_MIRROW" == true ]; then
SHERPA_ONNX_HF=hf-mirror.com
fi

if [ ! -f $onnxruntime_xros_arm64/libonnxruntime.dylib ]; then
wget -c https://$SHERPA_ONNX_HF/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-vision_os-xros_arm64-$onnxruntime_version.zip
unzip onnxruntime-vision_os-xros_arm64-$onnxruntime_version.zip
rm onnxruntime-vision_os-xros_arm64-$onnxruntime_version.zip
fi

# First, for simulator
echo "Building for visionOS (arm64)"

export SHERPA_ONNXRUNTIME_LIB_DIR=$PWD/$onnxruntime_xros_arm64
export SHERPA_ONNXRUNTIME_INCLUDE_DIR=$PWD/$onnxruntime_xros_arm64/Headers

echo "SHERPA_ONNXRUNTIME_LIB_DIR: $SHERPA_ONNXRUNTIME_LIB_DIR"
echo "SHERPA_ONNXRUNTIME_INCLUDE_DIR $SHERPA_ONNXRUNTIME_INCLUDE_DIR"

cmake \
-DBUILD_PIPER_PHONMIZE_EXE=OFF \
-DBUILD_PIPER_PHONMIZE_TESTS=OFF \
-DBUILD_ESPEAK_NG_EXE=OFF \
-DBUILD_ESPEAK_NG_TESTS=OFF \
-S .. \
-DCMAKE_TOOLCHAIN_FILE=./toolchains/ios.toolchain.cmake \
-DPLATFORM=VISIONOS \
-DENABLE_BITCODE=0 \
-DENABLE_ARC=1 \
-DENABLE_VISIBILITY=0 \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DSHERPA_ONNX_ENABLE_PYTHON=OFF \
-DSHERPA_ONNX_ENABLE_TESTS=OFF \
-DSHERPA_ONNX_ENABLE_CHECK=OFF \
-DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \
-DSHERPA_ONNX_ENABLE_JNI=OFF \
-DSHERPA_ONNX_ENABLE_C_API=ON \
-DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \
-DDEPLOYMENT_TARGET=13.0 \
-B build/vision_os_arm64

cmake --build build/vision_os_arm64 -j 4 --verbose
Loading