build: multi-cpu build support

This commit is contained in:
Wictor Lund
2023-05-24 21:49:22 +02:00
committed by Till Höppner
parent 0c8c674bac
commit fc15cf5926
2 changed files with 8 additions and 1 deletions
+3
View File
@@ -14,6 +14,9 @@ keywords = ["audio", "video"]
[dependencies]
libc = "0.2"
[build-dependencies]
num_cpus = "0.2.11"
[features]
default = ["avcodec", "avdevice", "avfilter", "avformat", "avresample", "swresample", "swscale"]
+5 -1
View File
@@ -1,3 +1,5 @@
extern crate num_cpus;
use std::env;
use std::fs::{self, File};
use std::io::{self, Write};
@@ -207,7 +209,9 @@ fn build() -> io::Result<()> {
}
// run make
if !try!(Command::new("make").current_dir(&source()).status()).success() {
if !try!(Command::new("make")
.arg("-j").arg(num_cpus::get().to_string())
.current_dir(&source()).status()).success() {
return Err(io::Error::new(io::ErrorKind::Other, "make failed"));
}