Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
mio 2024-03-08 16:20:58 +08:00
commit 9463d00c3e
No known key found for this signature in database
GPG Key ID: DFF27E34A47CB873
1 changed files with 10 additions and 2 deletions

View File

@ -138,7 +138,11 @@ fn build_with_cmake() {
// Lazymio(@wtdcode): Dynamic link may break. See: https://github.com/rust-lang/cargo/issues/5077
if cfg!(feature = "dynamic_linkage") {
println!("cargo:rustc-link-lib=dylib=unicorn");
if compiler.is_like_msvc() {
println!("cargo:rustc-link-lib=dylib=unicorn-import");
} else {
println!("cargo:rustc-link-lib=dylib=unicorn");
}
} else {
println!("cargo:rustc-link-lib=static=unicorn");
}
@ -159,7 +163,11 @@ fn main() {
println!("cargo:rustc-link-search=native={}", dir.to_str().unwrap());
}
if cfg!(feature = "dynamic_linkage") {
println!("cargo:rustc-link-lib=dylib=unicorn");
if cc::Build::new().get_compiler().is_like_msvc() {
println!("cargo:rustc-link-lib=dylib=unicorn-import");
} else {
println!("cargo:rustc-link-lib=dylib=unicorn");
}
} else {
println!("cargo:rustc-link-arg=-Wl,-allow-multiple-definition");
println!("cargo:rustc-link-lib=static=unicorn");