ardupilot/Tools/ardupilotwaf/gtest.py
Lucas De Marchi f0277cecb4 waf: ignore -Wundef for gtest
The gtest header uses lots of undefined macros, showing lots of warnings
if we enable -Wundef. Ideally we could use a #pragma to ignore the
warning only from the correct header, but this currently doesn't work
with g++ - see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431

So for now we disable the warning completely when compiling gtest or any
test that uses its header.

Thanks Gustavo Sousa
2016-02-19 12:34:24 -02:00

38 lines
928 B
Python

#!/usr/bin/env python
# encoding: utf-8
"""
gtest is a Waf tool for test builds in Ardupilot
"""
from waflib import Utils
from waflib.Configure import conf
def configure(cfg):
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
cfg.env.append_value('GIT_SUBMODULES', 'gtest')
cfg.env.HAS_GTEST = True
@conf
def libgtest(bld, **kw):
kw['cxxflags'] = Utils.to_list(kw.get('cxxflags', [])) + ['-Wno-undef']
kw.update(
source='modules/gtest/src/gtest-all.cc',
target='gtest/gtest',
includes='modules/gtest/ modules/gtest/include',
export_includes='modules/gtest/include',
name='GTEST',
)
return bld.stlib(**kw)