2016-01-18 12:46:51 -04:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# encoding: utf-8
|
|
|
|
|
|
|
|
"""
|
|
|
|
gtest is a Waf tool for test builds in Ardupilot
|
|
|
|
"""
|
|
|
|
|
2016-02-18 10:45:21 -04:00
|
|
|
from waflib import Utils
|
2016-02-05 08:59:13 -04:00
|
|
|
from waflib.Configure import conf
|
|
|
|
|
2016-03-07 18:12:41 -04:00
|
|
|
import boards
|
|
|
|
|
2016-01-18 12:46:51 -04:00
|
|
|
def configure(cfg):
|
2016-03-07 18:12:41 -04:00
|
|
|
board = boards.get_board(cfg.env.BOARD)
|
|
|
|
if isinstance(board, boards.px4):
|
|
|
|
# toolchain is currently broken for gtest
|
|
|
|
cfg.msg(
|
|
|
|
'Gtest',
|
|
|
|
'PX4 boards currently don\'t support compiling gtest',
|
|
|
|
color='YELLOW',
|
|
|
|
)
|
|
|
|
return
|
|
|
|
|
2016-01-18 12:46:51 -04:00
|
|
|
cfg.env.HAS_GTEST = False
|
|
|
|
|
|
|
|
if cfg.env.STATIC_LINKING:
|
|
|
|
# gtest uses a function (getaddrinfo) that is supposed to be linked
|
|
|
|
# dynamically
|
|
|
|
cfg.msg(
|
|
|
|
'Gtest',
|
|
|
|
'statically linked tests not supported',
|
|
|
|
color='YELLOW',
|
|
|
|
)
|
|
|
|
return
|
|
|
|
|
2016-02-05 12:09:21 -04:00
|
|
|
cfg.env.append_value('GIT_SUBMODULES', 'gtest')
|
2016-01-18 12:46:51 -04:00
|
|
|
cfg.env.HAS_GTEST = True
|
|
|
|
|
2016-02-05 08:59:13 -04:00
|
|
|
@conf
|
|
|
|
def libgtest(bld, **kw):
|
2016-02-18 10:45:21 -04:00
|
|
|
kw['cxxflags'] = Utils.to_list(kw.get('cxxflags', [])) + ['-Wno-undef']
|
2016-02-05 08:59:13 -04:00
|
|
|
kw.update(
|
2016-01-18 12:46:51 -04:00
|
|
|
source='modules/gtest/src/gtest-all.cc',
|
|
|
|
target='gtest/gtest',
|
|
|
|
includes='modules/gtest/ modules/gtest/include',
|
|
|
|
export_includes='modules/gtest/include',
|
|
|
|
name='GTEST',
|
|
|
|
)
|
2016-02-05 08:59:13 -04:00
|
|
|
return bld.stlib(**kw)
|