Bump version-compare to 0.1.0, remove some unwraps

This commit is contained in:
timvisee
2021-10-14 23:04:31 +02:00
parent 9d99d7f68a
commit 5b3b5eebbf
2 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ version = "^1"
optional = true
[build-dependencies]
version-compare = "0.0.10"
version-compare = "0.1"
cfg-if = "^1.0"
[features]
+6 -6
View File
@@ -112,16 +112,16 @@ fn compile_sdl2(sdl2_build_path: &Path, target_os: &str) -> PathBuf {
#[cfg(target_os = "linux")]
{
use version_compare::Version;
// Add common flag for affected version and above
use version_compare::{compare_to, Cmp};
if let Ok(version) = std::process::Command::new("cc")
.arg("-dumpversion")
.output()
{
let local_ver =
Version::from(std::str::from_utf8(&version.stdout).unwrap()).unwrap();
let affected_ver = Version::from("10").unwrap();
if local_ver >= affected_ver {
let affected =
compare_to(std::str::from_utf8(&version.stdout).unwrap(), "10", Cmp::Ge)
.unwrap_or(true);
if affected {
cfg.cflag("-fcommon");
}
}