Support the platform iOS for Flutter (#1079)
This commit is contained in:
@@ -15,20 +15,26 @@ flutter create --template plugin sherpa_onnx
|
||||
flutter create --template plugin_ffi --platforms macos sherpa_onnx_macos
|
||||
```
|
||||
|
||||
3. Create `sherpa_onnx_linux
|
||||
3. Create `sherpa_onnx_linux`
|
||||
|
||||
```bash
|
||||
flutter create --template plugin_ffi --platforms linux sherpa_onnx_linux
|
||||
```
|
||||
|
||||
4. Create `sherpa_onnx_windows
|
||||
4. Create `sherpa_onnx_windows`
|
||||
|
||||
```bash
|
||||
flutter create --template plugin_ffi --platforms linux sherpa_onnx_windows
|
||||
```
|
||||
|
||||
5. Create `sherpa_onnx_android
|
||||
5. Create `sherpa_onnx_android`
|
||||
|
||||
```bash
|
||||
flutter create --template plugin_ffi --platforms android --org com.k2fsa.sherpa.onnx sherpa_onnx_android
|
||||
```
|
||||
|
||||
6. Create `sherpa_onnx_ios`
|
||||
|
||||
```bash
|
||||
flutter create --template plugin_ffi --platforms ios sherpa_onnx_ios
|
||||
```
|
||||
|
||||
@@ -19,11 +19,9 @@ String? _path;
|
||||
|
||||
// see also
|
||||
// https://github.com/flutter/codelabs/blob/main/ffigen_codelab/step_05/lib/ffigen_app.dart
|
||||
// https://api.flutter.dev/flutter/dart-io/Platform-class.html
|
||||
final DynamicLibrary _dylib = () {
|
||||
if (Platform.isIOS) {
|
||||
throw UnsupportedError('Unknown platform: ${Platform.operatingSystem}');
|
||||
}
|
||||
if (Platform.isMacOS) {
|
||||
if (Platform.isMacOS || Platform.isIOS) {
|
||||
if (_path == null) {
|
||||
return DynamicLibrary.open('libsherpa-onnx-c-api.dylib');
|
||||
} else {
|
||||
|
||||
@@ -17,7 +17,7 @@ topics:
|
||||
- voice-activity-detection
|
||||
|
||||
# remember to change the version in ../sherpa_onnx_macos/macos/sherpa_onnx_macos.podspec
|
||||
version: 1.10.10
|
||||
version: 1.10.11
|
||||
|
||||
homepage: https://github.com/k2-fsa/sherpa-onnx
|
||||
|
||||
@@ -30,24 +30,31 @@ dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
sherpa_onnx_android: ^1.10.10
|
||||
sherpa_onnx_android: ^1.10.11
|
||||
# path: ../sherpa_onnx_android
|
||||
|
||||
sherpa_onnx_macos: ^1.10.10
|
||||
sherpa_onnx_macos: ^1.10.11
|
||||
# path: ../sherpa_onnx_macos
|
||||
|
||||
sherpa_onnx_linux: ^1.10.10
|
||||
sherpa_onnx_linux: ^1.10.11
|
||||
# path: ../sherpa_onnx_linux
|
||||
#
|
||||
sherpa_onnx_windows: ^1.10.10
|
||||
sherpa_onnx_windows: ^1.10.11
|
||||
# path: ../sherpa_onnx_windows
|
||||
|
||||
sherpa_onnx_ios: ^1.10.11
|
||||
# sherpa_onnx_ios:
|
||||
# path: ../sherpa_onnx_ios
|
||||
|
||||
flutter:
|
||||
plugin:
|
||||
platforms:
|
||||
android:
|
||||
default_package: sherpa_onnx_android
|
||||
|
||||
ios:
|
||||
default_package: sherpa_onnx_ios
|
||||
|
||||
macos:
|
||||
default_package: sherpa_onnx_macos
|
||||
|
||||
|
||||
29
flutter/sherpa_onnx_ios/.gitignore
vendored
Normal file
29
flutter/sherpa_onnx_ios/.gitignore
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
# Miscellaneous
|
||||
*.class
|
||||
*.log
|
||||
*.pyc
|
||||
*.swp
|
||||
.DS_Store
|
||||
.atom/
|
||||
.buildlog/
|
||||
.history
|
||||
.svn/
|
||||
migrate_working_dir/
|
||||
|
||||
# IntelliJ related
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
.idea/
|
||||
|
||||
# The .vscode folder contains launch configuration and tasks you configure in
|
||||
# VS Code which you may wish to be included in version control, so this line
|
||||
# is commented out by default.
|
||||
#.vscode/
|
||||
|
||||
# Flutter/Dart/Pub related
|
||||
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
|
||||
/pubspec.lock
|
||||
**/doc/api/
|
||||
.dart_tool/
|
||||
build/
|
||||
30
flutter/sherpa_onnx_ios/.metadata
Normal file
30
flutter/sherpa_onnx_ios/.metadata
Normal file
@@ -0,0 +1,30 @@
|
||||
# This file tracks properties of this Flutter project.
|
||||
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
||||
#
|
||||
# This file should be version controlled and should not be manually edited.
|
||||
|
||||
version:
|
||||
revision: "5dcb86f68f239346676ceb1ed1ea385bd215fba1"
|
||||
channel: "stable"
|
||||
|
||||
project_type: plugin_ffi
|
||||
|
||||
# Tracks metadata for the flutter migrate command
|
||||
migration:
|
||||
platforms:
|
||||
- platform: root
|
||||
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
|
||||
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
|
||||
- platform: ios
|
||||
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
|
||||
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
|
||||
|
||||
# User provided section
|
||||
|
||||
# List of Local paths (relative to this file) that should be
|
||||
# ignored by the migrate tool.
|
||||
#
|
||||
# Files that are not part of the templates will be ignored by default.
|
||||
unmanaged_files:
|
||||
- 'lib/main.dart'
|
||||
- 'ios/Runner.xcodeproj/project.pbxproj'
|
||||
7
flutter/sherpa_onnx_ios/README.md
Normal file
7
flutter/sherpa_onnx_ios/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# sherpa_onnx_linux
|
||||
|
||||
This is a sub project of [sherpa-onnx](https://github.com/k2-fsa/sherpa-onnx).
|
||||
|
||||
You are not expected to use this package directly.
|
||||
|
||||
Please see the entry point at <https://pub.dev/packages/sherpa_onnx>.
|
||||
4
flutter/sherpa_onnx_ios/analysis_options.yaml
Normal file
4
flutter/sherpa_onnx_ios/analysis_options.yaml
Normal file
@@ -0,0 +1,4 @@
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
# Additional information about this file can be found at
|
||||
# https://dart.dev/guides/language/analysis-options
|
||||
33
flutter/sherpa_onnx_ios/ios/sherpa_onnx_ios.podspec
Normal file
33
flutter/sherpa_onnx_ios/ios/sherpa_onnx_ios.podspec
Normal file
@@ -0,0 +1,33 @@
|
||||
#
|
||||
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
|
||||
# Run `pod lib lint sherpa_onnx_ios.podspec` to validate before publishing.
|
||||
#
|
||||
# See also
|
||||
# https://github.com/google/webcrypto.dart/blob/2010361a106d7a872d90e3dfebfed250e2ede609/ios/webcrypto.podspec#L23-L28
|
||||
# https://groups.google.com/g/dart-ffi/c/nUATMBy7r0c
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'sherpa_onnx_ios'
|
||||
s.version = '1.10.11'
|
||||
s.summary = 'A new Flutter FFI plugin project.'
|
||||
s.description = <<-DESC
|
||||
A new Flutter FFI plugin project.
|
||||
DESC
|
||||
s.homepage = 'https://github.com/k2-fsa/sherpa-onnx'
|
||||
s.license = { :file => '../LICENSE' }
|
||||
s.author = { 'Fangjun Kuang' => 'csukuangfj@gmail.com' }
|
||||
|
||||
# This will ensure the source files in Classes/ are included in the native
|
||||
# builds of apps using this FFI plugin. Podspec does not support relative
|
||||
# paths, so Classes contains a forwarder C file that relatively imports
|
||||
# `../src/*` so that the C sources can be shared among all target platforms.
|
||||
s.source = { :path => '.' }
|
||||
s.dependency 'Flutter'
|
||||
s.platform = :ios, '12.0'
|
||||
s.ios.vendored_libraries = '*.dylib', '*.a'
|
||||
|
||||
# Flutter.framework does not contain a i386 slice.
|
||||
s.pod_target_xcconfig = {
|
||||
'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386'
|
||||
}
|
||||
s.swift_version = '5.0'
|
||||
end
|
||||
3
flutter/sherpa_onnx_ios/lib/README.md
Normal file
3
flutter/sherpa_onnx_ios/lib/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Introduction
|
||||
|
||||
This directory is left empty intentionally.
|
||||
36
flutter/sherpa_onnx_ios/pubspec.yaml
Normal file
36
flutter/sherpa_onnx_ios/pubspec.yaml
Normal file
@@ -0,0 +1,36 @@
|
||||
name: sherpa_onnx_ios
|
||||
|
||||
description: >
|
||||
Speech recognition, speech synthesis, and speaker recognition using next-gen Kaldi
|
||||
with onnxruntime without Internet connection.
|
||||
|
||||
version: 0.0.1
|
||||
|
||||
repository: https://github.com/k2-fsa/sherpa-onnx/tree/master/flutter
|
||||
|
||||
issue_tracker: https://github.com/k2-fsa/sherpa-onnx/issues
|
||||
documentation: https://k2-fsa.github.io/sherpa/onnx/
|
||||
|
||||
homepage: https://github.com/k2-fsa/sherpa-onnx
|
||||
|
||||
topics:
|
||||
- speech-recognition
|
||||
- speech-synthesis
|
||||
- speaker-identification
|
||||
- audio-tagging
|
||||
- voice-activity-detection
|
||||
|
||||
environment:
|
||||
sdk: '>=3.4.0 <4.0.0'
|
||||
flutter: '>=3.3.0'
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
flutter:
|
||||
plugin:
|
||||
platforms:
|
||||
ios:
|
||||
ffiPlugin: true
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'sherpa_onnx_macos'
|
||||
s.version = '1.10.7'
|
||||
s.version = '1.10.11'
|
||||
s.summary = 'sherpa-onnx Flutter FFI plugin project.'
|
||||
s.description = <<-DESC
|
||||
sherpa-onnx Flutter FFI plugin project.
|
||||
|
||||
Reference in New Issue
Block a user