Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion faiss-sys/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::env;

fn main() {
#[cfg(feature = "static")]
static_link_faiss();
Expand All @@ -7,6 +9,8 @@ fn main() {

#[cfg(feature = "static")]
fn static_link_faiss() {
let target = env::var("TARGET").expect("TARGET not set");

let mut cfg = cmake::Config::new("faiss");
cfg.define("FAISS_ENABLE_C_API", "ON")
.define("BUILD_SHARED_LIBS", "OFF")
Expand All @@ -33,7 +37,12 @@ fn static_link_faiss() {
println!("cargo:rustc-link-lib=static=faiss_c");
println!("cargo:rustc-link-lib=static=faiss");
link_cxx();
println!("cargo:rustc-link-lib=gomp");

if !target.contains("msvc") && !target.contains("apple") {
println!("cargo:rustc-link-lib=gomp");
} else {
println!("cargo:rustc-link-lib=omp");
}
println!("cargo:rustc-link-lib=blas");
println!("cargo:rustc-link-lib=lapack");
if cfg!(feature = "gpu") {
Expand Down