From 8d0522f6ef052534db08d73bfa82f05a83442846 Mon Sep 17 00:00:00 2001 From: Gustavo Jose de Sousa Date: Mon, 18 Jan 2016 14:46:51 -0200 Subject: [PATCH] waf: gtest: add gtest Waf tool Tool for building gtest from the submodule. --- Tools/ardupilotwaf/gtest.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Tools/ardupilotwaf/gtest.py diff --git a/Tools/ardupilotwaf/gtest.py b/Tools/ardupilotwaf/gtest.py new file mode 100644 index 0000000000..f1a1cd3095 --- /dev/null +++ b/Tools/ardupilotwaf/gtest.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python +# encoding: utf-8 + +""" +gtest is a Waf tool for test builds in Ardupilot +""" + +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.start_msg('Checking for gtest submodule') + readme = cfg.srcnode.find_resource('modules/gtest/README') + if not readme: + cfg.end_msg('not initialized', color='YELLOW') + return + cfg.end_msg('yes') + + cfg.env.HAS_GTEST = True + +def build(bld): + bld.stlib( + source='modules/gtest/src/gtest-all.cc', + target='gtest/gtest', + includes='modules/gtest/ modules/gtest/include', + export_includes='modules/gtest/include', + name='GTEST', + )