python/makeproject: set appropriate build jobs count depending on the number of CPUs

This commit is contained in:
Felix Hädicke 2017-09-30 00:10:24 +02:00 committed by Max Kellermann
parent e6d607fef3
commit 146db77025

View File

@ -1,4 +1,4 @@
import subprocess
import subprocess, multiprocessing
from build.project import Project
@ -10,7 +10,12 @@ class MakeProject(Project):
self.install_target = install_target
def get_simultaneous_jobs(self):
return 12
try:
# use twice as many simultaneous jobs as we have CPU cores
return multiprocessing.cpu_count() * 2
except NotImplementedError:
# default to 12, if multiprocessing.cpu_count() is not implemented
return 12
def get_make_args(self, toolchain):
return ['--quiet', '-j' + str(self.get_simultaneous_jobs())]