com.github.asus4.onnxruntime 0.3.5 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/Editor/OrtPostProcessBuild.cs +88 -0
  2. package/Editor/OrtPostProcessBuild.cs.meta +11 -0
  3. package/Editor/com.github.asus4.onnxruntime.Editor.asmdef +22 -0
  4. package/Editor/com.github.asus4.onnxruntime.Editor.asmdef.meta +7 -0
  5. package/{Plugins/iOS.meta → Editor.meta} +1 -1
  6. package/README.md +4 -4
  7. package/package.json +1 -1
  8. package/Plugins/iOS/onnxruntime.xcframework.meta +0 -61
  9. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/Info.plist +0 -0
  10. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64/onnxruntime.framework/Headers/coreml_provider_factory.h +0 -0
  11. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64/onnxruntime.framework/Headers/cpu_provider_factory.h +0 -0
  12. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64/onnxruntime.framework/Headers/onnxruntime_c_api.h +0 -0
  13. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64/onnxruntime.framework/Headers/onnxruntime_cxx_api.h +0 -0
  14. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64/onnxruntime.framework/Headers/onnxruntime_cxx_inline.h +0 -0
  15. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64/onnxruntime.framework/Headers/onnxruntime_float16.h +0 -0
  16. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64/onnxruntime.framework/Headers/onnxruntime_lite_custom_op.h +0 -0
  17. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64/onnxruntime.framework/Headers/onnxruntime_run_options_config_keys.h +0 -0
  18. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64/onnxruntime.framework/Headers/onnxruntime_session_options_config_keys.h +0 -0
  19. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64/onnxruntime.framework/Info.plist +0 -0
  20. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64/onnxruntime.framework/onnxruntime +0 -0
  21. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64_x86_64-maccatalyst/onnxruntime.framework/Versions/A/Headers/coreml_provider_factory.h +0 -0
  22. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64_x86_64-maccatalyst/onnxruntime.framework/Versions/A/Headers/cpu_provider_factory.h +0 -0
  23. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64_x86_64-maccatalyst/onnxruntime.framework/Versions/A/Headers/onnxruntime_c_api.h +0 -0
  24. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64_x86_64-maccatalyst/onnxruntime.framework/Versions/A/Headers/onnxruntime_cxx_api.h +0 -0
  25. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64_x86_64-maccatalyst/onnxruntime.framework/Versions/A/Headers/onnxruntime_cxx_inline.h +0 -0
  26. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64_x86_64-maccatalyst/onnxruntime.framework/Versions/A/Headers/onnxruntime_float16.h +0 -0
  27. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64_x86_64-maccatalyst/onnxruntime.framework/Versions/A/Headers/onnxruntime_lite_custom_op.h +0 -0
  28. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64_x86_64-maccatalyst/onnxruntime.framework/Versions/A/Headers/onnxruntime_run_options_config_keys.h +0 -0
  29. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64_x86_64-maccatalyst/onnxruntime.framework/Versions/A/Headers/onnxruntime_session_options_config_keys.h +0 -0
  30. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64_x86_64-maccatalyst/onnxruntime.framework/Versions/A/Resources/Info.plist +0 -0
  31. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64_x86_64-maccatalyst/onnxruntime.framework/Versions/A/onnxruntime +0 -0
  32. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64_x86_64-simulator/onnxruntime.framework/Headers/coreml_provider_factory.h +0 -0
  33. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64_x86_64-simulator/onnxruntime.framework/Headers/cpu_provider_factory.h +0 -0
  34. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64_x86_64-simulator/onnxruntime.framework/Headers/onnxruntime_c_api.h +0 -0
  35. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64_x86_64-simulator/onnxruntime.framework/Headers/onnxruntime_cxx_api.h +0 -0
  36. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64_x86_64-simulator/onnxruntime.framework/Headers/onnxruntime_cxx_inline.h +0 -0
  37. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64_x86_64-simulator/onnxruntime.framework/Headers/onnxruntime_float16.h +0 -0
  38. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64_x86_64-simulator/onnxruntime.framework/Headers/onnxruntime_lite_custom_op.h +0 -0
  39. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64_x86_64-simulator/onnxruntime.framework/Headers/onnxruntime_run_options_config_keys.h +0 -0
  40. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64_x86_64-simulator/onnxruntime.framework/Headers/onnxruntime_session_options_config_keys.h +0 -0
  41. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64_x86_64-simulator/onnxruntime.framework/Info.plist +0 -0
  42. /package/Plugins/{iOS → iOS~}/onnxruntime.xcframework/ios-arm64_x86_64-simulator/onnxruntime.framework/onnxruntime +0 -0
