blob: 0a3db65630b8131d0e865cf6e1d3cd0d616a6bf5 [file] [log] [blame]
Yingdi Yu40cd1c32014-04-17 15:02:17 -07001# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2#
3# Copyright (c) 2014, Regents of the University of California
4#
5# GPL 3.0 license, see the COPYING.md file for more information
6
7from waflib import TaskGen
8
9def options(opt):
10 opt.add_option('--with-coverage', action='store_true', default=False, dest='with_coverage',
11 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'