sdl2-sys: Skip defining _fltused (#1082)

Upstream SDL2 will include _fltused in the libary artifact as a
__declspec(selectany) symbol.  This seems to cause problems however with
a definition already coming from the top-most rust link, as it already
gets defined elsewhere when building statically.

Rather than patching the upstream codebase with another patch, just
specify this flag in all cases as we don't require it in any of our rust
builds.
This commit is contained in:
waych
2021-04-02 09:56:27 +00:00
committed by GitHub
parent a05c28763b
commit 68aebc4419
+6
View File
@@ -305,6 +305,12 @@ fn patch_sdl2(sdl2_source_path: &Path) {
fn compile_sdl2(sdl2_build_path: &Path, target_os: &str) -> PathBuf {
let mut cfg = cmake::Config::new(sdl2_build_path);
// Override __FLTUSED__ to keep the _fltused symbol from getting defined in the static build.
// This conflicts and fails to link properly when building statically on Windows, likely due to
// COMDAT conflicts/breakage happening somewhere.
#[cfg(feature = "static-link")]
cfg.cflag("-D__FLTUSED__");
#[cfg(target_os = "linux")]
{
use version_compare::Version;