Support for cppcheck.

pull/15/head
Jussi Pakkanen 12 years ago
parent 4d1ee0b8f2
commit 83f0e6744e
  1. 11
      backends.py
  2. 1
      coredata.py
  3. 6
      environment.py

@ -699,6 +699,15 @@ class NinjaBackend(Backend):
other_deps.append(outfilename)
return (src_deps, other_deps)
def generate_cppcheck_target(self, outfile):
cppcheck_exe = environment.find_cppcheck()
if not cppcheck_exe:
return
elem = NinjaBuildElement('cppcheck', 'CUSTOM_COMMAND', [])
elem.add_item('COMMAND', [cppcheck_exe, self.environment.get_source_dir()])
elem.add_item('description', 'Running cppchecker')
elem.write(outfile)
def generate_ending(self, outfile):
targetlist = [self.get_target_filename(t) for t in self.build.get_targets().values()]
elem = NinjaBuildElement('all', 'phony', targetlist)
@ -723,3 +732,5 @@ class NinjaBackend(Backend):
elem = NinjaBuildElement(deps, 'phony', '')
elem.write(outfile)
self.generate_cppcheck_target(outfile)

@ -68,6 +68,7 @@ forbidden_target_names = {'clean': None,
'test-valgrind': None,
'install': None,
'build.ninja': None,
'cppcheck': None,
}
class MesonException(Exception):

@ -451,6 +451,12 @@ def find_valgrind():
valgrind_exe = None
return valgrind_exe
def find_cppcheck():
cppcheck_exe = 'cppcheck'
if not exe_exists([cppcheck_exe, '-h']):
cppcheck_exe = None
return cppcheck_exe
def is_osx():
return platform.system().lower() == 'darwin'

Loading…
Cancel
Save