Skip to content

Commit

Permalink
fix(sys): optionally link to clog, closes #304
Browse files Browse the repository at this point in the history
  • Loading branch information
decahedron1 committed Oct 19, 2024
1 parent b51f60c commit 6dd3c06
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions ort-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,15 +242,16 @@ fn prepare_libort_dir() -> (PathBuf, bool) {
}

add_search_dir(transform_dep(external_lib_dir.join("pytorch_cpuinfo-build"), &profile));
// only android doesn't use clog, how fun!
if target_os != "android" {
let clog_path = transform_dep(external_lib_dir.join("pytorch_cpuinfo-build").join("deps").join("clog"), &profile);
if clog_path.exists() {
add_search_dir(clog_path);
} else {
add_search_dir(transform_dep(external_lib_dir.join("pytorch_clog-build"), &profile));
// clog isn't built when not building unit tests, or when compiling for android
for potential_clog_path in [
transform_dep(external_lib_dir.join("pytorch_cpuinfo-build").join("deps").join("clog"), &profile),
transform_dep(external_lib_dir.join("pytorch_clog-build"), &profile)
] {
if potential_clog_path.exists() && potential_clog_path.join(platform_format_lib("clog")).exists() {
add_search_dir(potential_clog_path);
println!("cargo:rustc-link-lib=static=clog");
break;
}
println!("cargo:rustc-link-lib=static=clog");
}
println!("cargo:rustc-link-lib=static=cpuinfo");

Expand Down

0 comments on commit 6dd3c06

Please sign in to comment.