mirror of
https://github.com/k2-fsa/sherpa-onnx.git
synced 2026-11-10 21:11:03 +08:00
Fix releasing dart packages (#3874)
This commit is contained in:
1 parent
c3625d24fb
commit
e1edbfee66
23 files changed
+250
-163
No files matched your search
@@ -65,18 +65,18 @@ jobs:
|
||||
unzip -o $GITHUB_WORKSPACE/build-macos-shared-sherpa-with-static-onnxruntime/*.xcframework.zip -d .
|
||||
ls -lh sherpa-onnx.xcframework/
|
||||
|
||||
# Find the framework bundle
|
||||
fw_path=$(find sherpa-onnx.xcframework -name "SherpaOnnxC.framework" -type d | head -1)
|
||||
echo "fw_path: $fw_path"
|
||||
# Find the xcframework architecture directory
|
||||
arch_dir=$(find sherpa-onnx.xcframework -path "*macos*" -type d -not -name "*.xcframework" | head -1)
|
||||
echo "arch_dir: $arch_dir"
|
||||
|
||||
test -f "$fw_path/Versions/A/SherpaOnnxC" || { echo "Binary not found"; exit 1; }
|
||||
test -f "$fw_path/Versions/A/Headers/sherpa-onnx/c-api/c-api.h" || { echo "Header not found"; exit 1; }
|
||||
test -f "$fw_path/Versions/A/Modules/module.modulemap" || { echo "Modulemap not found"; exit 1; }
|
||||
test -f "$arch_dir/libsherpa-onnx-c-api.dylib" || { echo "Binary not found"; exit 1; }
|
||||
test -f "$arch_dir/Headers/sherpa-onnx/c-api/c-api.h" || { echo "Header not found"; exit 1; }
|
||||
test -f "$arch_dir/Headers/module.modulemap" || { echo "Modulemap not found"; exit 1; }
|
||||
|
||||
# Verify onnxruntime is NOT a dynamic dependency
|
||||
echo "Checking dynamic dependencies:"
|
||||
otool -L "$fw_path/Versions/A/SherpaOnnxC"
|
||||
if otool -L "$fw_path/Versions/A/SherpaOnnxC" | grep -q libonnxruntime; then
|
||||
otool -L "$arch_dir/libsherpa-onnx-c-api.dylib"
|
||||
if otool -L "$arch_dir/libsherpa-onnx-c-api.dylib" | grep -q libonnxruntime; then
|
||||
echo "ERROR: libonnxruntime is still a dynamic dependency!"
|
||||
exit 1
|
||||
fi
|
||||
@@ -84,12 +84,12 @@ jobs:
|
||||
|
||||
# Test compilation
|
||||
clang -o version-c-api $GITHUB_WORKSPACE/c-api-examples/version-c-api.c \
|
||||
-I "$fw_path/Headers" \
|
||||
"$fw_path/Versions/A/SherpaOnnxC" \
|
||||
-I "$arch_dir/Headers" \
|
||||
"$arch_dir/libsherpa-onnx-c-api.dylib" \
|
||||
-framework CoreFoundation \
|
||||
-framework Foundation \
|
||||
-lc++ \
|
||||
-Wl,-rpath,"$(dirname $fw_path)"
|
||||
-Wl,-rpath,"$arch_dir"
|
||||
|
||||
./version-c-api
|
||||
|
||||
|
||||
@@ -238,7 +238,7 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
cd /tmp
|
||||
zip -r /tmp/sherpa_onnx_linux.zip to_be_published
|
||||
zip -r -y /tmp/sherpa_onnx_linux.zip to_be_published
|
||||
ls -lh /tmp/sherpa_onnx_linux.zip
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
@@ -312,16 +312,13 @@ jobs:
|
||||
unzip sherpa-onnx-${SHERPA_ONNX_VERSION}-macos-shared-onnxruntime-static.xcframework.zip
|
||||
rm sherpa-onnx-${SHERPA_ONNX_VERSION}-macos-shared-onnxruntime-static.xcframework.zip
|
||||
|
||||
mv sherpa-onnx.xcframework sherpa_onnx_macos/SherpaOnnxC.xcframework
|
||||
mv sherpa-onnx.xcframework sherpa_onnx_macos/sherpa-onnx.xcframework
|
||||
|
||||
ls -lh sherpa_onnx_macos/SherpaOnnxC.xcframework/
|
||||
ls -lh sherpa_onnx_macos/sherpa-onnx.xcframework/
|
||||
|
||||
- name: Prepare for publish
|
||||
shell: bash
|
||||
run: |
|
||||
rm -f flutter/sherpa_onnx_macos/macos/libsherpa-onnx-c-api.dylib
|
||||
rm -f flutter/sherpa_onnx_macos/macos/libonnxruntime.dylib
|
||||
|
||||
mv -v flutter/sherpa_onnx_macos /tmp/to_be_published
|
||||
|
||||
ls -lh /tmp/to_be_published/macos
|
||||
@@ -338,7 +335,7 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
cd /tmp
|
||||
zip -r /tmp/sherpa_onnx_macos.zip to_be_published
|
||||
zip -r -y -y /tmp/sherpa_onnx_macos.zip to_be_published
|
||||
ls -lh /tmp/sherpa_onnx_macos.zip
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
@@ -542,7 +539,7 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
cd /tmp
|
||||
zip -r /tmp/sherpa_onnx_android_arm64.zip to_be_published
|
||||
zip -r -y /tmp/sherpa_onnx_android_arm64.zip to_be_published
|
||||
ls -lh /tmp/sherpa_onnx_android_arm64.zip
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
@@ -652,7 +649,7 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
cd /tmp
|
||||
zip -r /tmp/sherpa_onnx_android_armeabi.zip to_be_published
|
||||
zip -r -y /tmp/sherpa_onnx_android_armeabi.zip to_be_published
|
||||
ls -lh /tmp/sherpa_onnx_android_armeabi.zip
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
@@ -762,7 +759,7 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
cd /tmp
|
||||
zip -r /tmp/sherpa_onnx_android_x86.zip to_be_published
|
||||
zip -r -y /tmp/sherpa_onnx_android_x86.zip to_be_published
|
||||
ls -lh /tmp/sherpa_onnx_android_x86.zip
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
@@ -872,7 +869,7 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
cd /tmp
|
||||
zip -r /tmp/sherpa_onnx_android_x86_64.zip to_be_published
|
||||
zip -r -y /tmp/sherpa_onnx_android_x86_64.zip to_be_published
|
||||
ls -lh /tmp/sherpa_onnx_android_x86_64.zip
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
@@ -948,9 +945,9 @@ jobs:
|
||||
unzip sherpa-onnx-${SHERPA_ONNX_VERSION}-ios-shared-onnxruntime-static.xcframework.zip
|
||||
rm sherpa-onnx-${SHERPA_ONNX_VERSION}-ios-shared-onnxruntime-static.xcframework.zip
|
||||
|
||||
mv sherpa-onnx.xcframework sherpa_onnx_ios/SherpaOnnxC.xcframework
|
||||
mv sherpa-onnx.xcframework sherpa_onnx_ios/sherpa-onnx.xcframework
|
||||
|
||||
ls -lh sherpa_onnx_ios/SherpaOnnxC.xcframework/
|
||||
ls -lh sherpa_onnx_ios/sherpa-onnx.xcframework/
|
||||
|
||||
- name: Prepare for publish
|
||||
shell: bash
|
||||
@@ -971,7 +968,7 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
cd /tmp
|
||||
zip -r /tmp/sherpa_onnx_ios.zip to_be_published
|
||||
zip -r -y /tmp/sherpa_onnx_ios.zip to_be_published
|
||||
ls -lh /tmp/sherpa_onnx_ios.zip
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
@@ -1086,7 +1083,7 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
cd /tmp
|
||||
zip -r /tmp/sherpa_onnx_web.zip to_be_published
|
||||
zip -r -y /tmp/sherpa_onnx_web.zip to_be_published
|
||||
ls -lh /tmp/sherpa_onnx_web.zip
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
@@ -1162,7 +1159,7 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
cd /tmp
|
||||
zip -r /tmp/sherpa_onnx.zip to_be_published
|
||||
zip -r -y /tmp/sherpa_onnx.zip to_be_published
|
||||
ls -lh /tmp/sherpa_onnx.zip
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
|
||||
@@ -92,8 +92,11 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
cd flutter-examples/hello_world
|
||||
flutter pub get
|
||||
flutter config --enable-swift-package-manager
|
||||
flutter pub get
|
||||
# Remove CocoaPods build phases from Xcode project
|
||||
cd macos && pod deintegrate && cd ..
|
||||
rm -f macos/Podfile macos/Podfile.lock
|
||||
flutter build macos
|
||||
|
||||
ls -lh build/macos/Build/Products/Release/
|
||||
@@ -184,8 +187,11 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
cd flutter-examples/hello_world
|
||||
flutter pub get
|
||||
flutter config --enable-swift-package-manager
|
||||
flutter pub get
|
||||
# Remove CocoaPods build phases from Xcode project
|
||||
cd ios && pod deintegrate && cd ..
|
||||
rm -f ios/Podfile ios/Podfile.lock
|
||||
flutter build ios --no-codesign
|
||||
|
||||
ls -lh build/ios/iphoneos/
|
||||
@@ -411,7 +417,7 @@ jobs:
|
||||
run: |
|
||||
cd flutter-examples/hello_world/build/
|
||||
mv web flutter-hello-world-pkg-web
|
||||
zip -r flutter-hello-world-pkg-web.zip flutter-hello-world-pkg-web/
|
||||
zip -r -y flutter-hello-world-pkg-web.zip flutter-hello-world-pkg-web/
|
||||
ls -lh flutter-hello-world-pkg-web.zip
|
||||
|
||||
- name: Upload artifact
|
||||
|
||||
@@ -52,7 +52,17 @@ jobs:
|
||||
dart --version
|
||||
flutter doctor
|
||||
|
||||
- name: Cache xcframework
|
||||
id: cache-xcframework
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: build-macos-shared-sherpa-with-static-onnxruntime/sherpa-onnx.xcframework
|
||||
key: macos-xcframework-${{ hashFiles('build-macos-shared-sherpa-with-static-onnxruntime.sh', 'CMakeLists.txt') }}
|
||||
restore-keys: |
|
||||
macos-xcframework-
|
||||
|
||||
- name: Build xcframework from source
|
||||
if: steps.cache-xcframework.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
@@ -62,8 +72,8 @@ jobs:
|
||||
- name: Copy xcframework
|
||||
shell: bash
|
||||
run: |
|
||||
cp -av build-macos-shared-sherpa-with-static-onnxruntime/sherpa-onnx.xcframework flutter/sherpa_onnx_macos/macos/sherpa_onnx_macos/SherpaOnnxC.xcframework
|
||||
ls -lh flutter/sherpa_onnx_macos/macos/sherpa_onnx_macos/SherpaOnnxC.xcframework/
|
||||
cp -av build-macos-shared-sherpa-with-static-onnxruntime/sherpa-onnx.xcframework flutter/sherpa_onnx_macos/macos/sherpa_onnx_macos/sherpa-onnx.xcframework
|
||||
ls -lh flutter/sherpa_onnx_macos/macos/sherpa_onnx_macos/sherpa-onnx.xcframework/
|
||||
|
||||
- name: Use local sherpa_onnx_macos
|
||||
shell: bash
|
||||
@@ -115,7 +125,6 @@ jobs:
|
||||
flutter config --no-enable-swift-package-manager
|
||||
flutter pub get
|
||||
cd macos && pod install && cd ..
|
||||
export CODE_SIGNING_ALLOWED=NO
|
||||
flutter build macos
|
||||
|
||||
ls -lh build/macos/Build/Products/Release/
|
||||
@@ -132,7 +141,7 @@ jobs:
|
||||
run: |
|
||||
cd flutter-examples/${{ matrix.demo }}/build/macos/Build/Products/Release/
|
||||
app_name=$(echo ${{ matrix.demo }} | tr '-' '_')
|
||||
zip -r flutter-${{ matrix.demo }}-macos.zip ${app_name}.app/
|
||||
zip -r -y flutter-${{ matrix.demo }}-macos.zip ${app_name}.app/
|
||||
ls -lh flutter-${{ matrix.demo }}-macos.zip
|
||||
|
||||
- name: Release
|
||||
@@ -275,7 +284,7 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
cd flutter-examples/${{ matrix.demo }}/build/linux/*/release/
|
||||
zip -r flutter-${{ matrix.demo }}-linux-x64.zip bundle/
|
||||
zip -r -y flutter-${{ matrix.demo }}-linux-x64.zip bundle/
|
||||
ls -lh flutter-${{ matrix.demo }}-linux-x64.zip
|
||||
|
||||
- name: Release
|
||||
@@ -656,9 +665,9 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
cd flutter-examples/${{ matrix.demo }}/build/
|
||||
mv web flutter-${{ matrix.demo }}
|
||||
zip -r flutter-${{ matrix.demo }}.zip flutter-${{ matrix.demo }}/
|
||||
ls -lh flutter-${{ matrix.demo }}.zip
|
||||
mv web flutter-${{ matrix.demo }}-web
|
||||
zip -r -y flutter-${{ matrix.demo }}-web.zip flutter-${{ matrix.demo }}-web/
|
||||
ls -lh flutter-${{ matrix.demo }}-web.zip
|
||||
|
||||
- name: Release
|
||||
if: github.repository_owner == 'csukuangfj'
|
||||
@@ -666,7 +675,7 @@ jobs:
|
||||
with:
|
||||
file_glob: true
|
||||
overwrite: true
|
||||
file: ./flutter-examples/${{ matrix.demo }}/build/flutter-${{ matrix.demo }}.zip
|
||||
file: ./flutter-examples/${{ matrix.demo }}/build/flutter-${{ matrix.demo }}-web.zip
|
||||
repo_name: k2-fsa/sherpa-onnx
|
||||
repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}
|
||||
tag: flutter
|
||||
|
||||
@@ -51,7 +51,17 @@ jobs:
|
||||
dart --version
|
||||
flutter doctor
|
||||
|
||||
- name: Cache xcframework
|
||||
id: cache-xcframework
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: build-macos-shared-sherpa-with-static-onnxruntime/sherpa-onnx.xcframework
|
||||
key: macos-xcframework-${{ hashFiles('build-macos-shared-sherpa-with-static-onnxruntime.sh', 'CMakeLists.txt') }}
|
||||
restore-keys: |
|
||||
macos-xcframework-
|
||||
|
||||
- name: Build xcframework from source
|
||||
if: steps.cache-xcframework.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
@@ -61,8 +71,8 @@ jobs:
|
||||
- name: Copy xcframework
|
||||
shell: bash
|
||||
run: |
|
||||
cp -av build-macos-shared-sherpa-with-static-onnxruntime/sherpa-onnx.xcframework flutter/sherpa_onnx_macos/macos/sherpa_onnx_macos/SherpaOnnxC.xcframework
|
||||
ls -lh flutter/sherpa_onnx_macos/macos/sherpa_onnx_macos/SherpaOnnxC.xcframework/
|
||||
cp -av build-macos-shared-sherpa-with-static-onnxruntime/sherpa-onnx.xcframework flutter/sherpa_onnx_macos/macos/sherpa_onnx_macos/sherpa-onnx.xcframework
|
||||
ls -lh flutter/sherpa_onnx_macos/macos/sherpa_onnx_macos/sherpa-onnx.xcframework/
|
||||
|
||||
- name: Use local sherpa_onnx_macos
|
||||
shell: bash
|
||||
@@ -106,12 +116,14 @@ jobs:
|
||||
flutter config --no-enable-swift-package-manager
|
||||
flutter pub get
|
||||
cd macos && pod install && cd ..
|
||||
|
||||
- name: Build Flutter app
|
||||
shell: bash
|
||||
run: |
|
||||
cd flutter-examples/${{ matrix.demo }}
|
||||
export CODE_SIGNING_ALLOWED=NO
|
||||
# Debug: find where ffmpeg frameworks are
|
||||
echo "=== Searching for ffmpeg frameworks ==="
|
||||
find . -name "libswresample*" -type d 2>/dev/null || true
|
||||
find . -name "libswresample*" -type f 2>/dev/null || true
|
||||
find "$PUB_CACHE" -name "libswresample*" 2>/dev/null | head -10 || true
|
||||
find macos/Pods -name "libswresample*" 2>/dev/null | head -10 || true
|
||||
ls -la macos/Pods/ffmpeg_kit_flutter_new/ 2>/dev/null || true
|
||||
echo "=== End search ==="
|
||||
flutter build macos
|
||||
|
||||
ls -lh build/macos/Build/Products/Release/
|
||||
@@ -128,7 +140,7 @@ jobs:
|
||||
run: |
|
||||
cd flutter-examples/${{ matrix.demo }}/build/macos/Build/Products/Release/
|
||||
app_name=$(echo ${{ matrix.demo }} | tr '-' '_')
|
||||
zip -r flutter-${{ matrix.demo }}-macos.zip ${app_name}.app/
|
||||
zip -r -y flutter-${{ matrix.demo }}-macos.zip ${app_name}.app/
|
||||
ls -lh flutter-${{ matrix.demo }}-macos.zip
|
||||
|
||||
- name: Release
|
||||
@@ -263,7 +275,7 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
cd flutter-examples/${{ matrix.demo }}/build/linux/*/release/
|
||||
zip -r flutter-${{ matrix.demo }}-linux-x64.zip bundle/
|
||||
zip -r -y flutter-${{ matrix.demo }}-linux-x64.zip bundle/
|
||||
ls -lh flutter-${{ matrix.demo }}-linux-x64.zip
|
||||
|
||||
- name: Release
|
||||
@@ -620,9 +632,9 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
cd flutter-examples/${{ matrix.demo }}/build/
|
||||
mv web flutter-${{ matrix.demo }}
|
||||
zip -r flutter-${{ matrix.demo }}.zip flutter-${{ matrix.demo }}/
|
||||
ls -lh flutter-${{ matrix.demo }}.zip
|
||||
mv web flutter-${{ matrix.demo }}-web
|
||||
zip -r -y flutter-${{ matrix.demo }}-web.zip flutter-${{ matrix.demo }}-web/
|
||||
ls -lh flutter-${{ matrix.demo }}-web.zip
|
||||
|
||||
- name: Release
|
||||
if: github.repository_owner == 'csukuangfj'
|
||||
@@ -630,7 +642,7 @@ jobs:
|
||||
with:
|
||||
file_glob: true
|
||||
overwrite: true
|
||||
file: ./flutter-examples/${{ matrix.demo }}/build/flutter-${{ matrix.demo }}.zip
|
||||
file: ./flutter-examples/${{ matrix.demo }}/build/flutter-${{ matrix.demo }}-web.zip
|
||||
repo_name: k2-fsa/sherpa-onnx
|
||||
repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}
|
||||
tag: flutter
|
||||
|
||||
@@ -46,7 +46,17 @@ jobs:
|
||||
dart --version
|
||||
flutter doctor
|
||||
|
||||
- name: Cache xcframework
|
||||
id: cache-xcframework
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: build-macos-shared-sherpa-with-static-onnxruntime/sherpa-onnx.xcframework
|
||||
key: macos-xcframework-${{ hashFiles('build-macos-shared-sherpa-with-static-onnxruntime.sh', 'CMakeLists.txt') }}
|
||||
restore-keys: |
|
||||
macos-xcframework-
|
||||
|
||||
- name: Build xcframework from source
|
||||
if: steps.cache-xcframework.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
@@ -56,8 +66,8 @@ jobs:
|
||||
- name: Copy xcframework
|
||||
shell: bash
|
||||
run: |
|
||||
cp -av build-macos-shared-sherpa-with-static-onnxruntime/sherpa-onnx.xcframework flutter/sherpa_onnx_macos/macos/sherpa_onnx_macos/SherpaOnnxC.xcframework
|
||||
ls -lh flutter/sherpa_onnx_macos/macos/sherpa_onnx_macos/SherpaOnnxC.xcframework/
|
||||
cp -av build-macos-shared-sherpa-with-static-onnxruntime/sherpa-onnx.xcframework flutter/sherpa_onnx_macos/macos/sherpa_onnx_macos/sherpa-onnx.xcframework
|
||||
ls -lh flutter/sherpa_onnx_macos/macos/sherpa_onnx_macos/sherpa-onnx.xcframework/
|
||||
|
||||
- name: Use local sherpa_onnx_macos
|
||||
shell: bash
|
||||
@@ -94,7 +104,7 @@ jobs:
|
||||
cd flutter-examples/hello_world/build/macos/Build/Products/Release/
|
||||
mkdir -p flutter-hello-world-macos-cocoapods
|
||||
mv hello_world.app flutter-hello-world-macos-cocoapods/
|
||||
zip -r flutter-hello-world-macos-cocoapods.zip flutter-hello-world-macos-cocoapods/
|
||||
zip -r -y flutter-hello-world-macos-cocoapods.zip flutter-hello-world-macos-cocoapods/
|
||||
ls -lh flutter-hello-world-macos-cocoapods.zip
|
||||
|
||||
- name: Upload artifact
|
||||
@@ -137,7 +147,17 @@ jobs:
|
||||
dart --version
|
||||
flutter doctor
|
||||
|
||||
- name: Cache xcframework
|
||||
id: cache-xcframework
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: build-macos-shared-sherpa-with-static-onnxruntime/sherpa-onnx.xcframework
|
||||
key: macos-xcframework-${{ hashFiles('build-macos-shared-sherpa-with-static-onnxruntime.sh', 'CMakeLists.txt') }}
|
||||
restore-keys: |
|
||||
macos-xcframework-
|
||||
|
||||
- name: Build xcframework from source
|
||||
if: steps.cache-xcframework.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
@@ -147,8 +167,8 @@ jobs:
|
||||
- name: Copy xcframework
|
||||
shell: bash
|
||||
run: |
|
||||
cp -av build-macos-shared-sherpa-with-static-onnxruntime/sherpa-onnx.xcframework flutter/sherpa_onnx_macos/macos/sherpa_onnx_macos/SherpaOnnxC.xcframework
|
||||
ls -lh flutter/sherpa_onnx_macos/macos/sherpa_onnx_macos/SherpaOnnxC.xcframework/
|
||||
cp -av build-macos-shared-sherpa-with-static-onnxruntime/sherpa-onnx.xcframework flutter/sherpa_onnx_macos/macos/sherpa_onnx_macos/sherpa-onnx.xcframework
|
||||
ls -lh flutter/sherpa_onnx_macos/macos/sherpa_onnx_macos/sherpa-onnx.xcframework/
|
||||
|
||||
- name: Use local sherpa_onnx_macos
|
||||
shell: bash
|
||||
@@ -166,8 +186,11 @@ jobs:
|
||||
sed -i.bak 's|sherpa_onnx: ^1.13.5|sherpa_onnx:\n path: ../../flutter/sherpa_onnx|' pubspec.yaml
|
||||
rm -f pubspec.yaml.bak
|
||||
|
||||
flutter pub get
|
||||
flutter config --enable-swift-package-manager
|
||||
flutter pub get
|
||||
# Remove CocoaPods build phases from Xcode project
|
||||
cd macos && pod deintegrate && cd ..
|
||||
rm -f macos/Podfile macos/Podfile.lock
|
||||
flutter build macos
|
||||
|
||||
ls -lh build/macos/Build/Products/Release/
|
||||
@@ -184,7 +207,7 @@ jobs:
|
||||
cd flutter-examples/hello_world/build/macos/Build/Products/Release/
|
||||
mkdir -p flutter-hello-world-macos-spm
|
||||
mv hello_world.app flutter-hello-world-macos-spm/
|
||||
zip -r flutter-hello-world-macos-spm.zip flutter-hello-world-macos-spm/
|
||||
zip -r -y flutter-hello-world-macos-spm.zip flutter-hello-world-macos-spm/
|
||||
ls -lh flutter-hello-world-macos-spm.zip
|
||||
|
||||
- name: Upload artifact
|
||||
@@ -237,8 +260,8 @@ jobs:
|
||||
- name: Copy xcframework
|
||||
shell: bash
|
||||
run: |
|
||||
cp -av build-ios-shared-sherpa-with-static-onnxruntime/sherpa-onnx.xcframework flutter/sherpa_onnx_ios/ios/sherpa_onnx_ios/SherpaOnnxC.xcframework
|
||||
ls -lh flutter/sherpa_onnx_ios/ios/sherpa_onnx_ios/SherpaOnnxC.xcframework/
|
||||
cp -av build-ios-shared-sherpa-with-static-onnxruntime/sherpa-onnx.xcframework flutter/sherpa_onnx_ios/ios/sherpa_onnx_ios/sherpa-onnx.xcframework
|
||||
ls -lh flutter/sherpa_onnx_ios/ios/sherpa_onnx_ios/sherpa-onnx.xcframework/
|
||||
|
||||
- name: Use local sherpa_onnx_ios
|
||||
shell: bash
|
||||
@@ -313,8 +336,8 @@ jobs:
|
||||
- name: Copy xcframework
|
||||
shell: bash
|
||||
run: |
|
||||
cp -av build-ios-shared-sherpa-with-static-onnxruntime/sherpa-onnx.xcframework flutter/sherpa_onnx_ios/ios/sherpa_onnx_ios/SherpaOnnxC.xcframework
|
||||
ls -lh flutter/sherpa_onnx_ios/ios/sherpa_onnx_ios/SherpaOnnxC.xcframework/
|
||||
cp -av build-ios-shared-sherpa-with-static-onnxruntime/sherpa-onnx.xcframework flutter/sherpa_onnx_ios/ios/sherpa_onnx_ios/sherpa-onnx.xcframework
|
||||
ls -lh flutter/sherpa_onnx_ios/ios/sherpa_onnx_ios/sherpa-onnx.xcframework/
|
||||
|
||||
- name: Use local sherpa_onnx_ios
|
||||
shell: bash
|
||||
@@ -332,8 +355,11 @@ jobs:
|
||||
sed -i.bak 's|sherpa_onnx: ^1.13.5|sherpa_onnx:\n path: ../../flutter/sherpa_onnx|' pubspec.yaml
|
||||
rm -f pubspec.yaml.bak
|
||||
|
||||
flutter pub get
|
||||
flutter config --enable-swift-package-manager
|
||||
flutter pub get
|
||||
# Remove CocoaPods build phases from Xcode project
|
||||
cd ios && pod deintegrate && cd ..
|
||||
rm -f ios/Podfile ios/Podfile.lock
|
||||
flutter build ios --no-codesign
|
||||
|
||||
ls -lh build/ios/iphoneos/
|
||||
@@ -703,7 +729,7 @@ jobs:
|
||||
run: |
|
||||
cd flutter-examples/hello_world/build/
|
||||
mv web flutter-hello-world-web
|
||||
zip -r flutter-hello-world-web.zip flutter-hello-world-web/
|
||||
zip -r -y flutter-hello-world-web.zip flutter-hello-world-web/
|
||||
ls -lh flutter-hello-world-web.zip
|
||||
|
||||
- name: Upload artifact
|
||||
|
||||
@@ -227,6 +227,9 @@ PEOF
|
||||
|
||||
# Fix dylib install name
|
||||
install_name_tool -id @rpath/SherpaOnnxC.framework/SherpaOnnxC $fw_dir/SherpaOnnxC
|
||||
|
||||
# Ad-hoc sign the framework binary so Xcode can embed and re-sign it
|
||||
codesign --force --sign - $fw_dir/SherpaOnnxC
|
||||
}
|
||||
|
||||
create_framework ios-arm64/libsherpa-onnx-c-api.dylib ios-arm64
|
||||
|
||||
@@ -207,6 +207,9 @@ PEOF
|
||||
|
||||
# Fix dylib install name
|
||||
install_name_tool -id @rpath/SherpaOnnxC.framework/SherpaOnnxC $fw_dir/SherpaOnnxC
|
||||
|
||||
# Ad-hoc sign the framework binary so Xcode can embed and re-sign it
|
||||
codesign --force --sign - $fw_dir/SherpaOnnxC
|
||||
}
|
||||
|
||||
create_framework ios-arm64/libsherpa-onnx-c-api.dylib ios-arm64
|
||||
|
||||
@@ -3,20 +3,6 @@
|
||||
# This script builds a shared xcframework for macOS with onnxruntime
|
||||
# statically linked in. The resulting libsherpa-onnx-c-api.dylib is
|
||||
# self-contained and does NOT require a separate libonnxruntime.dylib.
|
||||
#
|
||||
# Differences from build-macos-shared.sh:
|
||||
# - build-macos-shared.sh produces a shared libsherpa-onnx-c-api.dylib that
|
||||
# DEPENDS on a separate libonnxruntime.dylib (downloaded via cmake at build time).
|
||||
# Users must ship both dylibs together.
|
||||
# - This script downloads the STATIC onnxruntime library (libonnxruntime.a) and
|
||||
# links it into libsherpa-onnx-c-api.dylib. The output is a single self-contained
|
||||
# dylib with no external onnxruntime dependency.
|
||||
#
|
||||
# When to use which:
|
||||
# - build-macos-shared.sh: when you want a smaller sherpa-onnx dylib and are OK
|
||||
# shipping onnxruntime separately (e.g., SPM with separate onnxruntime xcframework).
|
||||
# - This script: when you want a single dylib with everything included (e.g., for
|
||||
# Flutter pub.dev where fewer files and smaller total size matters).
|
||||
|
||||
set -ex
|
||||
|
||||
@@ -75,67 +61,26 @@ if otool -L ./install/lib/libsherpa-onnx-c-api.dylib | grep -q libonnxruntime; t
|
||||
fi
|
||||
echo "OK: onnxruntime is statically linked"
|
||||
|
||||
# Create a framework bundle (like onnxruntime does) so SPM can resolve the module
|
||||
FRAMEWORK_DIR=SherpaOnnxC.framework
|
||||
rm -rf $FRAMEWORK_DIR
|
||||
# Create xcframework with bare library (like merman).
|
||||
rm -rf sherpa-onnx.xcframework
|
||||
|
||||
mkdir -p $FRAMEWORK_DIR/Versions/A/Headers/sherpa-onnx/c-api
|
||||
mkdir -p $FRAMEWORK_DIR/Versions/A/Modules
|
||||
mkdir -p $FRAMEWORK_DIR/Versions/A/Resources
|
||||
# Fix dylib install name
|
||||
install_name_tool -id @rpath/libsherpa-onnx-c-api.dylib ./install/lib/libsherpa-onnx-c-api.dylib
|
||||
|
||||
# Binary
|
||||
cp install/lib/libsherpa-onnx-c-api.dylib $FRAMEWORK_DIR/Versions/A/SherpaOnnxC
|
||||
# Ad-hoc sign the dylib
|
||||
codesign --force --sign - ./install/lib/libsherpa-onnx-c-api.dylib
|
||||
|
||||
# Headers (preserve nested path for #include "sherpa-onnx/c-api/c-api.h")
|
||||
cp install/include/sherpa-onnx/c-api/c-api.h $FRAMEWORK_DIR/Versions/A/Headers/sherpa-onnx/c-api/
|
||||
|
||||
# Modulemap
|
||||
cat > $FRAMEWORK_DIR/Versions/A/Modules/module.modulemap << 'EOF'
|
||||
framework module SherpaOnnxC {
|
||||
# Create modulemap for SPM
|
||||
cat > ./install/include/module.modulemap << 'EOF'
|
||||
module SherpaOnnxC {
|
||||
header "sherpa-onnx/c-api/c-api.h"
|
||||
export *
|
||||
}
|
||||
EOF
|
||||
|
||||
# Info.plist
|
||||
cat > $FRAMEWORK_DIR/Versions/A/Resources/Info.plist << 'EOF'
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.k2-fsa.sherpa-onnx</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>SherpaOnnxC</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>SherpaOnnxC</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>20260810</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.13.5</string>
|
||||
</dict>
|
||||
</plist>
|
||||
EOF
|
||||
|
||||
# Versioned symlinks
|
||||
pushd $FRAMEWORK_DIR/Versions
|
||||
ln -sf A Current
|
||||
popd
|
||||
|
||||
ln -sf Versions/Current/SherpaOnnxC $FRAMEWORK_DIR/SherpaOnnxC
|
||||
ln -sf Versions/Current/Headers $FRAMEWORK_DIR/Headers
|
||||
ln -sf Versions/Current/Modules $FRAMEWORK_DIR/Modules
|
||||
ln -sf Versions/Current/Resources $FRAMEWORK_DIR/Resources
|
||||
|
||||
# Fix dylib install name to use framework-relative path
|
||||
install_name_tool -id @rpath/SherpaOnnxC.framework/Versions/A/SherpaOnnxC $FRAMEWORK_DIR/Versions/A/SherpaOnnxC
|
||||
|
||||
rm -rf sherpa-onnx.xcframework
|
||||
|
||||
xcodebuild -create-xcframework \
|
||||
-framework $FRAMEWORK_DIR \
|
||||
-library ./install/lib/libsherpa-onnx-c-api.dylib \
|
||||
-headers ./install/include \
|
||||
-output sherpa-onnx.xcframework
|
||||
|
||||
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ../CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
|
||||
|
||||
@@ -83,6 +83,9 @@ ln -sf Versions/Current/Resources $FRAMEWORK_DIR/Resources
|
||||
# Fix dylib install name to use framework-relative path
|
||||
install_name_tool -id @rpath/SherpaOnnxC.framework/Versions/A/SherpaOnnxC $FRAMEWORK_DIR/Versions/A/SherpaOnnxC
|
||||
|
||||
# Ad-hoc sign the framework binary so Xcode can embed and re-sign it
|
||||
codesign --force --sign - $FRAMEWORK_DIR/Versions/A/SherpaOnnxC
|
||||
|
||||
rm -rf sherpa-onnx.xcframework
|
||||
|
||||
xcodebuild -create-xcframework \
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
<false/>
|
||||
<key>com.apple.security.cs.allow-jit</key>
|
||||
<true/>
|
||||
<key>com.apple.security.network.server</key>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
<false/>
|
||||
<key>com.apple.security.files.user-selected.read-write</key>
|
||||
<true/>
|
||||
</dict>
|
||||
|
||||
@@ -7,6 +7,9 @@ import 'package:path_provider/path_provider.dart';
|
||||
|
||||
Future<void> playWavBytes(AudioPlayer player, Uint8List wavBytes) async {
|
||||
final dir = await getTemporaryDirectory();
|
||||
if (!await dir.exists()) {
|
||||
await dir.create(recursive: true);
|
||||
}
|
||||
final file =
|
||||
File('${dir.path}/tts_chunk_${DateTime.now().microsecondsSinceEpoch}.wav');
|
||||
await file.writeAsBytes(wavBytes);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
<false/>
|
||||
<key>com.apple.security.cs.allow-jit</key>
|
||||
<true/>
|
||||
<key>com.apple.security.network.server</key>
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>$(PRODUCT_COPYRIGHT)</string>
|
||||
<key>NSMicrophoneUsageDescription</key>
|
||||
<string>This app needs access to the microphone for voice activity detection.</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
<false/>
|
||||
<key>com.apple.security.device.audio-input</key>
|
||||
<true/>
|
||||
<key>com.apple.security.files.user-selected.read-write</key>
|
||||
|
||||
@@ -1,11 +1,80 @@
|
||||
# sherpa-onnx app example
|
||||
|
||||
## Flutter examples
|
||||
## Pre-built Flutter apps
|
||||
|
||||
Download pre-built Flutter apps for different platforms at
|
||||
https://github.com/k2-fsa/sherpa-onnx/releases/tag/flutter
|
||||
|
||||
### VAD from file
|
||||
|
||||
| Platform | File |
|
||||
|---|---|
|
||||
| Android (arm64-v8a) | `flutter-vad-from-file-arm64-v8a.apk` |
|
||||
| Android (armeabi-v7a) | `flutter-vad-from-file-armeabi-v7a.apk` |
|
||||
| Android (x86_64) | `flutter-vad-from-file-x86_64.apk` |
|
||||
| Linux (x64) | `flutter-vad-from-file-linux-x64.zip` |
|
||||
| Windows (x64) | `flutter-vad-from-file-win-x64.zip` |
|
||||
| Web | `flutter-vad-from-file-web.zip` |
|
||||
|
||||
### VAD from microphone
|
||||
|
||||
| Platform | File |
|
||||
|---|---|
|
||||
| Android (arm64-v8a) | `flutter-vad-from-microphone-arm64-v8a.apk` |
|
||||
| Android (armeabi-v7a) | `flutter-vad-from-microphone-armeabi-v7a.apk` |
|
||||
| Android (x86_64) | `flutter-vad-from-microphone-x86_64.apk` |
|
||||
| Linux (x64) | `flutter-vad-from-microphone-linux-x64.zip` |
|
||||
| macOS | `flutter-vad-from-microphone-macos.zip` |
|
||||
| Windows (x64) | `flutter-vad-from-microphone-win-x64.zip` |
|
||||
| Web | `flutter-vad-from-microphone-web.zip` |
|
||||
|
||||
### Offline punctuation restoration
|
||||
|
||||
| Platform | File |
|
||||
|---|---|
|
||||
| Android (arm64-v8a) | `flutter-offline-punctuation-arm64-v8a.apk` |
|
||||
| Android (armeabi-v7a) | `flutter-offline-punctuation-armeabi-v7a.apk` |
|
||||
| Android (x86_64) | `flutter-offline-punctuation-x86_64.apk` |
|
||||
| Linux (x64) | `flutter-offline-punctuation-linux-x64.zip` |
|
||||
| macOS | `flutter-offline-punctuation-macos.zip` |
|
||||
| Windows (x64) | `flutter-offline-punctuation-win-x64.zip` |
|
||||
| Web | `flutter-offline-punctuation-web.zip` |
|
||||
|
||||
### Online punctuation restoration
|
||||
|
||||
| Platform | File |
|
||||
|---|---|
|
||||
| Android (arm64-v8a) | `flutter-online-punctuation-arm64-v8a.apk` |
|
||||
| Android (armeabi-v7a) | `flutter-online-punctuation-armeabi-v7a.apk` |
|
||||
| Android (x86_64) | `flutter-online-punctuation-x86_64.apk` |
|
||||
| Linux (x64) | `flutter-online-punctuation-linux-x64.zip` |
|
||||
| macOS | `flutter-online-punctuation-macos.zip` |
|
||||
| Windows (x64) | `flutter-online-punctuation-win-x64.zip` |
|
||||
| Web | `flutter-online-punctuation-web.zip` |
|
||||
|
||||
## Web demos
|
||||
|
||||
Try the following demos directly in your browser:
|
||||
|
||||
| Demo | URL |
|
||||
|---|---|
|
||||
| VAD from file | https://modelscope.cn/studios/csukuangfj/wasm-vad-from-file |
|
||||
| VAD from microphone | https://modelscope.cn/studios/csukuangfj/wasm-vad-from-microphone |
|
||||
| Offline punctuation restoration | https://modelscope.cn/studios/csukuangfj/wasm-offline-punctuation |
|
||||
| Online punctuation restoration | https://modelscope.cn/studios/csukuangfj/wasm-online-punctuation |
|
||||
|
||||
## Flutter source code
|
||||
|
||||
| Functions | URL | Supported Platforms|
|
||||
|---|---|---|
|
||||
|Hello world (version info)| [Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/flutter-examples/hello_world)| Android, iOS, Linux, macOS, Windows, **Web**|
|
||||
|Streaming speech recognition| [Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/flutter-examples/streaming_asr)| Android, iOS, Linux, macOS, Windows|
|
||||
|Speech synthesis| [Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/flutter-examples/tts)| Android, iOS, Linux, macOS, Windows|
|
||||
|Non-streaming VAD + speech recognition| [Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/flutter-examples/non_streaming_vad_asr)| Android, iOS, Linux, macOS, Windows|
|
||||
|Text to speech| [Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/flutter-examples/tts)| Android, iOS, Linux, macOS, Windows, **Web**|
|
||||
|VAD from file| [Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/flutter-examples/vad-from-file)| Android, iOS, Linux, macOS, Windows, **Web**|
|
||||
|VAD from microphone| [Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/flutter-examples/vad-from-microphone)| Android, iOS, Linux, macOS, Windows, **Web**|
|
||||
|Offline punctuation restoration| [Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/flutter-examples/offline-punctuation)| Android, iOS, Linux, macOS, Windows, **Web**|
|
||||
|Online punctuation restoration| [Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/flutter-examples/online-punctuation)| Android, iOS, Linux, macOS, Windows, **Web**|
|
||||
|
||||
## Pure dart-examples
|
||||
|
||||
@@ -13,14 +82,18 @@ Hint: All of the following functions can be used in Flutter, even if some of the
|
||||
|
||||
| Functions | URL | Supported Platforms|
|
||||
|---|---|---|
|
||||
|Speaker diarization| [Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/dart-api-examples/speaker-diarization)| macOS, Windows, Linux|
|
||||
|Streaming speech recognition| [Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/dart-api-examples/streaming-asr)| macOS, Windows, Linux|
|
||||
|Non-Streaming speech recognition| [Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/dart-api-examples/non-streaming-asr)| macOS, Windows, Linux|
|
||||
|Text to speech| [Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/dart-api-examples/tts)| macOS, Windows, Linux|
|
||||
|Voice activity detection (VAD)| [Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/dart-api-examples/vad)| macOS, Windows, Linux|
|
||||
|Voice activity detection (VAD) with non-streaming speech recognition| [Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/dart-api-examples/vad-with-non-streaming-asr)| macOS, Windows, Linux|
|
||||
|VAD with non-streaming speech recognition| [Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/dart-api-examples/vad-with-non-streaming-asr)| macOS, Windows, Linux|
|
||||
|Speaker identification and verification| [Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/dart-api-examples/speaker-identification)| macOS, Windows, Linux|
|
||||
|Speaker diarization| [Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/dart-api-examples/speaker-diarization)| macOS, Windows, Linux|
|
||||
|Audio tagging| [Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/dart-api-examples/audio-tagging)| macOS, Windows, Linux|
|
||||
|Keyword spotter| [Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/dart-api-examples/keyword-spotter)| macOS, Windows, Linux|
|
||||
|Spoken language identification| [Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/dart-api-examples/spoken-language-identification)| macOS, Windows, Linux|
|
||||
|Add punctuations| [Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/dart-api-examples/add-punctuations)| macOS, Windows, Linux|
|
||||
|Speech enhancement/denoising| [Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/dart-api-examples/speech-enhancement-gtcrn) GTCRN and DPDFNet (`baseline`, `dpdfnet2`, `dpdfnet4`, `dpdfnet8` for 16 kHz ASR, `dpdfnet2_48khz_hr` for 48 kHz output)| macOS, Windows, Linux|
|
||||
|Speech enhancement (GTCRN)| [Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/dart-api-examples/speech-enhancement-gtcrn)| macOS, Windows, Linux|
|
||||
|Speech enhancement (DPDFNet)| [Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/dart-api-examples/speech-enhancement-dpdfnet)| macOS, Windows, Linux|
|
||||
|Streaming speech enhancement (GTCRN)| [Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/dart-api-examples/streaming-speech-enhancement-gtcrn)| macOS, Windows, Linux|
|
||||
|Streaming speech enhancement (DPDFNet)| [Address](https://github.com/k2-fsa/sherpa-onnx/tree/master/dart-api-examples/streaming-speech-enhancement-dpdfnet)| macOS, Windows, Linux|
|
||||
@@ -7,16 +7,16 @@ import 'sherpa_onnx_bindings.dart';
|
||||
DynamicLibrary loadDylib(String? path) {
|
||||
if (Platform.isMacOS) {
|
||||
if (path == null) {
|
||||
return DynamicLibrary.open('SherpaOnnxC.framework/SherpaOnnxC');
|
||||
return DynamicLibrary.process();
|
||||
} else {
|
||||
return DynamicLibrary.open(
|
||||
'$path/sherpa_onnx_macos/SherpaOnnxC.xcframework/macos-arm64_x86_64/SherpaOnnxC.framework/SherpaOnnxC',
|
||||
'$path/sherpa_onnx_macos/sherpa-onnx.xcframework/macos-arm64_x86_64/libsherpa-onnx-c-api.dylib',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (Platform.isIOS) {
|
||||
return DynamicLibrary.open('SherpaOnnxC.framework/SherpaOnnxC');
|
||||
return DynamicLibrary.process();
|
||||
}
|
||||
|
||||
if (Platform.isAndroid || Platform.isLinux) {
|
||||
|
||||
@@ -23,10 +23,7 @@ A new Flutter FFI plugin project.
|
||||
s.source = { :path => '.' }
|
||||
s.dependency 'Flutter'
|
||||
s.platform = :ios, '13.0'
|
||||
# The xcframework must be named SherpaOnnxC.xcframework (matching the framework
|
||||
# inside it) because CocoaPods derives the linker flag -framework <name> from
|
||||
# the xcframework filename.
|
||||
s.vendored_frameworks = 'sherpa_onnx_ios/SherpaOnnxC.xcframework'
|
||||
s.vendored_frameworks = 'sherpa_onnx_ios/sherpa-onnx.xcframework'
|
||||
|
||||
# Flutter.framework does not contain a i386 slice.
|
||||
s.pod_target_xcconfig = {
|
||||
|
||||
@@ -15,7 +15,7 @@ let package = Package(
|
||||
targets: [
|
||||
.binaryTarget(
|
||||
name: "SherpaOnnxC",
|
||||
path: "SherpaOnnxC.xcframework"
|
||||
path: "sherpa-onnx.xcframework"
|
||||
),
|
||||
.target(
|
||||
name: "sherpa_onnx_ios",
|
||||
|
||||
@@ -19,10 +19,9 @@ sherpa-onnx Flutter FFI plugin project.
|
||||
# `../src/*` so that the C sources can be shared among all target platforms.
|
||||
s.source = { :path => '.' }
|
||||
s.dependency 'FlutterMacOS'
|
||||
# The xcframework must be named SherpaOnnxC.xcframework (matching the framework
|
||||
# inside it) because CocoaPods derives the linker flag -framework <name> from
|
||||
# the xcframework filename.
|
||||
s.vendored_frameworks = 'sherpa_onnx_macos/SherpaOnnxC.xcframework'
|
||||
# The dylib lives inside the xcframework (single copy, no duplication).
|
||||
# CocoaPods embeds it; SPM resolves it from the same xcframework.
|
||||
s.vendored_libraries = 'sherpa_onnx_macos/sherpa-onnx.xcframework/macos-arm64_x86_64/libsherpa-onnx-c-api.dylib'
|
||||
|
||||
s.platform = :osx, '10.15'
|
||||
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
|
||||
|
||||
@@ -15,7 +15,7 @@ let package = Package(
|
||||
targets: [
|
||||
.binaryTarget(
|
||||
name: "SherpaOnnxC",
|
||||
path: "SherpaOnnxC.xcframework"
|
||||
path: "sherpa-onnx.xcframework"
|
||||
),
|
||||
.target(
|
||||
name: "sherpa_onnx_macos",
|
||||
|
||||
@@ -31,12 +31,21 @@ flutter:
|
||||
fileName: sherpa_onnx_web.dart
|
||||
|
||||
assets:
|
||||
- assets/sherpa-onnx-wasm-web.js
|
||||
- assets/sherpa-onnx-wasm-web.wasm
|
||||
- assets/sherpa-onnx-asr.js
|
||||
- assets/sherpa-onnx-tts.js
|
||||
- assets/sherpa-onnx-vad.js
|
||||
- assets/sherpa-onnx-kws.js
|
||||
- assets/sherpa-onnx-punctuation.js
|
||||
- assets/sherpa-onnx-speaker-diarization.js
|
||||
- assets/sherpa-onnx-speech-enhancement.js
|
||||
- path: assets/sherpa-onnx-wasm-web.js
|
||||
platforms: [web]
|
||||
- path: assets/sherpa-onnx-wasm-web.wasm
|
||||
platforms: [web]
|
||||
- path: assets/sherpa-onnx-asr.js
|
||||
platforms: [web]
|
||||
- path: assets/sherpa-onnx-tts.js
|
||||
platforms: [web]
|
||||
- path: assets/sherpa-onnx-vad.js
|
||||
platforms: [web]
|
||||
- path: assets/sherpa-onnx-kws.js
|
||||
platforms: [web]
|
||||
- path: assets/sherpa-onnx-punctuation.js
|
||||
platforms: [web]
|
||||
- path: assets/sherpa-onnx-speaker-diarization.js
|
||||
platforms: [web]
|
||||
- path: assets/sherpa-onnx-speech-enhancement.js
|
||||
platforms: [web]
|
||||
Reference in new issue
Block a user