-
Notifications
You must be signed in to change notification settings - Fork 13
support iOS #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support iOS #19
Changes from 21 commits
bcd180d
75423fc
b666249
0df261b
c7e13ee
2d3f1b5
86691fc
164d9a5
26619b8
772df58
2935b14
c30c6f6
adc9201
082ef93
facd505
652a640
9350cda
ee0f161
1277c6f
cc4f328
c96e34a
692c1dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,16 @@ const ORT_RELEASE_BASE_URL: &str = "https://github.com/microsoft/onnxruntime/rel | |
| const ORT_MAVEN_RELEASE_BASE_URL: &str = | ||
| "https://repo1.maven.org/maven2/com/microsoft/onnxruntime/onnxruntime-android"; | ||
|
|
||
| /// Base Url from which to download ios pre-build releases/ | ||
| const ORT_IOS_RELEASE_BASE_URL: &str = | ||
| "https://github.com/VOICEVOX/onnxruntime-builder/releases/download"; | ||
|
|
||
| /// onnxruntime repository/ | ||
| const ORT_REPOSITORY_URL: &str = "https://github.com/microsoft/onnxruntime.git"; | ||
|
|
||
| /// Minimum iOS version of the target platform/ | ||
| const IOS_MINIMAL_DEPLOY_TARGET: &str = "16.0"; | ||
|
|
||
| /// Environment variable selecting which strategy to use for finding the library | ||
| /// Possibilities: | ||
| /// * "download": Download a pre-built library from upstream. This is the default if `ORT_STRATEGY` is not set. | ||
|
|
@@ -382,6 +392,7 @@ enum Os { | |
| Linux, | ||
| MacOs, | ||
| Android, | ||
| IOs, | ||
| } | ||
|
|
||
| impl Os { | ||
|
|
@@ -391,6 +402,7 @@ impl Os { | |
| Os::Linux => "tgz", | ||
| Os::MacOs => "tgz", | ||
| Os::Android => "aar", | ||
| Os::IOs => "tgz", | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -404,6 +416,7 @@ impl FromStr for Os { | |
| "macos" => Ok(Os::MacOs), | ||
| "linux" => Ok(Os::Linux), | ||
| "android" => Ok(Os::Android), | ||
| "ios" => Ok(Os::IOs), | ||
| _ => Err(format!("Unsupported os: {}", s)), | ||
| } | ||
| } | ||
|
|
@@ -416,6 +429,7 @@ impl OnnxPrebuiltArchive for Os { | |
| Os::Linux => Cow::from("linux"), | ||
| Os::MacOs => Cow::from("osx"), | ||
| Os::Android => Cow::from("android"), | ||
| Os::IOs => Cow::from("ios"), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rustの命名規則だと
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 個人的には仕方ないかなと思いました・・・! |
||
| } | ||
| } | ||
| } | ||
|
|
@@ -489,6 +503,21 @@ impl OnnxPrebuiltArchive for Triplet { | |
| "x64", | ||
| self.accelerator.as_onnx_str(), | ||
| )), | ||
| // onnxruntime-ios-arm64-1.8.1.tgz | ||
| (Os::IOs, Architecture::Arm64, Accelerator::None) => { | ||
| let os = if env::var("TARGET").unwrap().ends_with("sim") { | ||
| format!("{}-sim", self.os.as_onnx_str()) | ||
| } else { | ||
| format!("{}", self.os.as_onnx_str()) | ||
| }; | ||
| Cow::from(format!("{}-{}", os, "arm64")) | ||
| } | ||
| // onnxruntime-ios-sim-x86_64-1.8.1.tgz | ||
| (Os::IOs, Architecture::X86_64, Accelerator::None) => Cow::from(format!( | ||
| "{}-sim-{}", | ||
| self.os.as_onnx_str(), | ||
| self.arch.as_onnx_str() | ||
| )), | ||
Hiroshiba marked this conversation as resolved.
Show resolved
Hide resolved
Hiroshiba marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| _ => { | ||
| panic!( | ||
| "Unsupported prebuilt triplet: {:?}, {:?}, {:?}. Please use {}=system and {}=/path/to/onnxruntime", | ||
|
|
@@ -521,6 +550,10 @@ fn prebuilt_archive_url() -> (PathBuf, String) { | |
| ORT_VERSION, | ||
| TRIPLET.os.archive_extension() | ||
| ), | ||
| Os::IOs => format!( | ||
| "{}/{}/{}", | ||
| ORT_IOS_RELEASE_BASE_URL, ORT_VERSION, prebuilt_archive | ||
| ), | ||
| _ => format!( | ||
| "{}/v{}/{}", | ||
| ORT_RELEASE_BASE_URL, ORT_VERSION, prebuilt_archive | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.