Ask Ninja to expand rsp files in compile_commands.json

pull/4973/head
Aleksey Gurtovoy 6 years ago committed by Jussi Pakkanen
parent 025e11c9a7
commit 48e6db89ab
  1. 8
      mesonbuild/backend/ninjabackend.py
  2. 6
      mesonbuild/environment.py

@ -285,9 +285,10 @@ int dummy;
def generate(self, interp):
self.interpreter = interp
self.ninja_command = environment.detect_ninja(log=True)
if self.ninja_command is None:
ninja = environment.detect_ninja_command_and_version(log=True)
if ninja is None:
raise MesonException('Could not detect Ninja v1.5 or newer')
(self.ninja_command, self.ninja_version) = ninja
outfilename = os.path.join(self.environment.get_build_dir(), self.ninja_filename)
tempfilename = outfilename + '~'
with open(tempfilename, 'w', encoding='utf-8') as outfile:
@ -342,7 +343,8 @@ int dummy;
for lang in self.environment.coredata.compilers[for_machine]:
rules += [self.get_compiler_rule_name(lang, for_machine)]
rules += [self.get_pch_rule_name(lang, for_machine)]
ninja_compdb = [self.ninja_command, '-t', 'compdb'] + rules
compdb_options = ['-x'] if mesonlib.version_compare(self.ninja_version, '>=1.9') else []
ninja_compdb = [self.ninja_command, '-t', 'compdb'] + compdb_options + rules
builddir = self.environment.get_build_dir()
try:
jsondb = subprocess.check_output(ninja_compdb, cwd=builddir)

@ -141,6 +141,10 @@ def find_coverage_tools():
return gcovr_exe, gcovr_new_rootdir, lcov_exe, genhtml_exe
def detect_ninja(version: str = '1.5', log: bool = False) -> str:
r = detect_ninja_command_and_version(version, log)
return r[0] if r else None
def detect_ninja_command_and_version(version: str = '1.5', log: bool = False) -> (str, str):
env_ninja = os.environ.get('NINJA', None)
for n in [env_ninja] if env_ninja else ['ninja', 'ninja-build', 'samu']:
try:
@ -162,7 +166,7 @@ def detect_ninja(version: str = '1.5', log: bool = False) -> str:
if name == 'samu':
name = 'samurai'
mlog.log('Found {}-{} at {}'.format(name, found, quote_arg(n)))
return n
return (n, found)
def get_llvm_tool_names(tool: str) -> typing.List[str]:
# Ordered list of possible suffixes of LLVM executables to try. Start with

Loading…
Cancel
Save