Skip to content

Commit 92fb34d

Browse files
authored
Merge pull request #1010 from j4qfrost/patch-allow-gcc10
Patch allow gcc10
2 parents cf8c382 + e390977 commit 92fb34d

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Diff for: sdl2-sys/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ version = "^0.3"
4848
optional = true
4949

5050
[build-dependencies]
51+
version-compare = "0.0.10"
5152
cfg-if = "^0.1"
5253

5354
[features]

Diff for: sdl2-sys/build.rs

+13
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,19 @@ fn compile_sdl2(sdl2_build_path: &Path, target_os: &str) -> PathBuf {
267267
let mut cfg = cmake::Config::new(sdl2_build_path);
268268
cfg.profile("release");
269269

270+
#[cfg(target_os = "linux")]
271+
{
272+
use version_compare::Version;
273+
if let Ok(version) = std::process::Command::new("cc").arg("-dumpversion").output() {
274+
let local_ver = Version::from(std::str::from_utf8(&version.stdout).unwrap()).unwrap();
275+
let affected_ver = Version::from("10").unwrap();
276+
277+
if local_ver >= affected_ver {
278+
cfg.cflag("-fcommon");
279+
}
280+
}
281+
}
282+
270283
if target_os == "windows-gnu" {
271284
cfg.define("VIDEO_OPENGLES", "OFF");
272285
}

0 commit comments

Comments
 (0)