CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

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