in setup.py [0:0]
def build_cmake(self, ext):
cwd = pathlib.Path().absolute()
# Create build dir
build_temp = pathlib.Path(self.build_temp)
build_temp.mkdir(parents=True, exist_ok=True)
extdir = pathlib.Path(self.get_ext_fullpath(ext.name))
extdir.mkdir(parents=True, exist_ok=True)
libdir = os.path.abspath(os.path.dirname(extdir))
print("Libdir: " + libdir)
# CMake args
config = 'Debug' if self.debug else 'Release'
cmake_args = [
'-DCMAKE_BUILD_TYPE=' + config,
'-DPYTHON_PACKAGE_DIR=' + libdir
]
if len(self.cmake_args) > 0:
cmake_args += self.cmake_args.split(' ')
print("cmake_args: " + str(cmake_args))
# Build args
build_args = [
'--config', config,
'--', '-j4'
]
os.chdir(str(build_temp))
self.spawn(['cmake', str(cwd)] + cmake_args)
if not self.dry_run:
self.spawn(['cmake', '--build', '.'] + build_args)
os.chdir(str(cwd))