Skip to content

Commit

Permalink
Merge pull request #1352 from ZengGengSen/master
Browse files Browse the repository at this point in the history
chore(link): Fix not build link libraries
  • Loading branch information
Cobrand authored Dec 3, 2023
2 parents 2ab81ae + d55398b commit f2f1e29
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions sdl2-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,30 @@ fn link_sdl2(target_os: &str) {
if cfg!(feature = "bundled")
|| (cfg!(feature = "use-pkgconfig") == false && cfg!(feature = "use-vcpkg") == false)
{
println!("cargo:rustc-link-lib=static=SDL2main");
if target_os.contains("windows") {
println!("cargo:rustc-link-lib=static=SDL2-static");
println!("cargo:rustc-link-lib=SDL2main");
if target_os == "windows-msvc" {
println!("cargo:rustc-link-lib=SDL2-static");
} else {
println!("cargo:rustc-link-lib=static=SDL2");
println!("cargo:rustc-link-lib=SDL2");
}

// bundled not support the other feature
if !cfg!(feature = "bundled") {
if cfg!(feature = "gfx") {
println!("cargo:rustc-link-lib=SDL2_gfx");
}

if cfg!(feature = "mixer") {
println!("cargo:rustc-link-lib=SDL2_mixer");
}

if cfg!(feature = "image") {
println!("cargo:rustc-link-lib=SDL2_image");
}

if cfg!(feature = "ttf") {
println!("cargo:rustc-link-lib=SDL2_ttf");
}
}
}

Expand Down

0 comments on commit f2f1e29

Please sign in to comment.