@@ -0,0 +1,88 @@
1
+ using System.IO;
2
+ using UnityEngine;
3
+ using UnityEngine.Assertions;
4
+ using UnityEditor;
5
+ using UnityEditor.Build;
6
+ using UnityEditor.Build.Reporting;
7
+
8
+ #if UNITY_IOS
9
+ using UnityEditor.iOS.Xcode;
10
+ using UnityEditor.iOS.Xcode.Extensions;
11
+ #endif // UNITY_IOS
12
+
13
+ namespace Microsoft.ML.OnnxRuntime.Editor
14
+ {
15
+ /// <summary>
16
+ /// Custom post-process build for ONNX Runtime
17
+ /// </summary>
18
+ public class OrtPostProcessBuild : IPostprocessBuildWithReport
19
+ {
20
+ const string PACKAGE_PATH = "Packages/com.github.asus4.onnxruntime";
21
+ const string FRAMEWORK_SRC = "Plugins/iOS~/onnxruntime.xcframework";
22
+ const string FRAMEWORK_DST = "Libraries/onnxruntime.xcframework";
23
+
24
+ public int callbackOrder => 0;
25
+
26
+ public void OnPostprocessBuild(BuildReport report)
27
+ {
28
+ switch (report.summary.platform)
29
+ {
30
+ case BuildTarget.iOS:
31
+ CopyOrtXCFramework(report,
32
+ PACKAGE_PATH,
33
+ FRAMEWORK_SRC,
34
+ FRAMEWORK_DST);
35
+ break;
36
+ }
37
+ }
38
+
39
+ /// <summary>
40
+ /// A common method that copies and sets options for ONNX Runtime XCFramework in iOS
41
+ /// </summary>
42
+ /// <param name="report">A build report</param>
43
+ /// <param name="packagePath">A package path starting from "Packages/com.domain.package"</param>
44
+ /// <param name="frameworkSrcPath">A source XCFramework path</param>
45
+ /// <param name="frameworkDstPath">A destination XCFramework path</param>
46
+ public static void CopyOrtXCFramework(
47
+ BuildReport report,
48
+ string packagePath,
49
+ string frameworkSrcPath,
50
+ string frameworkDstPath)
51
+ {
52
+ #if UNITY_IOS
53
+ string pbxProjectPath = PBXProject.GetPBXProjectPath(report.summary.outputPath);
54
+ PBXProject pbxProject = new();
55
+ pbxProject.ReadFromFile(pbxProjectPath);
56
+
57
+ // Copy XCFramework to the Xcode project folder
58
+ string frameworkSrcAbsPath = Path.Combine(packagePath, frameworkSrcPath);
59
+ string frameworkDstAbsPath = Path.Combine(report.summary.outputPath, frameworkDstPath);
60
+ CopyDirectory(frameworkSrcAbsPath, frameworkDstAbsPath);
61
+
62
+ // Then add to Xcode project
63
+ string frameworkGuid = pbxProject.AddFile(frameworkDstAbsPath, frameworkDstPath, PBXSourceTree.Source);
64
+ string unityTargetGuid = pbxProject.GetUnityFrameworkTargetGuid();
65
+ string targetBuildPhaseGuid = pbxProject.AddFrameworksBuildPhase(unityTargetGuid);
66
+ pbxProject.AddFileToBuildSection(unityTargetGuid, targetBuildPhaseGuid, frameworkGuid);
67
+
68
+ #if ORT_GENAI_ENABLED
69
+ // NOTE: Required only when GenAI package is installed
70
+ // GenAI loads the dynamic library in runtime. need to embed in the main target
71
+ string mainTargetGuid = pbxProject.GetUnityMainTargetGuid();
72
+ pbxProject.AddFileToEmbedFrameworks(mainTargetGuid, frameworkGuid);
73
+ #endif // ORT_GENAI_ENABLED
74
+
75
+ pbxProject.WriteToFile(pbxProjectPath);
76
+ #endif // UNITY_IOS
77
+ }
78
+
79
+ static void CopyDirectory(string source, string dest)
80
+ {
81
+ if (Directory.Exists(dest) && !FileUtil.DeleteFileOrDirectory(dest))
82
+ {
83
+ throw new IOException($"Failed to delete directory '{dest}'.");
84
+ }
85
+ FileUtil.CopyFileOrDirectoryFollowSymlinks(source, dest);
86
+ }
87
+ }
88
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: e487cab40ce8f4fce81e6f71b6185d49
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "com.github.asus4.onnxruntime.Editor",
3
+ "rootNamespace": "",
4
+ "references": [],
5
+ "includePlatforms": [
6
+ "Editor"
7
+ ],
8
+ "excludePlatforms": [],
9
+ "allowUnsafeCode": false,
10
+ "overrideReferences": false,
11
+ "precompiledReferences": [],
12
+ "autoReferenced": true,
13
+ "defineConstraints": [],
14
+ "versionDefines": [
15
+ {
16
+ "name": "com.github.asus4.onnxruntime-genai",
17
+ "expression": "0.4.0",
18
+ "define": "ORT_GENAI_ENABLED"
19
+ }
20
+ ],
21
+ "noEngineReferences": false
22
+ }
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 0c2a693589505475cb8d7d2c2778d73c
3
+ AssemblyDefinitionImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -1,5 +1,5 @@
1
1
  fileFormatVersion: 2
