Fix CMake build on Windows with setuptools. (#5280)
This commit is contained in:
parent
595a00466d
commit
84e395d91e
@ -95,6 +95,7 @@ class BuildExt(build_ext.build_ext):
|
|||||||
def build(self, src_dir, build_dir, generator, build_tool=None, use_omp=1):
|
def build(self, src_dir, build_dir, generator, build_tool=None, use_omp=1):
|
||||||
'''Build the core library with CMake.'''
|
'''Build the core library with CMake.'''
|
||||||
cmake_cmd = ['cmake', src_dir, generator]
|
cmake_cmd = ['cmake', src_dir, generator]
|
||||||
|
|
||||||
for k, v in USER_OPTIONS.items():
|
for k, v in USER_OPTIONS.items():
|
||||||
arg = k.replace('-', '_').upper()
|
arg = k.replace('-', '_').upper()
|
||||||
value = str(v[2])
|
value = str(v[2])
|
||||||
@ -102,15 +103,15 @@ class BuildExt(build_ext.build_ext):
|
|||||||
if k == 'USE_OPENMP' and use_omp == 0:
|
if k == 'USE_OPENMP' and use_omp == 0:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if system() == 'Windows':
|
|
||||||
cmake_cmd.append('--build')
|
|
||||||
|
|
||||||
subprocess.check_call(cmake_cmd, cwd=build_dir)
|
subprocess.check_call(cmake_cmd, cwd=build_dir)
|
||||||
|
|
||||||
if system() != 'Windows':
|
if system() != 'Windows':
|
||||||
nproc = os.cpu_count()
|
nproc = os.cpu_count()
|
||||||
subprocess.check_call([build_tool, '-j' + str(nproc)],
|
subprocess.check_call([build_tool, '-j' + str(nproc)],
|
||||||
cwd=build_dir)
|
cwd=build_dir)
|
||||||
|
else:
|
||||||
|
subprocess.check_call(['cmake', '--build', '.',
|
||||||
|
'--config', 'Release'], cwd=build_dir)
|
||||||
|
|
||||||
def build_cmake_extension(self):
|
def build_cmake_extension(self):
|
||||||
'''Configure and build using CMake'''
|
'''Configure and build using CMake'''
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user