mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Set the number of cores to use for building based on system properties.
This commit is contained in:
parent
0bb79f86de
commit
88dd3e4daf
6
setup.py
6
setup.py
@ -32,7 +32,9 @@ import sys
|
||||
import shutil
|
||||
import platform
|
||||
import subprocess
|
||||
import multiprocessing
|
||||
from distutils import log
|
||||
from math import ceil
|
||||
|
||||
from setuptools import setup, Extension
|
||||
from setuptools.command.build_ext import build_ext
|
||||
@ -134,7 +136,9 @@ class CMakeBuild(build_ext):
|
||||
build_args += ['--', '/m']
|
||||
else:
|
||||
cmake_args += ['-DCMAKE_BUILD_TYPE=' + cfg]
|
||||
build_args += ['--', '-j2']
|
||||
# Do a parallel build
|
||||
num_cores = int(ceil(multiprocessing.cpu_count()/2.0))
|
||||
build_args += ['--', '-j'+str(num_cores)]
|
||||
|
||||
build_folder = os.path.abspath(self.build_temp)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user