blob: 0a3db65630b8131d0e865cf6e1d3cd0d616a6bf5 [file] [log] [blame]
Alexander Afanasyev689569b2014-02-16 20:20:07 -08001# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
Alexander Afanasyev97e4cac2014-03-28 10:55:11 -07002#
3# Copyright (c) 2014, Regents of the University of California
4#
5# GPL 3.0 license, see the COPYING.md file for more information
Alexander Afanasyev689569b2014-02-16 20:20:07 -08006
7from waflib import TaskGen
8
9def options(opt):
Alexander Afanasyev97e4cac2014-03-28 10:55:11 -070010 opt.add_option('--with-coverage', action='store_true', default=False, dest='with_coverage',
Alexander Afanasyev689569b2014-02-16 20:20:07 -080011 help='''Set compiler flags for gcc to enable code coverage information''')
12
13def configure(conf):
14 if conf.options.with_coverage:
15 conf.check_cxx(cxxflags=['-fprofile-arcs', '-ftest-coverage', '-fPIC'],
16 linkflags=['-fprofile-arcs'], uselib_store='GCOV', mandatory=True)
17
18@TaskGen.feature('cxx','cc')
19@TaskGen.after('process_source')
20def add_coverage(self):
21 if getattr(self, 'use', ''):
22 self.use += ' GCOV'
23 else:
24 self.use = 'GCOV'