Skip to content

Commit

Permalink
Also build k2_torch_api target in setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj committed Jul 11, 2022
1 parent 6ccbe9c commit cb43d75
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}')
Expand All @@ -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}
Expand All @@ -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}')

Expand Down

0 comments on commit cb43d75

Please sign in to comment.