From 6b8f424b7e4ed0c3584b190619e684175d4a72cb Mon Sep 17 00:00:00 2001 From: Mentle Gen Date: Mon, 5 Feb 2024 10:46:30 +0530 Subject: [PATCH] Added name key-val pair - In order to pass the name of compiled lib on different platform we pass the name of libfile through the name key. --- build.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/build.rs b/build.rs index d659c08..2d6e77c 100644 --- a/build.rs +++ b/build.rs @@ -17,13 +17,11 @@ pub fn main() -> Result<()> { // .build_arg(format!("-j{}", std::thread::available_parallelism()?.get())) .build(); - println!( - "cargo:rustc-link-search={}", - dst.join("lib").display() - ); - println!("cargo:rustc-link-lib=static=jpeg"); + println!("cargo:rustc-link-search={}", dst.join("lib").display()); + let name = if cfg!(unix) { "jpeg" } else { "jpeg-static" }; + println!("cargo:rustc-link-lib=static={name}"); println!("cargo:include={}", dst.join("include").display()); - + println!("cargo:name={name}"); Ok(()) }