mcompile: detect_ninja

pull/7207/head
TheQwertiest 5 years ago committed by Xavier Claessens
parent 7c2f9e2b57
commit 4b6471f1d5
  1. 11
      mesonbuild/mcompile.py

@ -24,6 +24,7 @@ from . import mlog
from . import mesonlib from . import mesonlib
from . import coredata from . import coredata
from .mesonlib import MesonException from .mesonlib import MesonException
from mesonbuild.environment import detect_ninja
if T.TYPE_CHECKING: if T.TYPE_CHECKING:
import argparse import argparse
@ -42,15 +43,9 @@ def get_backend_from_coredata(builddir: Path) -> str:
return coredata.load(str(builddir)).get_builtin_option('backend') return coredata.load(str(builddir)).get_builtin_option('backend')
def get_parsed_args_ninja(options: 'argparse.Namespace', builddir: Path): def get_parsed_args_ninja(options: 'argparse.Namespace', builddir: Path):
runner = os.environ.get('NINJA') runner = detect_ninja()
if not runner:
if shutil.which('ninja'):
runner = 'ninja'
elif shutil.which('samu'):
runner = 'samu'
if runner is None: if runner is None:
raise MesonException('Cannot find either ninja or samu.') raise MesonException('Cannot find ninja.')
mlog.log('Found runner:', runner) mlog.log('Found runner:', runner)
cmd = [runner, '-C', builddir.as_posix()] cmd = [runner, '-C', builddir.as_posix()]

Loading…
Cancel
Save