mirror of
https://github.com/encounter/rust-ffmpeg.git
synced 2026-07-10 21:18:39 -07:00
build: use gcc to detect compiler
This commit is contained in:
@@ -16,6 +16,7 @@ libc = "0.2"
|
||||
|
||||
[build-dependencies]
|
||||
num_cpus = "0.2.11"
|
||||
gcc = "0.3"
|
||||
|
||||
[features]
|
||||
default = ["avcodec", "avdevice", "avfilter", "avformat", "avresample", "swresample", "swscale"]
|
||||
|
||||
+3
-8
@@ -1,4 +1,5 @@
|
||||
extern crate num_cpus;
|
||||
extern crate gcc;
|
||||
|
||||
use std::env;
|
||||
use std::fs::{self, File};
|
||||
@@ -256,15 +257,9 @@ fn check_features(infos: &Vec<(&'static str, Option<&'static str>, &'static str)
|
||||
"#, includes_code=includes_code, main_code=main_code).expect("Write failed");
|
||||
|
||||
let executable = out_dir.join(if cfg!(windows) { "check.exe" } else { "check" });
|
||||
let compiler =
|
||||
if cfg!(windows) || env::var("MSYSTEM").unwrap_or("".to_string()).starts_with("MINGW32") {
|
||||
"gcc"
|
||||
}
|
||||
else {
|
||||
"cc"
|
||||
};
|
||||
let mut compiler = gcc::Config::new().get_compiler().to_command();
|
||||
|
||||
if !Command::new(compiler).current_dir(&out_dir)
|
||||
if !compiler.current_dir(&out_dir)
|
||||
.arg("-I").arg(search().join("include").to_string_lossy().into_owned())
|
||||
.arg("-o").arg(&executable)
|
||||
.arg("check.c")
|
||||
|
||||
Reference in New Issue
Block a user