Skip to content

Commit

Permalink
Add support for static builds on Linux with NUMA library linking
Browse files Browse the repository at this point in the history
  • Loading branch information
masa-koz committed Dec 11, 2024
1 parent a3517ff commit d15aa45
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scripts/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,15 @@ fn main() {
let lib_path = Path::join(Path::new(&dst), Path::new(path_extra));
println!("cargo:rustc-link-search=native={}", lib_path.display());
if cfg!(feature = "static") {
if cfg!(target_os = "macos") {
if cfg!(target_os = "linux") {
let numa_lib_path = match target.as_str() {
"x86_64-unknown-linux-gnu" => "/usr/lib/x86_64-linux-gnu",
"aarch64-unknown-linux-gnu" => "/usr/lib/aarch64-linux-gnu",
_ => panic!("Unsupported target: {}", target),
};
println!("cargo:rustc-link-search=native={}", numa_lib_path);
println!("cargo:rustc-link-lib=static=numa");
} else if cfg!(target_os = "macos") {
println!("cargo:rustc-link-lib=framework=CoreFoundation");
println!("cargo:rustc-link-lib=framework=Security");
}
Expand Down

0 comments on commit d15aa45

Please sign in to comment.