From 6e68e34a0f125f0fba0baaa8c2f82709a05c4fe9 Mon Sep 17 00:00:00 2001 From: moto <855818+mthrok@users.noreply.github.com> Date: Thu, 7 Jan 2021 15:17:05 +0000 Subject: [PATCH] Merge third_party/build directory in to build --- build_tools/setup_helpers/extension.py | 13 +++++-------- setup.py | 1 - 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/build_tools/setup_helpers/extension.py b/build_tools/setup_helpers/extension.py index 17d18ed979e..0dc306f07ee 100644 --- a/build_tools/setup_helpers/extension.py +++ b/build_tools/setup_helpers/extension.py @@ -102,18 +102,15 @@ 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=[ @@ -121,7 +118,7 @@ def _build_third_party(): 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, ) @@ -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) diff --git a/setup.py b/setup.py index d7832ef085e..8168472ecfe 100644 --- a/setup.py +++ b/setup.py @@ -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():