diff --git a/openblas-src/Cargo.toml b/openblas-src/Cargo.toml index 227316e..e0911dd 100644 --- a/openblas-src/Cargo.toml +++ b/openblas-src/Cargo.toml @@ -36,6 +36,7 @@ system = [] libc = "0.2" [build-dependencies] +pkg-config = "0.3.30" dirs = "5.0.1" openblas-build = { version = "0.10.9", path = "../openblas-build" } diff --git a/openblas-src/build.rs b/openblas-src/build.rs index 1587f32..4708b58 100644 --- a/openblas-src/build.rs +++ b/openblas-src/build.rs @@ -76,12 +76,24 @@ fn macos_system() { } fn main() { + if env::var("DOCS_RS").is_ok() { + return; + } let link_kind = if feature_enabled("static") { "static" } else { "dylib" }; if feature_enabled("system") { + // Use pkg-config to find OpenBLAS + if pkg_config::Config::new() + .statik(feature_enabled("static")) + .probe("openblas") + .is_ok() + { + return; + } + if cfg!(target_os = "windows") { if cfg!(target_env = "gnu") { windows_gnu_system();