Skip to content

Commit

Permalink
Fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
mmcauliffe committed Jun 3, 2023
1 parent 691b75c commit 61a7348
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@ def build_extension(self, ext: CMakeExtension) -> None:

# In this example, we pass in the version to C++. You might not need to.

if not cmake_generator or cmake_generator == "Ninja":
try:
import ninja

ninja_executable_path = Path(ninja.BIN_DIR) / "ninja"
cmake_args += [
"-GNinja",
f"-DCMAKE_MAKE_PROGRAM:FILEPATH={ninja_executable_path}",
]
except ImportError:
pass
if self.compiler.compiler_type != "msvc":
# Using Ninja-build since it a) is available as a wheel and b)
# multithreads automatically. MSVC would require all variables be
Expand All @@ -66,20 +77,8 @@ def build_extension(self, ext: CMakeExtension) -> None:
kaldi_root = os.environ.get("KALDI_ROOT", None)
if kaldi_root:
cmake_args += [f"-DKALDI_ROOT={kaldi_root}"]
if not cmake_generator or cmake_generator == "Ninja":
try:
import ninja

ninja_executable_path = Path(ninja.BIN_DIR) / "ninja"
cmake_args += [
"-GNinja",
f"-DCMAKE_MAKE_PROGRAM:FILEPATH={ninja_executable_path}",
]
except ImportError:
pass

else:
cmake_args += ["-GNinja"]
# Single config generators are handled "normally"
kaldi_root = os.environ.get("KALDI_ROOT", None)
if kaldi_root:
Expand Down

0 comments on commit 61a7348

Please sign in to comment.