From cb43d7575dcb93eb560228e9541f2d89774a1aa6 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Mon, 11 Jul 2022 15:45:50 +0800 Subject: [PATCH] Also build k2_torch_api target in setup.py --- setup.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 662cb2c04..80c58d2f3 100644 --- a/setup.py +++ b/setup.py @@ -139,6 +139,7 @@ def build_extension(self, ext: setuptools.extension.Extension): build_cmd = f''' cmake {cmake_args} -B {self.build_temp} -S {k2_dir} cmake --build {self.build_temp} --target _k2 --config Release -- -m + cmake --build {self.build_temp} --target k2_torch_api --config Release -- -m cmake --build {self.build_temp} --target install --config Release -- -m ''' print(f'build command is:\n{build_cmd}') @@ -150,10 +151,13 @@ def build_extension(self, ext: setuptools.extension.Extension): if ret != 0: raise Exception('Failed to build k2') + ret = os.system(f'cmake --build {self.build_temp} --target k2_torch_api --config Release -- -m') + if ret != 0: + raise Exception('Failed to build k2_torch_api') + ret = os.system(f'cmake --build {self.build_temp} --target install --config Release -- -m') if ret != 0: raise Exception('Failed to build k2') - else: build_cmd = f''' cd {self.build_temp} @@ -162,7 +166,7 @@ def build_extension(self, ext: setuptools.extension.Extension): cat k2/csrc/version.h - make {make_args} _k2 install + make {make_args} _k2 k2_torch_api install ''' print(f'build command is:\n{build_cmd}')