Skip to content

Commit c5d8f5c

Browse files
waychCobrand
authored andcommitted
Revert "Allow bundled debug build (#1081)"
Broke non-"static-link" builds on Windows when using "bundled" and non release builds. Closes #1088
1 parent 6d18305 commit c5d8f5c

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

changelog.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ when upgrading from a version of rust-sdl2 to another.
33

44
### Unreleased
55

6-
Nothing for now
6+
* Rollback PR #1081: Broke dynamic linking on Windows #1088
77

88
### v0.34.4
99

sdl2-sys/build.rs

+3-15
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ fn patch_sdl2(sdl2_source_path: &Path) {
293293
#[cfg(feature = "bundled")]
294294
fn compile_sdl2(sdl2_build_path: &Path, target_os: &str) -> PathBuf {
295295
let mut cfg = cmake::Config::new(sdl2_build_path);
296+
cfg.profile("release");
296297

297298
// Override __FLTUSED__ to keep the _fltused symbol from getting defined in the static build.
298299
// This conflicts and fails to link properly when building statically on Windows, likely due to
@@ -410,24 +411,11 @@ fn link_sdl2(target_os: &str) {
410411

411412
#[cfg(feature = "static-link")]
412413
{
413-
// There's no way to extract this from `cmake::Config` so we have to emulate their
414-
// behaviour here (see the source for `cmake::Config::build`).
415-
let debug_postfix = match (
416-
&env::var("OPT_LEVEL").unwrap_or_default()[..],
417-
&env::var("PROFILE").unwrap_or_default()[..],
418-
) {
419-
("1", _) | ("2", _) | ("3", _) | ("s", _) | ("z", _) => "",
420-
("0", _) => "d",
421-
(_, "debug") => "d",
422-
// ("0", _) => "",
423-
// (_, "debug") => "",
424-
(_, _) => "",
425-
};
426414
if cfg!(feature = "bundled")
427415
|| (cfg!(feature = "use-pkgconfig") == false && cfg!(feature = "use-vcpkg") == false)
428416
{
429-
println!("cargo:rustc-link-lib=static=SDL2main{}", debug_postfix);
430-
println!("cargo:rustc-link-lib=static=SDL2{}", debug_postfix);
417+
println!("cargo:rustc-link-lib=static=SDL2main");
418+
println!("cargo:rustc-link-lib=static=SDL2");
431419
}
432420

433421
// Also linked to any required libraries for each supported platform

0 commit comments

Comments
 (0)