From c79abe9e4d2bb9abe86b822cab7e29880aa5872d Mon Sep 17 00:00:00 2001 From: Gemingyang Date: Wed, 27 Nov 2024 16:16:38 +0000 Subject: [PATCH] use pkg-config and fix build on doc.rs --- openblas-src/Cargo.toml | 1 + openblas-src/build.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+) 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();