Skip to content

Commit

Permalink
Merge pull request #1397 from sandydoo/fix-static-linking
Browse files Browse the repository at this point in the history
Fix static linking
  • Loading branch information
Cobrand authored Jun 13, 2024
2 parents 79f9ac7 + 02354b2 commit 22a8c31
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions sdl2-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,29 +245,29 @@ 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=SDL2main");
println!("cargo:rustc-link-lib=static=SDL2main");
if target_os == "windows-msvc" {
println!("cargo:rustc-link-lib=SDL2-static");
println!("cargo:rustc-link-lib=static=SDL2-static");
} else {
println!("cargo:rustc-link-lib=SDL2");
println!("cargo:rustc-link-lib=static=SDL2");
}

// bundled not support the other feature
// Additional SDL libraries are not supported when using "bundled"
if !cfg!(feature = "bundled") {
if cfg!(feature = "gfx") {
println!("cargo:rustc-link-lib=SDL2_gfx");
println!("cargo:rustc-link-lib=static=SDL2_gfx");
}

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

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

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

0 comments on commit 22a8c31

Please sign in to comment.