waf: link tests with gtest library from submodule

That makes it possible to build tests on distributions that don't provide
official packages for gtest. For example, the travis environment is Ubuntu,
which doesn't have official package for gtest library.
This commit is contained in:
Gustavo Jose de Sousa 2016-01-18 14:41:21 -02:00 committed by Lucas De Marchi
parent 8d0522f6ef
commit e9195a3989
1 changed files with 7 additions and 6 deletions

13
wscript
View File

@ -80,6 +80,7 @@ def configure(cfg):
cfg.load('waf_unit_test') cfg.load('waf_unit_test')
cfg.load('mavgen') cfg.load('mavgen')
cfg.load('gbenchmark') cfg.load('gbenchmark')
cfg.load('gtest')
cfg.load('static_linking') cfg.load('static_linking')
cfg.start_msg('Benchmarks') cfg.start_msg('Benchmarks')
@ -88,12 +89,11 @@ def configure(cfg):
else: else:
cfg.end_msg('disabled', color='YELLOW') cfg.end_msg('disabled', color='YELLOW')
cfg.env.HAS_GTEST = cfg.check_cxx( cfg.start_msg('Unit tests')
lib='gtest', if cfg.env.HAS_GTEST:
mandatory=False, cfg.end_msg('enabled')
uselib_store='GTEST', else:
errmsg='not found, unit tests disabled', cfg.end_msg('disabled', color='YELLOW')
)
cfg.env.prepend_value('INCLUDES', [ cfg.env.prepend_value('INCLUDES', [
cfg.srcnode.abspath() + '/libraries/', cfg.srcnode.abspath() + '/libraries/',
@ -117,6 +117,7 @@ def list_boards(ctx):
print(*boards.get_boards_names()) print(*boards.get_boards_names())
def build(bld): def build(bld):
bld.load('gtest')
#generate mavlink headers #generate mavlink headers
bld( bld(