2016-01-18 12:46:51 -04:00
|
|
|
# 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-07-13 10:50:31 -03:00
|
|
|
cfg.env.HAS_GTEST = False
|
|
|
|
if cfg.options.disable_tests:
|
|
|
|
return
|
|
|
|
|
2016-05-20 15:36:15 -03:00
|
|
|
board = cfg.get_board()
|
2018-11-20 06:15:21 -04:00
|
|
|
if isinstance(board, boards.chibios):
|
2016-03-07 18:12:41 -04:00
|
|
|
# toolchain is currently broken for gtest
|
|
|
|
cfg.msg(
|
|
|
|
'Gtest',
|
2018-01-05 20:05:55 -04:00
|
|
|
'STM32 boards currently don\'t support compiling gtest',
|
2016-03-07 18:12:41 -04:00
|
|
|
color='YELLOW',
|
|
|
|
)
|
|
|
|
return
|
|
|
|
|
2016-01-18 12:46:51 -04:00
|
|
|
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(
|
2019-08-15 20:42:45 -03:00
|
|
|
source='modules/gtest/googletest/src/gtest-all.cc',
|
2016-01-18 12:46:51 -04:00
|
|
|
target='gtest/gtest',
|
2019-08-15 20:42:45 -03:00
|
|
|
includes='modules/gtest/googletest modules/gtest/googletest/include',
|
|
|
|
export_includes='modules/gtest/googletest/include',
|
2016-01-18 12:46:51 -04:00
|
|
|
name='GTEST',
|
|
|
|
)
|
2016-02-05 08:59:13 -04:00
|
|
|
return bld.stlib(**kw)
|