ninjabackend: generate "compile_commands.json" even for cross compile

Just add 'c_CROSS_COMPILER' and 'cpp_CROSS_COMPILER' to the
'ninja -t compdb' command.
pull/763/merge
Fabio Porcedda 8 years ago committed by Jussi Pakkanen
parent 95248f0f26
commit 7cece438cc
  1. 4
      mesonbuild/backend/ninjabackend.py

@ -210,9 +210,11 @@ int dummy;
# http://clang.llvm.org/docs/JSONCompilationDatabase.html
def generate_compdb(self):
ninja_exe = environment.detect_ninja()
ninja_compdb = [ninja_exe, '-t', 'compdb', 'c_COMPILER', 'cpp_COMPILER', 'c_CROSS_COMPILER',
'cpp_CROSS_COMPILER']
builddir = self.environment.get_build_dir()
try:
jsondb = subprocess.check_output([ninja_exe, '-t', 'compdb', 'c_COMPILER', 'cpp_COMPILER'], cwd=builddir)
jsondb = subprocess.check_output(ninja_compdb, cwd=builddir)
with open(os.path.join(builddir, 'compile_commands.json'), 'wb') as f:
f.write(jsondb)
except Exception:

Loading…
Cancel
Save