diff --git a/Cargo.toml b/Cargo.toml index 87d0395..97d00dd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,4 +24,7 @@ num-traits = "0.2" serde = { version = "1.0", optional = true, features = ["derive"] } [dev-dependencies] -serde_json = { version = "1.0" } \ No newline at end of file +serde_json = { version = "1.0" } + +[build-dependencies] +pkg-config = "0.3.27" diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..f27be97 --- /dev/null +++ b/build.rs @@ -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")); + } + } +} +