From fc15cf5926e4abde9b0e15cccc0c1c9a0987bb2c Mon Sep 17 00:00:00 2001 From: Wictor Lund Date: Thu, 31 Mar 2016 09:04:25 +0300 Subject: [PATCH] build: multi-cpu build support --- sys/Cargo.toml | 3 +++ sys/build.rs | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/Cargo.toml b/sys/Cargo.toml index 1ef5509..7bd2992 100644 --- a/sys/Cargo.toml +++ b/sys/Cargo.toml @@ -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"] diff --git a/sys/build.rs b/sys/build.rs index e820a6d..9cd0f58 100644 --- a/sys/build.rs +++ b/sys/build.rs @@ -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")); }