Use xcframework for Flutter iOS plugin. (#1547)

This commit is contained in:
Fangjun Kuang
2024-11-16 16:42:02 +08:00
committed by GitHub
parent e993c08538
commit 9a48012648
24 changed files with 216 additions and 49 deletions

View File

@@ -25,7 +25,7 @@ String? _path;
// 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.isMacOS || Platform.isIOS) {
if (Platform.isMacOS) {
if (_path == null) {
return DynamicLibrary.open('libsherpa-onnx-c-api.dylib');
} else {
@@ -33,6 +33,14 @@ final DynamicLibrary _dylib = () {
}
}
if (Platform.isIOS) {
if (_path == null) {
return DynamicLibrary.open('sherpa_onnx.framework/sherpa_onnx');
} else {
return DynamicLibrary.open('$_path/sherpa_onnx.framework/sherpa_onnx');
}
}
if (Platform.isAndroid || Platform.isLinux) {
if (_path == null) {
return DynamicLibrary.open('libsherpa-onnx-c-api.so');