From e21d41afe38678916f0ea856fdfce40b9c588c3d Mon Sep 17 00:00:00 2001 From: Gustavo Jose de Sousa Date: Thu, 7 Jan 2016 09:16:53 -0200 Subject: [PATCH] waf: enable fully static linking Some boards (e.g. bebop) require fully statically linked binaries. --- Tools/ardupilotwaf/ardupilotwaf.py | 14 +++++++++++--- wscript | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Tools/ardupilotwaf/ardupilotwaf.py b/Tools/ardupilotwaf/ardupilotwaf.py index 02fb98ba5e..d24bc52d4b 100644 --- a/Tools/ardupilotwaf/ardupilotwaf.py +++ b/Tools/ardupilotwaf/ardupilotwaf.py @@ -85,6 +85,8 @@ def program(bld, **kw): name = bld.path.name kw['defines'].extend(_get_legacy_defines(name)) + kw['features'] = common_features(bld) + kw.get('features', []) + target = bld.bldnode.make_node(name + '.' + bld.env.BOARD) bld.program( target=target, @@ -103,6 +105,12 @@ def _get_next_idx(): LAST_IDX += 1 return LAST_IDX +def common_features(bld): + features = [] + if bld.env.STATIC_LINKING: + features.append('static_linking') + return features + def vehicle_stlib(bld, **kw): if 'name' not in kw: bld.fatal('Missing name for vehicle_stlib') @@ -135,9 +143,9 @@ def find_tests(bld, use=[]): if not bld.env.HAS_GTEST: return - features = '' + features = common_features(bld) if bld.cmd == 'check': - features='test' + features.append('test') use = Utils.to_list(use) use.append('GTEST') @@ -163,7 +171,7 @@ def find_benchmarks(bld, use=[]): for f in bld.path.ant_glob(incl='*.cpp'): target = f.change_ext('.' + bld.env.BOARD) bld.program( - features=['gbenchmark'], + features=common_features(bld) + ['gbenchmark'], target=target, includes=includes, source=[f], diff --git a/wscript b/wscript index 0450b72fe1..e41885943b 100644 --- a/wscript +++ b/wscript @@ -79,6 +79,7 @@ def configure(cfg): cfg.load('clang_compilation_database') cfg.load('waf_unit_test') cfg.load('gbenchmark') + cfg.load('static_linking') cfg.start_msg('Benchmarks') if cfg.env.HAS_GBENCHMARK: