Skip to content

Commit

Permalink
fix(link): divide the link libraries
Browse files Browse the repository at this point in the history
    Divide the if statement into (1) bundled ; (2) not usepkgconfig && not vcpkg.
    The main reason is that bundled is not supported with gfx, image, ttf, etc.
  • Loading branch information
ZengGengSen committed Dec 3, 2023
1 parent ceaca2f commit d55398b
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions sdl2-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,20 +251,23 @@ fn link_sdl2(target_os: &str) {
println!("cargo:rustc-link-lib=SDL2");
}

if cfg!(feature = "gfx") {
println!("cargo:rustc-link-lib=SDL2_gfx");
}
// 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 = "mixer") {
println!("cargo:rustc-link-lib=SDL2_mixer");
}

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

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

Expand Down

0 comments on commit d55398b

Please sign in to comment.