Skip to content

Commit f2f1e29

Browse files
authored
Merge pull request #1352 from ZengGengSen/master
chore(link): Fix not build link libraries
2 parents 2ab81ae + d55398b commit f2f1e29

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

sdl2-sys/build.rs

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,30 @@ fn link_sdl2(target_os: &str) {
244244
if cfg!(feature = "bundled")
245245
|| (cfg!(feature = "use-pkgconfig") == false && cfg!(feature = "use-vcpkg") == false)
246246
{
247-
println!("cargo:rustc-link-lib=static=SDL2main");
248-
if target_os.contains("windows") {
249-
println!("cargo:rustc-link-lib=static=SDL2-static");
247+
println!("cargo:rustc-link-lib=SDL2main");
248+
if target_os == "windows-msvc" {
249+
println!("cargo:rustc-link-lib=SDL2-static");
250250
} else {
251-
println!("cargo:rustc-link-lib=static=SDL2");
251+
println!("cargo:rustc-link-lib=SDL2");
252+
}
253+
254+
// bundled not support the other feature
255+
if !cfg!(feature = "bundled") {
256+
if cfg!(feature = "gfx") {
257+
println!("cargo:rustc-link-lib=SDL2_gfx");
258+
}
259+
260+
if cfg!(feature = "mixer") {
261+
println!("cargo:rustc-link-lib=SDL2_mixer");
262+
}
263+
264+
if cfg!(feature = "image") {
265+
println!("cargo:rustc-link-lib=SDL2_image");
266+
}
267+
268+
if cfg!(feature = "ttf") {
269+
println!("cargo:rustc-link-lib=SDL2_ttf");
270+
}
252271
}
253272
}
254273

0 commit comments

Comments
 (0)