Skip to content

Commit

Permalink
Use openmp-sys instead of -fopenmp flag
Browse files Browse the repository at this point in the history
linker-args do not propagate transitively
(rust-lang/cargo#9554). Hence, -fopenmp would
need to be set in every crate that uses this crate.
The openmp-sys crate instead searches for the libraries and adds them
as link-lib, which is picked up by crates using this crate.
  • Loading branch information
Ectras committed Feb 23, 2023
1 parent 688d884 commit c73cffa
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ categories = ["api-bindings", "science"]

[dependencies]
num-complex = "0.4"
openmp-sys = "1.2"

[build-dependencies]
cmake = "0.1"
Expand Down
1 change: 0 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ fn main() {
// Link it
println!("cargo:rustc-link-search={}", dst.join("lib").display());
println!("cargo:rustc-link-lib=hptt");
println!("cargo:rustc-link-arg=-fopenmp");
println!("cargo:rustc-link-lib=stdc++");

// Generate bindings
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
extern crate openmp_sys;

mod hptt {
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
}
Expand Down

0 comments on commit c73cffa

Please sign in to comment.