Skip to content
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

Flutter plugin for OnnxRuntime via `dart:ffi` provides an easy, flexible, and fast Dart API to integrate Onnx models in flutter apps across mobile and desktop platforms.

| **Platform** | Android | iOS | Linux | macOS | Windows |
|-------------------|---------------|-----|-------|-------|---------|
| **Compatibility** | API level 21+ | * | * | * | * |
| **Architecture** | arm32/arm64 | * | * | * | * |
| **Platform** | Android | iOS | Linux | macOS | Windows |
|-------------------|---------|-----|-------|-------|---------|
| **Compatibility** | * | * | * | * | * |
| **Architecture** | * | * | * | * | * |

*: [Consistent with Flutter](https://docs.flutter.dev/reference/supported-platforms)

Expand Down
9 changes: 9 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ rootProject.allprojects {
repositories {
google()
mavenCentral()

flatDir {
dirs project(':onnxruntime').file('libs')
}
}
}

Expand Down Expand Up @@ -48,3 +52,8 @@ android {
minSdkVersion 21
}
}

dependencies {
implementation (name: 'onnxruntime-android-1.20.1', ext: 'aar')
implementation (name: 'onnxruntime-extensions-android-0.13.0', ext: 'aar')
}
Binary file added android/libs/onnxruntime-android-1.20.1.aar
Binary file not shown.
Binary file not shown.
Binary file not shown.
5 changes: 3 additions & 2 deletions ios/onnxruntime.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ OnnxRuntime plugin for Flutter apps.
s.source = { :path => '.' }
# s.source_files = 'Classes/**/*'
s.dependency 'Flutter'
s.dependency 'onnxruntime-objc', '1.15.1'
s.platform = :ios, '11.0'
s.dependency 'onnxruntime-objc', '1.20.0'
s.dependency 'onnxruntime-extensions-c', '0.13.0'
s.platform = :ios, '13.3'
s.static_framework = true

# Flutter.framework does not contain a i386 slice.
Expand Down
6 changes: 6 additions & 0 deletions src/build-scripts/build-android-extensions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

./prepare-extensions.sh

./tools/android/build_aar.py --output_dir build --config Release --mode build_aar --api_level 21 --sdk_path="$ANDROID_HOME/Sdk" --ndk_path="$ANDROID_HOME/Sdk/ndk/22.1.7171670"
# Output is ./build/aar_out/Release/com/microsoft/onnxruntime/onnxruntime-extensions-android/0.13.0/onnxruntime-extensions-android-0.13.0.aar
6 changes: 6 additions & 0 deletions src/build-scripts/build-android.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

./prepare.sh

python3 tools/android_custom_build/build_custom_android_package.py --onnxruntime_branch_or_tag v1.20.1 --build_settings tools/ci_build/github/android/default_full_aar_build_settings.json build
# Output is ./build/output/aar_out/Release/com/microsoft/onnxruntime/onnxruntime-android/1.20.1/onnxruntime-android-1.20.1.aar
9 changes: 9 additions & 0 deletions src/build-scripts/build-ios-extensions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

./prepare-extensions.sh

# Tests fail with xcode build system
rm cmake/ext_tests.cmake
touch cmake/ext_tests.cmake

python3 tools/ios/build_xcframework.py --output_dir build --mode build_xcframework --config Release --ios_deployment_target 13.3 --macos_deployment_target 16 -- --skip_tests --parallel
9 changes: 9 additions & 0 deletions src/build-scripts/build-ios.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

./prepare.sh

# We need to make minor tweaks in order to make this buildable
sed -i 's/"--apple_deploy_target=14.0"/"--apple_deploy_target=16.0"/' tools/ci_build/github/apple/default_full_ios_framework_build_settings.json
sed -i 's/"--apple_deploy_target=13.0"/"--apple_deploy_target=13.3"/' tools/ci_build/github/apple/default_full_ios_framework_build_settings.json

python3 tools/ci_build/github/apple/build_and_assemble_apple_pods.py --staging-dir build --build-settings-file tools/ci_build/github/apple/default_full_ios_framework_build_settings.json
14 changes: 14 additions & 0 deletions src/build-scripts/prepare-extensions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

dir_name="onnxruntime-extensions"
onnx_version=v0.13.0

if [ ! -d "$dir_name" ]; then
echo "Cloning onnxruntime-extensions..."
git clone https://github.com/microsoft/onnxruntime-extensions -b "$onnx_version" "$dir_name"

if [ ! $? -eq 0 ]; then
echo "Failed to clone the onnxruntime-extensions repository."
exit 1
fi
fi
14 changes: 14 additions & 0 deletions src/build-scripts/prepare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

dir_name="onnxruntime"
onnx_version=v1.20.1

if [ ! -d "$dir_name" ]; then
echo "Cloning onnxruntime..."
git clone https://github.com/microsoft/onnxruntime -b "$onnx_version" "$dir_name"

if [ ! $? -eq 0 ]; then
echo "Failed to clone the onnxruntime repository."
exit 1
fi
fi