-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merging from main as main was bypassed in a previous pull request
- Loading branch information
Showing
5 changed files
with
220 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use std::env; | ||
use std::path::Path; | ||
|
||
fn main() { | ||
// if the ONNX library is statically linked we do not need to do anything | ||
if cfg!(onnx_statically_linked) { | ||
return; | ||
} | ||
|
||
let target_lib = match env::var("CARGO_CFG_TARGET_OS").unwrap() { | ||
ref s if s.contains("linux") => "libonnxruntime.so", | ||
ref s if s.contains("macos") => "libonnxruntime.dylib", | ||
ref s if s.contains("windows") => "onnxruntime.dll", | ||
// ref s if s.contains("android") => "android", => not building for android | ||
_ => panic!("Unsupported target os"), | ||
}; | ||
let profile = match env::var("PROFILE").unwrap() { | ||
ref s if s.contains("release") => "release", | ||
ref s if s.contains("debug") => "debug", | ||
_ => panic!("Unsupported profile"), | ||
}; | ||
|
||
// remove ./modules/utils/target folder if there | ||
let _ = | ||
std::fs::remove_dir_all(Path::new("modules").join("utils").join("target")).unwrap_or(()); | ||
|
||
// create the target module folder for the utils module | ||
let _ = std::fs::create_dir(Path::new("modules").join("utils").join("target")); | ||
let _ = std::fs::create_dir(Path::new("modules").join("utils").join("target").join(profile)); | ||
|
||
// copy target folder to modules/utils/target profile for the utils modules | ||
std::fs::copy( | ||
Path::new("target").join(profile).join(target_lib), | ||
Path::new("modules").join("utils").join("target").join(profile).join(target_lib), | ||
) | ||
.unwrap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.