Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make crate build on macos using pkg-config #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
Make crate build on macos using pkg-config
  • Loading branch information
Mordinel committed Sep 8, 2023
commit 3ed92e26c780de8a78fd12de97dbeeb47cb99886
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -24,4 +24,7 @@ num-traits = "0.2"
serde = { version = "1.0", optional = true, features = ["derive"] }

[dev-dependencies]
serde_json = { version = "1.0" }
serde_json = { version = "1.0" }

[build-dependencies]
pkg-config = "0.3.27"
13 changes: 13 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
fn main() {
#[cfg(target_os = "macos")]
{
let gmp_config = pkg_config::probe_library("gmp").unwrap();
for link_lib in gmp_config.libs {
println!("cargo:rustc-link-lib={}", link_lib);
}
for link_path in gmp_config.link_paths {
println!("cargo:rustc-link-search=native={}", link_path.to_str().expect("Path is not unicode"));
}
}
}