2
- guid: 59d968276c1924908bedb8d0ca6c447c
2
+ guid: 0a14dd0bc96f84c139228fb7dfa5c824
3
3
  folderAsset: yes
4
4
  DefaultImporter:
5
5
  externalObjects: {}
package/README.md CHANGED
@@ -70,10 +70,10 @@ Pre-built libraries are available on [NPM](https://www.npmjs.com/package/com.git
70
70
  }
71
71
  ]
72
72
  "dependencies": {
73
- "com.github.asus4.onnxruntime": "0.3.5",
74
- "com.github.asus4.onnxruntime.unity": "0.3.5",
75
- "com.github.asus4.onnxruntime.win-x64-gpu": "0.3.5",
76
- "com.github.asus4.onnxruntime-extensions": "0.3.5",
73
+ "com.github.asus4.onnxruntime": "0.4.0",
74
+ "com.github.asus4.onnxruntime.unity": "0.4.0",
75
+ "com.github.asus4.onnxruntime.win-x64-gpu": "0.4.0",
76
+ "com.github.asus4.onnxruntime-extensions": "0.4.0",
77
77
  ... other dependencies
78
78
  }
79
79
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.github.asus4.onnxruntime",
3
- "version": "0.3.5",
3
+ "version": "0.4.0",
4
4
  "displayName": "ONNX Runtime",
5
5
  "description": "ONNX Runtime Plugin for Unity",
6
6
  "keywords": [
@@ -1,61 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: 61e9efa0c322a4a17869727d5dc86a50
3
- PluginImporter:
4
- externalObjects: {}
5
- serializedVersion: 3
6
- iconMap: {}
7
- executionOrder: {}
8
- defineConstraints: []
9
- isPreloaded: 0
10
- isOverridable: 1
11
- isExplicitlyReferenced: 0
12
- validateReferences: 1
13
- platformData:
14
- Android:
15
- enabled: 0
16
- settings:
17
- AndroidLibraryDependee: UnityLibrary
18
- AndroidSharedLibraryType: Executable
19
- CPU: ARMv7
20
- Any:
21
- enabled: 0
22
- settings:
23
- Exclude Android: 1
24
- Exclude Editor: 1
25
- Exclude Linux64: 1
26
- Exclude OSXUniversal: 1
27
- Exclude Win: 1
28
- Exclude Win64: 1
29
- Exclude iOS: 0
30
- Editor:
31
- enabled: 0
32
- settings:
33
- CPU: AnyCPU
34
- DefaultValueInitialized: true
35
- OS: AnyOS
36
- Linux64:
37
- enabled: 0
38
- settings:
39
- CPU: None
40
- OSXUniversal:
41
- enabled: 0
42
- settings:
43
- CPU: None
44
- Win:
45
- enabled: 0
46
- settings:
47
- CPU: None
48
- Win64:
49
- enabled: 0
50
- settings:
51
- CPU: None
52
- iOS:
53
- enabled: 1
54
- settings:
55
- AddToEmbeddedBinaries: false
56
- CPU: AnyCPU
57
- CompileFlags:
58
- FrameworkDependencies: MobileCoreServices;CoreML;ImageIO;
59
- userData:
60
- assetBundleName:
61
- assetBundleVariant: