From f164780e248567d3bd0ce50d770f62dc23f8d467 Mon Sep 17 00:00:00 2001 From: Ali Somay Date: Thu, 28 Nov 2024 18:10:21 +0100 Subject: [PATCH] Bump version --- Cargo.toml | 2 +- build.rs | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fcf2c88..abb1ace 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libpd-sys" -version = "0.3.3" +version = "0.3.4" authors = ["alisomay "] edition = "2021" license = "BSD-3-Clause" diff --git a/build.rs b/build.rs index 8f318d8..b76dc87 100644 --- a/build.rs +++ b/build.rs @@ -63,11 +63,12 @@ fn main() { #[cfg(target_os = "windows")] { + // Determine the appropriate CRT linkage let profile = std::env::var("PROFILE").unwrap(); - let crt_linkage = if profile == "release" { - "MultiThreadedDLL" + let msvc_runtime_flag = if profile == "release" { + "/MD" // Multithreaded DLL } else { - "MultiThreadedDebugDLL" + "/MDd" // Multithreaded Debug DLL }; // For windows we need to link pthread. @@ -148,16 +149,21 @@ fn main() { .define("LIBPD_RS_EXTRA", LIBPD_RS_EXTRA) .define("PTHREADS_LIB", pthread_lib_path.to_str().unwrap()) .define("PTHREADS_INCLUDE_DIR", pthread_include.to_str().unwrap()) - .define("CMAKE_MSVC_RUNTIME_LIBRARY", crt_linkage) .cflag(format!("-DWISH={}", WISH)) .cflag(format!("-I{}", libpd_wrapper_dir.to_str().unwrap())) .cflag(format!("-I{}", pd_source.to_str().unwrap())) .cflag(format!("-DPD_FLOATSIZE={PD_FLOATSIZE}")) .no_build_target(true) .always_configure(true) - .very_verbose(true) - .build(); + .very_verbose(true); + + let lib_destination = if target_info.compiler.unwrap() == "msvc" { + lib_destination.cflag(msvc_runtime_flag) + } else { + lib_destination + }; + let lib_destination = lib_destination.build(); let library_root = lib_destination.join("build/libs"); // Look for pthread