Skip to content

Commit

Permalink
Merge third_party/build directory in to build
Browse files Browse the repository at this point in the history
  • Loading branch information
mthrok committed Jan 7, 2021
1 parent e200eea commit 6e68e34
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
13 changes: 5 additions & 8 deletions build_tools/setup_helpers/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,26 +102,23 @@ def _get_extra_objects():
if _BUILD_TRANSDUCER:
libs += ['libwarprnnt.a']

objs = []
for lib in libs:
objs.append(str(_TP_INSTALL_DIR / 'lib' / lib))
return objs
return [str(_TP_INSTALL_DIR / 'lib' / lib) for lib in libs]


def _get_libraries():
return [] if _BUILD_SOX else ['sox']


def _build_third_party():
build_dir = str(_TP_BASE_DIR / 'build')
def _build_third_party(base_build_dir):
build_dir = os.path.join(base_build_dir, 'third_party')
os.makedirs(build_dir, exist_ok=True)
subprocess.run(
args=[
'cmake',
f'-DCMAKE_INSTALL_PREFIX={_TP_INSTALL_DIR}',
f'-DBUILD_SOX={"ON" if _BUILD_SOX else "OFF"}',
f'-DBUILD_TRANSDUCER={"ON" if _BUILD_TRANSDUCER else "OFF"}',
'..'],
f'{_TP_BASE_DIR}'],
cwd=build_dir,
check=True,
)
Expand Down Expand Up @@ -157,5 +154,5 @@ def get_ext_modules(debug=False):
class BuildExtension(TorchBuildExtension):
def build_extension(self, ext):
if ext.name == _EXT_NAME and _BUILD_SOX:
_build_third_party()
_build_third_party(self.build_temp)
super().build_extension(ext)
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ def run(self):
# Remove build directory
build_dirs = [
ROOT_DIR / 'build',
ROOT_DIR / 'third_party' / 'build',
]
for path in build_dirs:
if path.exists():
Expand Down

0 comments on commit 6e68e34

Please sign in to comment.