diff options
author | Aleksey Gurtovoy <agurtovoy@acm.org> | 2019-11-01 15:24:58 -0500 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-11-02 16:16:09 +0200 |
commit | 48e6db89ab702c0f7c0fb8b9cbcac857dce9c6ef (patch) | |
tree | bbc4f72a5b06176f5eeb20cf6a3b8e2abea73d70 | |
parent | 025e11c9a72f313c6fa667e085b1de0e55a38781 (diff) | |
download | meson-48e6db89ab702c0f7c0fb8b9cbcac857dce9c6ef.zip meson-48e6db89ab702c0f7c0fb8b9cbcac857dce9c6ef.tar.gz meson-48e6db89ab702c0f7c0fb8b9cbcac857dce9c6ef.tar.bz2 |
Ask Ninja to expand rsp files in compile_commands.json
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 8 | ||||
-rw-r--r-- | mesonbuild/environment.py | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 0f65253..985b910 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.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) diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 99428c7..a1b46a8 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -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 |