Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Ardupilot
GitHub Repository: Ardupilot/ardupilot
Path: blob/master/Tools/ardupilotwaf/gtest.py
9688 views
1
# encoding: utf-8
2
3
# flake8: noqa
4
5
"""
6
gtest is a Waf tool for test builds in Ardupilot
7
"""
8
9
from waflib import Utils
10
from waflib.Configure import conf
11
12
import boards
13
14
def configure(cfg):
15
cfg.env.HAS_GTEST = False
16
if cfg.options.disable_tests:
17
return
18
19
board = cfg.get_board()
20
if isinstance(board, boards.chibios):
21
# toolchain is currently broken for gtest
22
cfg.msg(
23
'Gtest',
24
'STM32 boards currently don\'t support compiling gtest',
25
color='YELLOW',
26
)
27
return
28
29
if cfg.env.STATIC_LINKING:
30
# gtest uses a function (getaddrinfo) that is supposed to be linked
31
# dynamically
32
cfg.msg(
33
'Gtest',
34
'statically linked tests not supported',
35
color='YELLOW',
36
)
37
return
38
39
cfg.env.append_value('GIT_SUBMODULES', 'gtest')
40
cfg.env.HAS_GTEST = True
41
42
@conf
43
def libgtest(bld, **kw):
44
kw['cxxflags'] = Utils.to_list(kw.get('cxxflags', [])) + ['-Wno-undef']
45
kw.update(
46
source='modules/gtest/googletest/src/gtest-all.cc',
47
target='gtest/gtest',
48
includes='modules/gtest/googletest modules/gtest/googletest/include',
49
export_includes='modules/gtest/googletest/include',
50
name='GTEST',
51
)
52
return bld.stlib(**kw)
53
54