Skip to content

Commit

Permalink
Bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
alisomay committed Nov 28, 2024
1 parent 7f1af6c commit 2105c66
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "libpd-sys"
version = "0.3.3"
version = "0.3.4"
authors = ["alisomay <[email protected]>"]
edition = "2021"
license = "BSD-3-Clause"
Expand Down
24 changes: 16 additions & 8 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,25 +63,27 @@ 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.
// There are some prebuilt libraries for msvc and mingw for architectures x64 and arm64.
// Mingw support is not tested yet but should work.
let pthread_root = project_dir.join("pthreads");

let compiler = target_info.compiler.unwrap();
let (pthread_lib_root, pthread_lib_path, pthread_lib_name, pthread_include): (
PathBuf,
PathBuf,
&str,
PathBuf,
) = match &*target_info.arch {
"x86_64" => match &*(target_info.compiler.unwrap()) {
"x86_64" => match compiler.as_str() {
"msvc" => {
let lib_root = pthread_root
.join("msvc")
Expand Down Expand Up @@ -140,23 +142,29 @@ fn main() {
_ => panic!("Unsupported architecture: {}", target_info.arch),
};

let lib_destination = Config::new("libpd")
let mut lib_destination = Config::new("libpd");

lib_destination
.define("PD_LOCALE", PD_LOCALE)
.define("PD_MULTI", PD_MULTI)
.define("PD_UTILS", PD_UTILS)
.define("PD_EXTRA", PD_EXTRA)
.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);

if compiler.as_str() == "msvc" {
lib_destination.cflag(msvc_runtime_flag);
}

let lib_destination = lib_destination.build();

let library_root = lib_destination.join("build/libs");

Expand Down

0 comments on commit 2105c66

Please sign in to comment.