diff --git a/README.md b/README.md index bb04dd0..882f198 100644 --- a/README.md +++ b/README.md @@ -70,10 +70,10 @@ Pre-built libraries are available on [NPM](https://www.npmjs.com/package/com.git } ] "dependencies": { - "com.github.asus4.onnxruntime": "0.3.3", - "com.github.asus4.onnxruntime.unity": "0.3.3", - "com.github.asus4.onnxruntime.win-x64-gpu": "0.3.3", - "com.github.asus4.onnxruntime-extensions": "0.3.3", + "com.github.asus4.onnxruntime": "0.3.4", + "com.github.asus4.onnxruntime.unity": "0.3.4", + "com.github.asus4.onnxruntime.win-x64-gpu": "0.3.4", + "com.github.asus4.onnxruntime-extensions": "0.3.4", ... other dependencies } ``` diff --git a/com.github.asus4.onnxruntime-extensions/Editor/OrtExtensionsPostProcessBuild.cs b/com.github.asus4.onnxruntime-extensions/Editor/OrtExtensionsPostProcessBuild.cs deleted file mode 100644 index 25326c3..0000000 --- a/com.github.asus4.onnxruntime-extensions/Editor/OrtExtensionsPostProcessBuild.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System.IO; -using UnityEngine; -using UnityEngine.Assertions; -using UnityEditor; -using UnityEditor.Build; -using UnityEditor.Build.Reporting; -#if UNITY_IOS -using UnityEditor.iOS.Xcode; -#endif // UNITY_IOS - -namespace Microsoft.ML.OnnxRuntime.Editor -{ - /// - /// Custom post-process build for ONNX Runtime Extensions - /// - public class OrtExtensionsPostProcessBuild : IPostprocessBuildWithReport - { - private const string PACKAGE_PATH = "Packages/com.github.asus4.onnxruntime-extensions"; - private const string FRAMEWORK_SRC = "Plugins/iOS~/onnxruntime_extensions.xcframework"; - private const string FRAMEWORK_DST = "Libraries/onnxruntime_extensions.xcframework"; - - public int callbackOrder => 0; - - public void OnPostprocessBuild(BuildReport report) - { - switch (report.summary.platform) - { - case BuildTarget.iOS: - PostprocessBuildIOS(report); - break; - case BuildTarget.Android: - // Nothing to do - break; - // TODO: Add support for other platforms - default: - Debug.Log("OnnxPostProcessBuild.OnPostprocessBuild for target " + report.summary.platform + " is not supported"); - break; - } - } - - private static void PostprocessBuildIOS(BuildReport report) - { -#if UNITY_IOS - string pbxProjectPath = PBXProject.GetPBXProjectPath(report.summary.outputPath); - PBXProject pbxProject = new(); - pbxProject.ReadFromFile(pbxProjectPath); - - // Copy XCFramework to the Xcode project folder - string frameworkSrcPath = Path.Combine(PACKAGE_PATH, FRAMEWORK_SRC); - string frameworkDstAbsPath = Path.Combine(report.summary.outputPath, FRAMEWORK_DST); - CopyDir(frameworkSrcPath, frameworkDstAbsPath); - - // Then add to Xcode project - string frameworkGuid = pbxProject.AddFile(frameworkDstAbsPath, FRAMEWORK_DST, PBXSourceTree.Source); - string targetGuid = pbxProject.GetUnityFrameworkTargetGuid(); - // Note: onnxruntime.xcframework should be linked in build section. Embed framework didn't work. - // pbxProject.AddFileToEmbedFrameworks(targetGuid, frameworkGuid); - string targetBuildPhaseGuid = pbxProject.AddFrameworksBuildPhase(targetGuid); - pbxProject.AddFileToBuildSection(targetGuid, targetBuildPhaseGuid, frameworkGuid); - - pbxProject.WriteToFile(pbxProjectPath); -#endif // UNITY_IOS - } - - private static void CopyDir(string srcPath, string dstPath) - { - srcPath = FileUtil.GetPhysicalPath(srcPath); - Assert.IsTrue(Directory.Exists(srcPath), $"Framework not found at {srcPath}"); - - if (Directory.Exists(dstPath)) - { - FileUtil.DeleteFileOrDirectory(dstPath); - } - FileUtil.CopyFileOrDirectory(srcPath, dstPath); - } - } -} diff --git a/com.github.asus4.onnxruntime-extensions/Editor/OrtExtensionsPostProcessBuild.cs.meta b/com.github.asus4.onnxruntime-extensions/Editor/OrtExtensionsPostProcessBuild.cs.meta deleted file mode 100644 index 3ee65d7..0000000 --- a/com.github.asus4.onnxruntime-extensions/Editor/OrtExtensionsPostProcessBuild.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: bcfbaa118c67742f99320871880d16b8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/com.github.asus4.onnxruntime-extensions/Editor/com.github.asus4.onnxruntime-extensions.Editor.asmdef b/com.github.asus4.onnxruntime-extensions/Editor/com.github.asus4.onnxruntime-extensions.Editor.asmdef deleted file mode 100644 index fa448f4..0000000 --- a/com.github.asus4.onnxruntime-extensions/Editor/com.github.asus4.onnxruntime-extensions.Editor.asmdef +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "com.github.asus4.onnxruntime-extensions.Editor", - "rootNamespace": "", - "references": [], - "includePlatforms": [ - "Editor" - ], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [], - "noEngineReferences": false -} \ No newline at end of file diff --git a/com.github.asus4.onnxruntime-extensions/Editor.meta b/com.github.asus4.onnxruntime-extensions/Plugins/iOS.meta similarity index 77% rename from com.github.asus4.onnxruntime-extensions/Editor.meta rename to com.github.asus4.onnxruntime-extensions/Plugins/iOS.meta index 1fb1f1f..dfa4cfb 100644 --- a/com.github.asus4.onnxruntime-extensions/Editor.meta +++ b/com.github.asus4.onnxruntime-extensions/Plugins/iOS.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: ac1b31fdca1554536a77600adfde4644 +guid: 97af16fc9e042428e8fef0574abf8e55 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/com.github.asus4.onnxruntime-extensions/Plugins/iOS/onnxruntime_extensions.xcframework.meta b/com.github.asus4.onnxruntime-extensions/Plugins/iOS/onnxruntime_extensions.xcframework.meta new file mode 100644 index 0000000..ab50936 --- /dev/null +++ b/com.github.asus4.onnxruntime-extensions/Plugins/iOS/onnxruntime_extensions.xcframework.meta @@ -0,0 +1,61 @@ +fileFormatVersion: 2 +guid: 0a69b76a3318945969f44982ae6444ac +PluginImporter: + externalObjects: {} + serializedVersion: 3 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + Android: + enabled: 0 + settings: + AndroidLibraryDependee: UnityLibrary + AndroidSharedLibraryType: Executable + CPU: ARMv7 + Any: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 1 + Exclude Linux64: 1 + Exclude OSXUniversal: 1 + Exclude Win: 1 + Exclude Win64: 1 + Exclude iOS: 0 + Editor: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + Linux64: + enabled: 0 + settings: + CPU: None + OSXUniversal: + enabled: 0 + settings: + CPU: None + Win: + enabled: 0 + settings: + CPU: None + Win64: + enabled: 0 + settings: + CPU: None + iOS: + enabled: 1 + settings: + AddToEmbeddedBinaries: false + CPU: AnyCPU + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.github.asus4.onnxruntime-extensions/README.md b/com.github.asus4.onnxruntime-extensions/README.md deleted file mode 100644 index 74b3a30..0000000 --- a/com.github.asus4.onnxruntime-extensions/README.md +++ /dev/null @@ -1,80 +0,0 @@ -# ONNX Runtime Plugin for Unity - -[![upm](https://img.shields.io/npm/v/com.github.asus4.onnxruntime?label=upm)](https://www.npmjs.com/package/com.github.asus4.onnxruntime) - -Pre-built ONNX Runtime libraries for Unity. - -## [See Examples](https://github.com/asus4/onnxruntime-unity-examples) - -[https://github.com/asus4/onnxruntime-unity-examples](https://github.com/asus4/onnxruntime-unity-examples) - - - -## Tested environment - -- Unity: 2022.3.16f1 (LTS) -- ONNX Runtime: 1.16.3 -- ONNX Runtime Extensions: 0.9.0 - -### Execution Providers & Extensions - -#### [Execution Providers](https://onnxruntime.ai/docs/execution-providers/) - -Execution Providers are hardware acceleration libraries for each platform. See [official docs](https://onnxruntime.ai/docs/execution-providers/) for more details. - -| Platform | CPU | CoreML | NNAPI | CUDA | TensorRT | DirectML | XNNPACK | -| --- | --- | --- | --- | --- | --- | --- | --- | -| macOS | :white_check_mark: | :white_check_mark: | | | | | | -| iOS | :white_check_mark: | :white_check_mark: | | | | | :construction: | -| Android | :white_check_mark: | | :white_check_mark: | | | | :construction: | -| Windows | :white_check_mark: | | | :construction: | :construction: | :white_check_mark: | | -| Linux | :white_check_mark: | | | :construction: | :construction: | | | - -#### [ONNX Runtime Extensions](https://github.com/microsoft/onnxruntime-extensions) - -ONNX Runtime Extensions are a set of pre/post-processing. - -| Platform | Extensions | -| --- | --- | -| macOS | :construction: | -| iOS | :construction: | -| Android | :construction: | -| Windows | :construction: | -| Linux | :construction: | - -:white_check_mark: : Supported in Unity Core library -:construction: : Experimental Preview - -## How to Install - -Pre-built libraries are available on [NPM](https://www.npmjs.com/package/com.github.asus4.onnxruntime). Add the following `scopedRegistries` and `dependencies` in `Packages/manifest.json`. - -```json - "scopedRegistries": [ - { - "name": "NPM", - "url": "https://registry.npmjs.com", - "scopes": [ - "com.github.asus4" - ] - } - ] - "dependencies": { - "com.github.asus4.onnxruntime": "0.3.3", - "com.github.asus4.onnxruntime.unity": "0.3.3", - "com.github.asus4.onnxruntime.win-x64-gpu": "0.3.3", - "com.github.asus4.onnxruntime.linux-x64-gpu": "0.3.3", - "com.github.asus4.onnxruntime.extensions": "0.3.3", - ... other dependencies - } -``` - -### What is included in each package - -- `com.github.asus4.onnxruntime` : Core library - - CPU provider for all platforms - - GPU provider for iOS, Android, macOS and Windows(only DirectML) -- `com.github.asus4.onnxruntime.unity` : (Optional) Utilities for Unity -- `com.github.asus4.onnxruntime.win-x64-gpu` : (Optional) GPU provider for Windows -- `com.github.asus4.onnxruntime.linux-x64-gpu` : (Optional) GPU provider for Linux -- `com.github.asus4.onnxruntime.extensions` : (Optional) ONNX Runtime Extensions diff --git a/com.github.asus4.onnxruntime-extensions/package.json b/com.github.asus4.onnxruntime-extensions/package.json index 759659c..93b6228 100644 --- a/com.github.asus4.onnxruntime-extensions/package.json +++ b/com.github.asus4.onnxruntime-extensions/package.json @@ -1,6 +1,6 @@ { "name": "com.github.asus4.onnxruntime-extensions", - "version": "0.3.3", + "version": "0.3.4", "displayName": "ONNX Runtime Extensions", "description": "ONNX Runtime Extensions for Unity", "keywords": [ @@ -10,7 +10,7 @@ "unity": "2022.3", "unityRelease": "0f1", "dependencies": { - "com.github.asus4.onnxruntime": "0.3.3" + "com.github.asus4.onnxruntime": "0.3.4" }, "repository": { "type": "git", diff --git a/com.github.asus4.onnxruntime-genai/package.json b/com.github.asus4.onnxruntime-genai/package.json index eaddc84..c16edb9 100644 --- a/com.github.asus4.onnxruntime-genai/package.json +++ b/com.github.asus4.onnxruntime-genai/package.json @@ -1,6 +1,6 @@ { "name": "com.github.asus4.onnxruntime-genai", - "version": "0.3.3", + "version": "0.3.4", "displayName": "ONNX Runtime GenAI", "description": "ONNX Runtime Generative AI for Unity", "keywords": [ @@ -10,7 +10,7 @@ "unity": "2022.3", "unityRelease": "0f1", "dependencies": { - "com.github.asus4.onnxruntime": "0.3.3" + "com.github.asus4.onnxruntime": "0.3.4" }, "repository": { "type": "git", diff --git a/com.github.asus4.onnxruntime.linux-x64-gpu/README.md b/com.github.asus4.onnxruntime.linux-x64-gpu/README.md deleted file mode 100644 index 74b3a30..0000000 --- a/com.github.asus4.onnxruntime.linux-x64-gpu/README.md +++ /dev/null @@ -1,80 +0,0 @@ -# ONNX Runtime Plugin for Unity - -[![upm](https://img.shields.io/npm/v/com.github.asus4.onnxruntime?label=upm)](https://www.npmjs.com/package/com.github.asus4.onnxruntime) - -Pre-built ONNX Runtime libraries for Unity. - -## [See Examples](https://github.com/asus4/onnxruntime-unity-examples) - -[https://github.com/asus4/onnxruntime-unity-examples](https://github.com/asus4/onnxruntime-unity-examples) - - - -## Tested environment - -- Unity: 2022.3.16f1 (LTS) -- ONNX Runtime: 1.16.3 -- ONNX Runtime Extensions: 0.9.0 - -### Execution Providers & Extensions - -#### [Execution Providers](https://onnxruntime.ai/docs/execution-providers/) - -Execution Providers are hardware acceleration libraries for each platform. See [official docs](https://onnxruntime.ai/docs/execution-providers/) for more details. - -| Platform | CPU | CoreML | NNAPI | CUDA | TensorRT | DirectML | XNNPACK | -| --- | --- | --- | --- | --- | --- | --- | --- | -| macOS | :white_check_mark: | :white_check_mark: | | | | | | -| iOS | :white_check_mark: | :white_check_mark: | | | | | :construction: | -| Android | :white_check_mark: | | :white_check_mark: | | | | :construction: | -| Windows | :white_check_mark: | | | :construction: | :construction: | :white_check_mark: | | -| Linux | :white_check_mark: | | | :construction: | :construction: | | | - -#### [ONNX Runtime Extensions](https://github.com/microsoft/onnxruntime-extensions) - -ONNX Runtime Extensions are a set of pre/post-processing. - -| Platform | Extensions | -| --- | --- | -| macOS | :construction: | -| iOS | :construction: | -| Android | :construction: | -| Windows | :construction: | -| Linux | :construction: | - -:white_check_mark: : Supported in Unity Core library -:construction: : Experimental Preview - -## How to Install - -Pre-built libraries are available on [NPM](https://www.npmjs.com/package/com.github.asus4.onnxruntime). Add the following `scopedRegistries` and `dependencies` in `Packages/manifest.json`. - -```json - "scopedRegistries": [ - { - "name": "NPM", - "url": "https://registry.npmjs.com", - "scopes": [ - "com.github.asus4" - ] - } - ] - "dependencies": { - "com.github.asus4.onnxruntime": "0.3.3", - "com.github.asus4.onnxruntime.unity": "0.3.3", - "com.github.asus4.onnxruntime.win-x64-gpu": "0.3.3", - "com.github.asus4.onnxruntime.linux-x64-gpu": "0.3.3", - "com.github.asus4.onnxruntime.extensions": "0.3.3", - ... other dependencies - } -``` - -### What is included in each package - -- `com.github.asus4.onnxruntime` : Core library - - CPU provider for all platforms - - GPU provider for iOS, Android, macOS and Windows(only DirectML) -- `com.github.asus4.onnxruntime.unity` : (Optional) Utilities for Unity -- `com.github.asus4.onnxruntime.win-x64-gpu` : (Optional) GPU provider for Windows -- `com.github.asus4.onnxruntime.linux-x64-gpu` : (Optional) GPU provider for Linux -- `com.github.asus4.onnxruntime.extensions` : (Optional) ONNX Runtime Extensions diff --git a/com.github.asus4.onnxruntime.linux-x64-gpu/package.json b/com.github.asus4.onnxruntime.linux-x64-gpu/package.json index c195963..98968e2 100644 --- a/com.github.asus4.onnxruntime.linux-x64-gpu/package.json +++ b/com.github.asus4.onnxruntime.linux-x64-gpu/package.json @@ -1,6 +1,6 @@ { "name": "com.github.asus4.onnxruntime.linux-x64-gpu", - "version": "0.3.3", + "version": "0.3.4", "displayName": "ONNX Runtime - Linux x64 GPU", "description": "ONNX Runtime for Unity - Linux x64 GPU Provider", "keywords": [ @@ -10,7 +10,7 @@ "unity": "2022.3", "unityRelease": "0f1", "dependencies": { - "com.github.asus4.onnxruntime": "0.3.3" + "com.github.asus4.onnxruntime": "0.3.4" }, "repository": { "type": "git", diff --git a/com.github.asus4.onnxruntime.unity/README.md b/com.github.asus4.onnxruntime.unity/README.md deleted file mode 100644 index 74b3a30..0000000 --- a/com.github.asus4.onnxruntime.unity/README.md +++ /dev/null @@ -1,80 +0,0 @@ -# ONNX Runtime Plugin for Unity - -[![upm](https://img.shields.io/npm/v/com.github.asus4.onnxruntime?label=upm)](https://www.npmjs.com/package/com.github.asus4.onnxruntime) - -Pre-built ONNX Runtime libraries for Unity. - -## [See Examples](https://github.com/asus4/onnxruntime-unity-examples) - -[https://github.com/asus4/onnxruntime-unity-examples](https://github.com/asus4/onnxruntime-unity-examples) - - - -## Tested environment - -- Unity: 2022.3.16f1 (LTS) -- ONNX Runtime: 1.16.3 -- ONNX Runtime Extensions: 0.9.0 - -### Execution Providers & Extensions - -#### [Execution Providers](https://onnxruntime.ai/docs/execution-providers/) - -Execution Providers are hardware acceleration libraries for each platform. See [official docs](https://onnxruntime.ai/docs/execution-providers/) for more details. - -| Platform | CPU | CoreML | NNAPI | CUDA | TensorRT | DirectML | XNNPACK | -| --- | --- | --- | --- | --- | --- | --- | --- | -| macOS | :white_check_mark: | :white_check_mark: | | | | | | -| iOS | :white_check_mark: | :white_check_mark: | | | | | :construction: | -| Android | :white_check_mark: | | :white_check_mark: | | | | :construction: | -| Windows | :white_check_mark: | | | :construction: | :construction: | :white_check_mark: | | -| Linux | :white_check_mark: | | | :construction: | :construction: | | | - -#### [ONNX Runtime Extensions](https://github.com/microsoft/onnxruntime-extensions) - -ONNX Runtime Extensions are a set of pre/post-processing. - -| Platform | Extensions | -| --- | --- | -| macOS | :construction: | -| iOS | :construction: | -| Android | :construction: | -| Windows | :construction: | -| Linux | :construction: | - -:white_check_mark: : Supported in Unity Core library -:construction: : Experimental Preview - -## How to Install - -Pre-built libraries are available on [NPM](https://www.npmjs.com/package/com.github.asus4.onnxruntime). Add the following `scopedRegistries` and `dependencies` in `Packages/manifest.json`. - -```json - "scopedRegistries": [ - { - "name": "NPM", - "url": "https://registry.npmjs.com", - "scopes": [ - "com.github.asus4" - ] - } - ] - "dependencies": { - "com.github.asus4.onnxruntime": "0.3.3", - "com.github.asus4.onnxruntime.unity": "0.3.3", - "com.github.asus4.onnxruntime.win-x64-gpu": "0.3.3", - "com.github.asus4.onnxruntime.linux-x64-gpu": "0.3.3", - "com.github.asus4.onnxruntime.extensions": "0.3.3", - ... other dependencies - } -``` - -### What is included in each package - -- `com.github.asus4.onnxruntime` : Core library - - CPU provider for all platforms - - GPU provider for iOS, Android, macOS and Windows(only DirectML) -- `com.github.asus4.onnxruntime.unity` : (Optional) Utilities for Unity -- `com.github.asus4.onnxruntime.win-x64-gpu` : (Optional) GPU provider for Windows -- `com.github.asus4.onnxruntime.linux-x64-gpu` : (Optional) GPU provider for Linux -- `com.github.asus4.onnxruntime.extensions` : (Optional) ONNX Runtime Extensions diff --git a/com.github.asus4.onnxruntime.unity/package.json b/com.github.asus4.onnxruntime.unity/package.json index 3a2ae74..e47f56f 100644 --- a/com.github.asus4.onnxruntime.unity/package.json +++ b/com.github.asus4.onnxruntime.unity/package.json @@ -1,6 +1,6 @@ { "name": "com.github.asus4.onnxruntime.unity", - "version": "0.3.3", + "version": "0.3.4", "displayName": "ONNX Runtime Unity Utilities", "description": "ONNX Runtime Utilities for Unity", "keywords": [ @@ -10,7 +10,7 @@ "unity": "2022.3", "unityRelease": "0f1", "dependencies": { - "com.github.asus4.onnxruntime": "0.3.3" + "com.github.asus4.onnxruntime": "0.3.4" }, "repository": { "type": "git", diff --git a/com.github.asus4.onnxruntime.win-x64-gpu/README.md b/com.github.asus4.onnxruntime.win-x64-gpu/README.md deleted file mode 100644 index 74b3a30..0000000 --- a/com.github.asus4.onnxruntime.win-x64-gpu/README.md +++ /dev/null @@ -1,80 +0,0 @@ -# ONNX Runtime Plugin for Unity - -[![upm](https://img.shields.io/npm/v/com.github.asus4.onnxruntime?label=upm)](https://www.npmjs.com/package/com.github.asus4.onnxruntime) - -Pre-built ONNX Runtime libraries for Unity. - -## [See Examples](https://github.com/asus4/onnxruntime-unity-examples) - -[https://github.com/asus4/onnxruntime-unity-examples](https://github.com/asus4/onnxruntime-unity-examples) - - - -## Tested environment - -- Unity: 2022.3.16f1 (LTS) -- ONNX Runtime: 1.16.3 -- ONNX Runtime Extensions: 0.9.0 - -### Execution Providers & Extensions - -#### [Execution Providers](https://onnxruntime.ai/docs/execution-providers/) - -Execution Providers are hardware acceleration libraries for each platform. See [official docs](https://onnxruntime.ai/docs/execution-providers/) for more details. - -| Platform | CPU | CoreML | NNAPI | CUDA | TensorRT | DirectML | XNNPACK | -| --- | --- | --- | --- | --- | --- | --- | --- | -| macOS | :white_check_mark: | :white_check_mark: | | | | | | -| iOS | :white_check_mark: | :white_check_mark: | | | | | :construction: | -| Android | :white_check_mark: | | :white_check_mark: | | | | :construction: | -| Windows | :white_check_mark: | | | :construction: | :construction: | :white_check_mark: | | -| Linux | :white_check_mark: | | | :construction: | :construction: | | | - -#### [ONNX Runtime Extensions](https://github.com/microsoft/onnxruntime-extensions) - -ONNX Runtime Extensions are a set of pre/post-processing. - -| Platform | Extensions | -| --- | --- | -| macOS | :construction: | -| iOS | :construction: | -| Android | :construction: | -| Windows | :construction: | -| Linux | :construction: | - -:white_check_mark: : Supported in Unity Core library -:construction: : Experimental Preview - -## How to Install - -Pre-built libraries are available on [NPM](https://www.npmjs.com/package/com.github.asus4.onnxruntime). Add the following `scopedRegistries` and `dependencies` in `Packages/manifest.json`. - -```json - "scopedRegistries": [ - { - "name": "NPM", - "url": "https://registry.npmjs.com", - "scopes": [ - "com.github.asus4" - ] - } - ] - "dependencies": { - "com.github.asus4.onnxruntime": "0.3.3", - "com.github.asus4.onnxruntime.unity": "0.3.3", - "com.github.asus4.onnxruntime.win-x64-gpu": "0.3.3", - "com.github.asus4.onnxruntime.linux-x64-gpu": "0.3.3", - "com.github.asus4.onnxruntime.extensions": "0.3.3", - ... other dependencies - } -``` - -### What is included in each package - -- `com.github.asus4.onnxruntime` : Core library - - CPU provider for all platforms - - GPU provider for iOS, Android, macOS and Windows(only DirectML) -- `com.github.asus4.onnxruntime.unity` : (Optional) Utilities for Unity -- `com.github.asus4.onnxruntime.win-x64-gpu` : (Optional) GPU provider for Windows -- `com.github.asus4.onnxruntime.linux-x64-gpu` : (Optional) GPU provider for Linux -- `com.github.asus4.onnxruntime.extensions` : (Optional) ONNX Runtime Extensions diff --git a/com.github.asus4.onnxruntime.win-x64-gpu/package.json b/com.github.asus4.onnxruntime.win-x64-gpu/package.json index 97ac148..f44cbb5 100644 --- a/com.github.asus4.onnxruntime.win-x64-gpu/package.json +++ b/com.github.asus4.onnxruntime.win-x64-gpu/package.json @@ -1,6 +1,6 @@ { "name": "com.github.asus4.onnxruntime.win-x64-gpu", - "version": "0.3.3", + "version": "0.3.4", "displayName": "ONNX Runtime - Windows x64 GPU", "description": "ONNX Runtime for Unity - Windows x64 GPU Provider", "keywords": [ @@ -10,7 +10,7 @@ "unity": "2022.3", "unityRelease": "0f1", "dependencies": { - "com.github.asus4.onnxruntime": "0.3.3" + "com.github.asus4.onnxruntime": "0.3.4" }, "repository": { "type": "git", diff --git a/com.github.asus4.onnxruntime/Editor/OrtPostProcessBuild.cs b/com.github.asus4.onnxruntime/Editor/OrtPostProcessBuild.cs deleted file mode 100644 index 03c3d99..0000000 --- a/com.github.asus4.onnxruntime/Editor/OrtPostProcessBuild.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System.IO; -using UnityEngine; -using UnityEngine.Assertions; -using UnityEditor; -using UnityEditor.Build; -using UnityEditor.Build.Reporting; -#if UNITY_IOS -using UnityEditor.iOS.Xcode; -#endif // UNITY_IOS - -namespace Microsoft.ML.OnnxRuntime.Editor -{ - /// - /// Custom post-process build for ONNX Runtime - /// - public class OrtPostProcessBuild : IPostprocessBuildWithReport - { - private const string PACKAGE_PATH = "Packages/com.github.asus4.onnxruntime"; - private const string FRAMEWORK_SRC = "Plugins/iOS~/onnxruntime.xcframework"; - private const string FRAMEWORK_DST = "Libraries/onnxruntime.xcframework"; - - public int callbackOrder => 0; - - public void OnPostprocessBuild(BuildReport report) - { - switch (report.summary.platform) - { - case BuildTarget.iOS: - PostprocessBuildIOS(report); - break; - case BuildTarget.Android: - // Nothing to do - break; - // TODO: Add support for other platforms - default: - Debug.Log("OnnxPostProcessBuild.OnPostprocessBuild for target " + report.summary.platform + " is not supported"); - break; - } - } - - private static void PostprocessBuildIOS(BuildReport report) - { -#if UNITY_IOS - string pbxProjectPath = PBXProject.GetPBXProjectPath(report.summary.outputPath); - PBXProject pbxProject = new(); - pbxProject.ReadFromFile(pbxProjectPath); - - // Copy XCFramework to the Xcode project folder - string frameworkSrcPath = Path.Combine(PACKAGE_PATH, FRAMEWORK_SRC); - string frameworkDstAbsPath = Path.Combine(report.summary.outputPath, FRAMEWORK_DST); - CopyDir(frameworkSrcPath, frameworkDstAbsPath); - - // Then add to Xcode project - string frameworkGuid = pbxProject.AddFile(frameworkDstAbsPath, FRAMEWORK_DST, PBXSourceTree.Source); - string targetGuid = pbxProject.GetUnityFrameworkTargetGuid(); - // Note: onnxruntime.xcframework should be linked in build section. Embed framework didn't work. - // pbxProject.AddFileToEmbedFrameworks(targetGuid, frameworkGuid); - string targetBuildPhaseGuid = pbxProject.AddFrameworksBuildPhase(targetGuid); - pbxProject.AddFileToBuildSection(targetGuid, targetBuildPhaseGuid, frameworkGuid); - - pbxProject.WriteToFile(pbxProjectPath); -#endif // UNITY_IOS - } - - private static void CopyDir(string srcPath, string dstPath) - { - srcPath = FileUtil.GetPhysicalPath(srcPath); - Assert.IsTrue(Directory.Exists(srcPath), $"Framework not found at {srcPath}"); - - if (Directory.Exists(dstPath)) - { - FileUtil.DeleteFileOrDirectory(dstPath); - } - FileUtil.CopyFileOrDirectory(srcPath, dstPath); - } - } -} diff --git a/com.github.asus4.onnxruntime/Editor/OrtPostProcessBuild.cs.meta b/com.github.asus4.onnxruntime/Editor/OrtPostProcessBuild.cs.meta deleted file mode 100644 index 313de49..0000000 --- a/com.github.asus4.onnxruntime/Editor/OrtPostProcessBuild.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e487cab40ce8f4fce81e6f71b6185d49 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/com.github.asus4.onnxruntime/Editor/com.github.asus4.onnxruntime.Editor.asmdef b/com.github.asus4.onnxruntime/Editor/com.github.asus4.onnxruntime.Editor.asmdef deleted file mode 100644 index f018c76..0000000 --- a/com.github.asus4.onnxruntime/Editor/com.github.asus4.onnxruntime.Editor.asmdef +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "com.github.asus4.onnxruntime.Editor", - "rootNamespace": "", - "references": [], - "includePlatforms": [ - "Editor" - ], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [], - "noEngineReferences": false -} \ No newline at end of file diff --git a/com.github.asus4.onnxruntime/Plugins/Android/onnxruntime-android.aar.meta b/com.github.asus4.onnxruntime/Plugins/Android/onnxruntime.aar.meta similarity index 100% rename from com.github.asus4.onnxruntime/Plugins/Android/onnxruntime-android.aar.meta rename to com.github.asus4.onnxruntime/Plugins/Android/onnxruntime.aar.meta diff --git a/com.github.asus4.onnxruntime/Plugins/Linux/x64/libonnxruntime.so.meta b/com.github.asus4.onnxruntime/Plugins/Linux/x64/libonnxruntime.so.meta index c173366..440b76f 100644 --- a/com.github.asus4.onnxruntime/Plugins/Linux/x64/libonnxruntime.so.meta +++ b/com.github.asus4.onnxruntime/Plugins/Linux/x64/libonnxruntime.so.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: b27b30e4e87554214b41504abd9a3755 PluginImporter: externalObjects: {} - serializedVersion: 2 + serializedVersion: 3 iconMap: {} executionOrder: {} defineConstraints: [] @@ -11,65 +11,45 @@ PluginImporter: isExplicitlyReferenced: 0 validateReferences: 1 platformData: - - first: - : Any - second: + Android: + enabled: 0 + settings: + AndroidLibraryDependee: UnityLibrary + AndroidSharedLibraryType: Executable + CPU: ARMv7 + Any: enabled: 0 settings: Exclude Android: 1 Exclude Editor: 0 Exclude Linux64: 0 - Exclude OSXUniversal: 0 + Exclude OSXUniversal: 1 Exclude Win: 0 Exclude Win64: 0 Exclude iOS: 1 - - first: - Android: Android - second: - enabled: 0 - settings: - AndroidSharedLibraryType: Executable - CPU: ARMv7 - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: + Editor: enabled: 1 settings: CPU: x86_64 DefaultValueInitialized: true OS: Linux - - first: - Standalone: Linux64 - second: + Linux64: enabled: 1 settings: CPU: AnyCPU - - first: - Standalone: OSXUniversal - second: - enabled: 1 + OSXUniversal: + enabled: 0 settings: - CPU: AnyCPU - - first: - Standalone: Win - second: + CPU: None + Win: enabled: 1 settings: CPU: AnyCPU - - first: - Standalone: Win64 - second: + Win64: enabled: 1 settings: CPU: AnyCPU - - first: - iPhone: iOS - second: + iOS: enabled: 0 settings: AddToEmbeddedBinaries: false diff --git a/com.github.asus4.onnxruntime/Editor.meta b/com.github.asus4.onnxruntime/Plugins/Windows/arm64.meta similarity index 77% rename from com.github.asus4.onnxruntime/Editor.meta rename to com.github.asus4.onnxruntime/Plugins/Windows/arm64.meta index a01cace..c756d9b 100644 --- a/com.github.asus4.onnxruntime/Editor.meta +++ b/com.github.asus4.onnxruntime/Plugins/Windows/arm64.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0a14dd0bc96f84c139228fb7dfa5c824 +guid: 6894ed7dde13749a697ae4fd202bb867 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/com.github.asus4.onnxruntime/Plugins/Windows/arm64/onnxruntime.dll.meta b/com.github.asus4.onnxruntime/Plugins/Windows/arm64/onnxruntime.dll.meta new file mode 100644 index 0000000..a40c3c5 --- /dev/null +++ b/com.github.asus4.onnxruntime/Plugins/Windows/arm64/onnxruntime.dll.meta @@ -0,0 +1,65 @@ +fileFormatVersion: 2 +guid: 02ed5287ee9c84ec48102a291c5c41f6 +PluginImporter: + externalObjects: {} + serializedVersion: 3 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + Android: + enabled: 0 + settings: + AndroidLibraryDependee: UnityLibrary + AndroidSharedLibraryType: Executable + CPU: ARMv7 + Any: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 0 + Exclude Linux64: 1 + Exclude OSXUniversal: 1 + Exclude Win: 1 + Exclude Win64: 0 + Exclude iOS: 1 + Editor: + enabled: 1 + settings: + CPU: ARM64 + DefaultValueInitialized: true + OS: Windows + Linux64: + enabled: 0 + settings: + CPU: x86_64 + OSXUniversal: + enabled: 0 + settings: + CPU: None + Win: + enabled: 0 + settings: + CPU: None + Win64: + enabled: 1 + settings: + CPU: ARM64 + WindowsStoreApps: + enabled: 0 + settings: + CPU: ARM64 + iOS: + enabled: 0 + settings: + AddToEmbeddedBinaries: false + CPU: AnyCPU + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.github.asus4.onnxruntime/Plugins/Windows/x64/onnxruntime.dll.meta b/com.github.asus4.onnxruntime/Plugins/Windows/x64/onnxruntime.dll.meta index 67de8a2..91ee787 100644 --- a/com.github.asus4.onnxruntime/Plugins/Windows/x64/onnxruntime.dll.meta +++ b/com.github.asus4.onnxruntime/Plugins/Windows/x64/onnxruntime.dll.meta @@ -2,7 +2,7 @@ fileFormatVersion: 2 guid: ed845f30a62cb48a992c3d6e00fb3b0f PluginImporter: externalObjects: {} - serializedVersion: 2 + serializedVersion: 3 iconMap: {} executionOrder: {} defineConstraints: [] @@ -11,9 +11,13 @@ PluginImporter: isExplicitlyReferenced: 0 validateReferences: 1 platformData: - - first: - : Any - second: + Android: + enabled: 0 + settings: + AndroidLibraryDependee: UnityLibrary + AndroidSharedLibraryType: Executable + CPU: ARMv7 + Any: enabled: 0 settings: Exclude Android: 1 @@ -23,53 +27,29 @@ PluginImporter: Exclude Win: 1 Exclude Win64: 0 Exclude iOS: 1 - - first: - Android: Android - second: - enabled: 0 - settings: - AndroidSharedLibraryType: Executable - CPU: ARMv7 - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: + Editor: enabled: 1 settings: CPU: x86_64 DefaultValueInitialized: true OS: Windows - - first: - Standalone: Linux64 - second: + Linux64: enabled: 1 settings: CPU: AnyCPU - - first: - Standalone: OSXUniversal - second: + OSXUniversal: enabled: 1 settings: CPU: AnyCPU - - first: - Standalone: Win - second: + Win: enabled: 0 settings: CPU: AnyCPU - - first: - Standalone: Win64 - second: + Win64: enabled: 1 settings: - CPU: AnyCPU - - first: - iPhone: iOS - second: + CPU: x86_64 + iOS: enabled: 0 settings: AddToEmbeddedBinaries: false diff --git a/com.github.asus4.onnxruntime-extensions/Editor/com.github.asus4.onnxruntime-extensions.Editor.asmdef.meta b/com.github.asus4.onnxruntime/Plugins/Windows/x86.meta similarity index 57% rename from com.github.asus4.onnxruntime-extensions/Editor/com.github.asus4.onnxruntime-extensions.Editor.asmdef.meta rename to com.github.asus4.onnxruntime/Plugins/Windows/x86.meta index 10d6f3b..f8a47e4 100644 --- a/com.github.asus4.onnxruntime-extensions/Editor/com.github.asus4.onnxruntime-extensions.Editor.asmdef.meta +++ b/com.github.asus4.onnxruntime/Plugins/Windows/x86.meta @@ -1,6 +1,7 @@ fileFormatVersion: 2 -guid: 471a8e747116a4eb9b6507ba0237fc83 -AssemblyDefinitionImporter: +guid: 5f66a266f2df6465ca7711cf9e46d661 +folderAsset: yes +DefaultImporter: externalObjects: {} userData: assetBundleName: diff --git a/com.github.asus4.onnxruntime/Plugins/Windows/x86/onnxruntime.dll.meta b/com.github.asus4.onnxruntime/Plugins/Windows/x86/onnxruntime.dll.meta new file mode 100644 index 0000000..222a3b5 --- /dev/null +++ b/com.github.asus4.onnxruntime/Plugins/Windows/x86/onnxruntime.dll.meta @@ -0,0 +1,65 @@ +fileFormatVersion: 2 +guid: 65e7873525c954c9b9096de9496a9654 +PluginImporter: + externalObjects: {} + serializedVersion: 3 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + Android: + enabled: 0 + settings: + AndroidLibraryDependee: UnityLibrary + AndroidSharedLibraryType: Executable + CPU: ARMv7 + Any: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 1 + Exclude Linux64: 1 + Exclude OSXUniversal: 1 + Exclude Win: 0 + Exclude Win64: 1 + Exclude iOS: 1 + Editor: + enabled: 0 + settings: + CPU: x86_64 + DefaultValueInitialized: true + OS: Windows + Linux64: + enabled: 0 + settings: + CPU: x86_64 + OSXUniversal: + enabled: 0 + settings: + CPU: None + Win: + enabled: 1 + settings: + CPU: x86 + Win64: + enabled: 0 + settings: + CPU: None + WindowsStoreApps: + enabled: 0 + settings: + CPU: x86 + iOS: + enabled: 0 + settings: + AddToEmbeddedBinaries: false + CPU: AnyCPU + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.github.asus4.onnxruntime/Editor/com.github.asus4.onnxruntime.Editor.asmdef.meta b/com.github.asus4.onnxruntime/Plugins/iOS.meta similarity index 57% rename from com.github.asus4.onnxruntime/Editor/com.github.asus4.onnxruntime.Editor.asmdef.meta rename to com.github.asus4.onnxruntime/Plugins/iOS.meta index b58085f..78c792e 100644 --- a/com.github.asus4.onnxruntime/Editor/com.github.asus4.onnxruntime.Editor.asmdef.meta +++ b/com.github.asus4.onnxruntime/Plugins/iOS.meta @@ -1,6 +1,7 @@ fileFormatVersion: 2 -guid: 0c2a693589505475cb8d7d2c2778d73c -AssemblyDefinitionImporter: +guid: 59d968276c1924908bedb8d0ca6c447c +folderAsset: yes +DefaultImporter: externalObjects: {} userData: assetBundleName: diff --git a/com.github.asus4.onnxruntime/Plugins/iOS/onnxruntime.xcframework.meta b/com.github.asus4.onnxruntime/Plugins/iOS/onnxruntime.xcframework.meta new file mode 100644 index 0000000..3c50baa --- /dev/null +++ b/com.github.asus4.onnxruntime/Plugins/iOS/onnxruntime.xcframework.meta @@ -0,0 +1,61 @@ +fileFormatVersion: 2 +guid: 61e9efa0c322a4a17869727d5dc86a50 +PluginImporter: + externalObjects: {} + serializedVersion: 3 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + Android: + enabled: 0 + settings: + AndroidLibraryDependee: UnityLibrary + AndroidSharedLibraryType: Executable + CPU: ARMv7 + Any: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 1 + Exclude Linux64: 1 + Exclude OSXUniversal: 1 + Exclude Win: 1 + Exclude Win64: 1 + Exclude iOS: 0 + Editor: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + Linux64: + enabled: 0 + settings: + CPU: None + OSXUniversal: + enabled: 0 + settings: + CPU: None + Win: + enabled: 0 + settings: + CPU: None + Win64: + enabled: 0 + settings: + CPU: None + iOS: + enabled: 1 + settings: + AddToEmbeddedBinaries: false + CPU: AnyCPU + CompileFlags: + FrameworkDependencies: MobileCoreServices;CoreML;ImageIO; + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.github.asus4.onnxruntime/Plugins/macOS/arm64.meta b/com.github.asus4.onnxruntime/Plugins/macOS/arm64.meta new file mode 100644 index 0000000..023056a --- /dev/null +++ b/com.github.asus4.onnxruntime/Plugins/macOS/arm64.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7f9a00c2679f24a40aa0d7b0b9c88a59 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.github.asus4.onnxruntime/Plugins/macOS/libonnxruntime.dylib.meta b/com.github.asus4.onnxruntime/Plugins/macOS/arm64/libonnxruntime.dylib.meta similarity index 61% rename from com.github.asus4.onnxruntime/Plugins/macOS/libonnxruntime.dylib.meta rename to com.github.asus4.onnxruntime/Plugins/macOS/arm64/libonnxruntime.dylib.meta index 499cbb9..0f7230c 100644 --- a/com.github.asus4.onnxruntime/Plugins/macOS/libonnxruntime.dylib.meta +++ b/com.github.asus4.onnxruntime/Plugins/macOS/arm64/libonnxruntime.dylib.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: 9891fef016ccb440487274bca11a0cc2 +guid: bc9b82ac0eaaf452da6dfff039f45b96 PluginImporter: externalObjects: {} - serializedVersion: 2 + serializedVersion: 3 iconMap: {} executionOrder: {} defineConstraints: [] @@ -11,9 +11,13 @@ PluginImporter: isExplicitlyReferenced: 0 validateReferences: 1 platformData: - - first: - : Any - second: + Android: + enabled: 0 + settings: + AndroidLibraryDependee: UnityLibrary + AndroidSharedLibraryType: Executable + CPU: ARMv7 + Any: enabled: 0 settings: Exclude Android: 1 @@ -23,53 +27,29 @@ PluginImporter: Exclude Win: 1 Exclude Win64: 1 Exclude iOS: 1 - - first: - Android: Android - second: - enabled: 0 - settings: - AndroidSharedLibraryType: Executable - CPU: ARMv7 - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: + Editor: enabled: 1 settings: - CPU: AnyCPU + CPU: ARM64 DefaultValueInitialized: true OS: OSX - - first: - Standalone: Linux64 - second: + Linux64: enabled: 0 settings: - CPU: AnyCPU - - first: - Standalone: OSXUniversal - second: + CPU: x86_64 + OSXUniversal: enabled: 1 settings: - CPU: AnyCPU - - first: - Standalone: Win - second: + CPU: ARM64 + Win: enabled: 0 settings: - CPU: AnyCPU - - first: - Standalone: Win64 - second: + CPU: x86 + Win64: enabled: 0 settings: - CPU: AnyCPU - - first: - iPhone: iOS - second: + CPU: None + iOS: enabled: 0 settings: AddToEmbeddedBinaries: false diff --git a/com.github.asus4.onnxruntime/Plugins/macOS/x64.meta b/com.github.asus4.onnxruntime/Plugins/macOS/x64.meta new file mode 100644 index 0000000..c6bcd1c --- /dev/null +++ b/com.github.asus4.onnxruntime/Plugins/macOS/x64.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 517737511da0e4498b34b189ae4a6d44 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.github.asus4.onnxruntime/Plugins/macOS/x64/libonnxruntime.dylib.meta b/com.github.asus4.onnxruntime/Plugins/macOS/x64/libonnxruntime.dylib.meta new file mode 100644 index 0000000..4f287ab --- /dev/null +++ b/com.github.asus4.onnxruntime/Plugins/macOS/x64/libonnxruntime.dylib.meta @@ -0,0 +1,61 @@ +fileFormatVersion: 2 +guid: 031e15b7a7fca47fd9956b825b614de5 +PluginImporter: + externalObjects: {} + serializedVersion: 3 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 1 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + Android: + enabled: 0 + settings: + AndroidLibraryDependee: UnityLibrary + AndroidSharedLibraryType: Executable + CPU: ARMv7 + Any: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 0 + Exclude Linux64: 1 + Exclude OSXUniversal: 0 + Exclude Win: 1 + Exclude Win64: 1 + Exclude iOS: 1 + Editor: + enabled: 1 + settings: + CPU: x86_64 + DefaultValueInitialized: true + OS: OSX + Linux64: + enabled: 0 + settings: + CPU: x86_64 + OSXUniversal: + enabled: 1 + settings: + CPU: x86_64 + Win: + enabled: 0 + settings: + CPU: x86 + Win64: + enabled: 0 + settings: + CPU: None + iOS: + enabled: 0 + settings: + AddToEmbeddedBinaries: false + CPU: AnyCPU + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.github.asus4.onnxruntime/README.md b/com.github.asus4.onnxruntime/README.md deleted file mode 100644 index 74b3a30..0000000 --- a/com.github.asus4.onnxruntime/README.md +++ /dev/null @@ -1,80 +0,0 @@ -# ONNX Runtime Plugin for Unity - -[![upm](https://img.shields.io/npm/v/com.github.asus4.onnxruntime?label=upm)](https://www.npmjs.com/package/com.github.asus4.onnxruntime) - -Pre-built ONNX Runtime libraries for Unity. - -## [See Examples](https://github.com/asus4/onnxruntime-unity-examples) - -[https://github.com/asus4/onnxruntime-unity-examples](https://github.com/asus4/onnxruntime-unity-examples) - - - -## Tested environment - -- Unity: 2022.3.16f1 (LTS) -- ONNX Runtime: 1.16.3 -- ONNX Runtime Extensions: 0.9.0 - -### Execution Providers & Extensions - -#### [Execution Providers](https://onnxruntime.ai/docs/execution-providers/) - -Execution Providers are hardware acceleration libraries for each platform. See [official docs](https://onnxruntime.ai/docs/execution-providers/) for more details. - -| Platform | CPU | CoreML | NNAPI | CUDA | TensorRT | DirectML | XNNPACK | -| --- | --- | --- | --- | --- | --- | --- | --- | -| macOS | :white_check_mark: | :white_check_mark: | | | | | | -| iOS | :white_check_mark: | :white_check_mark: | | | | | :construction: | -| Android | :white_check_mark: | | :white_check_mark: | | | | :construction: | -| Windows | :white_check_mark: | | | :construction: | :construction: | :white_check_mark: | | -| Linux | :white_check_mark: | | | :construction: | :construction: | | | - -#### [ONNX Runtime Extensions](https://github.com/microsoft/onnxruntime-extensions) - -ONNX Runtime Extensions are a set of pre/post-processing. - -| Platform | Extensions | -| --- | --- | -| macOS | :construction: | -| iOS | :construction: | -| Android | :construction: | -| Windows | :construction: | -| Linux | :construction: | - -:white_check_mark: : Supported in Unity Core library -:construction: : Experimental Preview - -## How to Install - -Pre-built libraries are available on [NPM](https://www.npmjs.com/package/com.github.asus4.onnxruntime). Add the following `scopedRegistries` and `dependencies` in `Packages/manifest.json`. - -```json - "scopedRegistries": [ - { - "name": "NPM", - "url": "https://registry.npmjs.com", - "scopes": [ - "com.github.asus4" - ] - } - ] - "dependencies": { - "com.github.asus4.onnxruntime": "0.3.3", - "com.github.asus4.onnxruntime.unity": "0.3.3", - "com.github.asus4.onnxruntime.win-x64-gpu": "0.3.3", - "com.github.asus4.onnxruntime.linux-x64-gpu": "0.3.3", - "com.github.asus4.onnxruntime.extensions": "0.3.3", - ... other dependencies - } -``` - -### What is included in each package - -- `com.github.asus4.onnxruntime` : Core library - - CPU provider for all platforms - - GPU provider for iOS, Android, macOS and Windows(only DirectML) -- `com.github.asus4.onnxruntime.unity` : (Optional) Utilities for Unity -- `com.github.asus4.onnxruntime.win-x64-gpu` : (Optional) GPU provider for Windows -- `com.github.asus4.onnxruntime.linux-x64-gpu` : (Optional) GPU provider for Linux -- `com.github.asus4.onnxruntime.extensions` : (Optional) ONNX Runtime Extensions diff --git a/com.github.asus4.onnxruntime/package.json b/com.github.asus4.onnxruntime/package.json index a976942..56c5c69 100644 --- a/com.github.asus4.onnxruntime/package.json +++ b/com.github.asus4.onnxruntime/package.json @@ -1,6 +1,6 @@ { "name": "com.github.asus4.onnxruntime", - "version": "0.3.3", + "version": "0.3.4", "displayName": "ONNX Runtime", "description": "ONNX Runtime Plugin for Unity", "keywords": [ diff --git a/scripts/download-onnx-extensions-libs.sh b/scripts/download-onnx-extensions-libs.sh index 12f196d..5b42cd5 100755 --- a/scripts/download-onnx-extensions-libs.sh +++ b/scripts/download-onnx-extensions-libs.sh @@ -10,10 +10,10 @@ fi # Define Variables TAG=$1 -PROJCET_DIR="$(cd "$(dirname "$0")/.." && pwd -P)" -PLUGINS_DIR="$PROJCET_DIR/com.github.asus4.onnxruntime-extensions/Plugins" -mkdir -p .tmp -TMP_DIR="$PROJCET_DIR/.tmp" +PROJECT_DIR="$(cd "$(dirname "$0")/.." && pwd -P)" +PLUGINS_DIR="$PROJECT_DIR/com.github.asus4.onnxruntime-extensions/Plugins" +TMP_DIR="$PROJECT_DIR/.tmp" +mkdir -p $TMP_DIR #-------------------------------------- # Functions @@ -39,12 +39,11 @@ function download_nuget() { # ONNX Runtime #-------------------------------------- -# Download binaries from NuGet and place in the Unity package +# Download NuGet packages and place in the Unity package # https://www.nuget.org/api/v2/package/Microsoft.ML.OnnxRuntime.Extensions/{VERSION} download_nuget Microsoft.ML.OnnxRuntime.Extensions $TAG EXTRACT_DIR=$(echo $TMP_DIR/Microsoft.ML.OnnxRuntime.Extensions-$TAG/runtimes) -# exit 0 # macOS cp $EXTRACT_DIR/osx.10.14-x64/native/libortextensions.dylib $PLUGINS_DIR/macOS/x64/ @@ -62,10 +61,10 @@ cp $EXTRACT_DIR/linux-x64/native/libortextensions.so $PLUGINS_DIR/Linux/x64/ # Android cp $EXTRACT_DIR/android/native/onnxruntime-extensions.aar $PLUGINS_DIR/Android/ -# iOS xcframework -rm -rf $PLUGINS_DIR/iOS~/onnxruntime_extensions.xcframework -mkdir -p $PLUGINS_DIR/iOS~/onnxruntime_extensions.xcframework -unzip -o $EXTRACT_DIR/ios/native/onnxruntime_extensions.xcframework.zip -d $PLUGINS_DIR/iOS~/onnxruntime_extensions.xcframework +# iOS XCFramework +rm -rf $PLUGINS_DIR/iOS/onnxruntime_extensions.xcframework +unzip -o $EXTRACT_DIR/ios/native/onnxruntime_extensions.xcframework.zip -d $EXTRACT_DIR/ios/native/ +mv $EXTRACT_DIR/ios/native/onnxruntime_extensions.xcframework $PLUGINS_DIR/iOS/ echo "Done." exit 0 diff --git a/scripts/download-onnx-libs.sh b/scripts/download-onnx-libs.sh index 53c24fc..ccb18ed 100755 --- a/scripts/download-onnx-libs.sh +++ b/scripts/download-onnx-libs.sh @@ -2,15 +2,6 @@ set -e -x -u -# Download binaries for each platform -# Windows, macOS and Linux: GitHub releases -# https://github.com/microsoft/onnxruntime/releases -# iOS: -# https://cocoapods.org/ -# Android: -# https://mvnrepository.com/artifact/com.microsoft.onnxruntime -# https://repo1.maven.org/maven2/com/microsoft/onnxruntime/ - # Ensure the tag format is like 1.2.3 if [[ ! $1 =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then echo "Tag $1 is not in the correct format. It should be like `$0 1.2.3`" @@ -20,19 +11,18 @@ fi # Define Variables TAG=$1 PROJECT_DIR="$(cd "$(dirname "$0")/.." && pwd -P)" -PLUGINS_CORE_DIR="$PROJECT_DIR/com.github.asus4.onnxruntime/Plugins" -mkdir -p .tmp +PLUGINS_DIR="$PROJECT_DIR/com.github.asus4.onnxruntime/Plugins" TMP_DIR="$PROJECT_DIR/.tmp" +mkdir -p $TMP_DIR #-------------------------------------- # Functions #-------------------------------------- -# Download and extract -function download_package() { - FILE_NAME=$1 - EXTRACT_DIR=$(echo $FILE_NAME | sed 's/\.[^.]*$//') # Remove the extension - BASE_URL=$2 +function download_nuget() { + PACKAGE_NAME=$1 + VERSION=$2 + EXTRACT_DIR=$(echo $PACKAGE_NAME-$VERSION) # Skip if the directory already exists if [ -d $TMP_DIR/$EXTRACT_DIR ]; then @@ -40,54 +30,57 @@ function download_package() { return fi - # FILES - echo "Downloading from $BASE_URL/$FILE_NAME" + curl -L https://www.nuget.org/api/v2/package/$PACKAGE_NAME/$VERSION -o $TMP_DIR/$PACKAGE_NAME-$VERSION.nupkg mkdir -p $TMP_DIR/$EXTRACT_DIR - curl -L $BASE_URL/$FILE_NAME -o $TMP_DIR/$FILE_NAME - # If .zip - if [[ $FILE_NAME =~ \.zip$ ]]; then - # unzip into tmp folder if - unzip -o $TMP_DIR/$FILE_NAME -d $TMP_DIR/$EXTRACT_DIR - # if .nupkg - elif [[ $FILE_NAME =~ \.nupkg$ ]]; then - unzip -o $TMP_DIR/$FILE_NAME -d $TMP_DIR/$EXTRACT_DIR - # if .tgz - elif [[ $FILE_NAME =~ \.tgz$ ]]; then - tar -xzf $TMP_DIR/$FILE_NAME -C $TMP_DIR/$EXTRACT_DIR - fi -} - -function download_github_releases() { - download_package $1 https://github.com/microsoft/onnxruntime/releases/download/v$TAG + unzip -o $TMP_DIR/$PACKAGE_NAME-$VERSION.nupkg -d $TMP_DIR/$EXTRACT_DIR } #-------------------------------------- # ONNX Runtime #-------------------------------------- -# macOS Universal -download_github_releases onnxruntime-osx-universal2-$TAG.tgz -cp -RL $TMP_DIR/onnxruntime-osx-universal2-$TAG/onnxruntime-osx-universal2-$TAG/lib/libonnxruntime.dylib $PLUGINS_CORE_DIR/macOS/libonnxruntime.dylib - -# Windows x64 -download_github_releases Microsoft.ML.OnnxRuntime.DirectML.$TAG.nupkg -cp $TMP_DIR/Microsoft.ML.OnnxRuntime.DirectML.$TAG/runtimes/win-x64/native/onnxruntime.dll $PLUGINS_CORE_DIR/Windows/x64/ -download_github_releases onnxruntime-win-x64-gpu-$TAG.zip -cp $TMP_DIR/onnxruntime-win-x64-gpu-$TAG/onnxruntime-win-x64-gpu-$TAG/lib/onnxruntime_providers_*.dll $PROJECT_DIR/com.github.asus4.onnxruntime.win-x64-gpu/Plugins/Windows/x64/ +# Download NuGet packages and place in the Unity package +# https://www.nuget.org/api/v2/package/Microsoft.ML.OnnxRuntime/{VERSION} -# Linux x64 -download_github_releases onnxruntime-linux-x64-gpu-$TAG.tgz -cp -RL $TMP_DIR/onnxruntime-linux-x64-gpu-$TAG/onnxruntime-linux-x64-gpu-$TAG/lib/libonnxruntime.so $PLUGINS_CORE_DIR/Linux/x64/ -cp $TMP_DIR/onnxruntime-linux-x64-gpu-$TAG/onnxruntime-linux-x64-gpu-$TAG/lib/libonnxruntime_providers_*.so $PROJECT_DIR/com.github.asus4.onnxruntime.linux-x64-gpu/Plugins/Linux/x64/ +download_nuget Microsoft.ML.OnnxRuntime $TAG +download_nuget Microsoft.ML.OnnxRuntime.DirectML $TAG +download_nuget Microsoft.ML.OnnxRuntime.Gpu.Linux $TAG +download_nuget Microsoft.ML.OnnxRuntime.Gpu.Windows $TAG -# iOS -download_package pod-archive-onnxruntime-c-$TAG.zip https://onnxruntimepackages.z14.web.core.windows.net -mkdir -p $PLUGINS_CORE_DIR/iOS~/onnxruntime.xcframework/ -cp -R $TMP_DIR/pod-archive-onnxruntime-c-$TAG/onnxruntime.xcframework/* $PLUGINS_CORE_DIR/iOS~/onnxruntime.xcframework/ -ls $PLUGINS_CORE_DIR/iOS~/onnxruntime.xcframework/ +EXTRACT_DIR=$(echo $TMP_DIR/Microsoft.ML.OnnxRuntime-$TAG/runtimes) # Android -curl -L https://repo1.maven.org/maven2/com/microsoft/onnxruntime/onnxruntime-android/$TAG/onnxruntime-android-$TAG.aar -o $PLUGINS_CORE_DIR/Android/onnxruntime-android.aar +cp $EXTRACT_DIR/android/native/onnxruntime.aar $PLUGINS_DIR/Android/ + +# iOS XCFramework +rm -rf $PLUGINS_DIR/iOS/onnxruntime.xcframework +mkdir -p $PLUGINS_DIR/iOS/onnxruntime.xcframework/ +unzip -o $EXTRACT_DIR/ios/native/onnxruntime.xcframework.zip -d $PLUGINS_DIR/iOS/ +ls $PLUGINS_DIR/iOS/onnxruntime.xcframework/ + +# macOS +cp $EXTRACT_DIR/osx-x64/native/libonnxruntime.dylib $PLUGINS_DIR/macOS/x64/ +cp $EXTRACT_DIR/osx-arm64/native/libonnxruntime.dylib $PLUGINS_DIR/macOS/arm64/ + +# Linux +# arm64 is not supported by Unity +# cp $EXTRACT_DIR/linux-arm64/native/libonnxruntime.so $PLUGINS_DIR/Linux/arm64/ +cp $EXTRACT_DIR/linux-x64/native/libonnxruntime.so $PLUGINS_DIR/Linux/x64/ + +# Microsoft.ML.OnnxRuntime.Gpu.Linux +EXTRACT_DIR=$(echo $TMP_DIR/Microsoft.ML.OnnxRuntime.Gpu.Linux-$TAG/runtimes) +cp $EXTRACT_DIR/linux-x64/native/libonnxruntime_*.so $PROJECT_DIR/com.github.asus4.onnxruntime.linux-x64-gpu/Plugins/Linux/x64/ + +# Windows +# Microsoft.ML.OnnxRuntime.DirectML for default OnnxRuntime +EXTRACT_DIR=$(echo $TMP_DIR/Microsoft.ML.OnnxRuntime.DirectML-$TAG/runtimes) +cp $EXTRACT_DIR/win-arm64/native/onnxruntime.dll $PLUGINS_DIR/Windows/arm64/ +cp $EXTRACT_DIR/win-x64/native/onnxruntime.dll $PLUGINS_DIR/Windows/x64/ +cp $EXTRACT_DIR/win-x86/native/onnxruntime.dll $PLUGINS_DIR/Windows/x86/ + +# Microsoft.ML.OnnxRuntime.Gpu.Windows +EXTRACT_DIR=$(echo $TMP_DIR/Microsoft.ML.OnnxRuntime.Gpu.Windows-$TAG/runtimes) +cp $EXTRACT_DIR/win-x64/native/onnxruntime_*.dll $PROJECT_DIR/com.github.asus4.onnxruntime.win-x64-gpu/Plugins/Windows/x64/ echo "Done." exit 0