waf: enable fully static linking

Some boards (e.g. bebop) require fully statically linked binaries.
This commit is contained in:
Gustavo Jose de Sousa 2016-01-07 09:16:53 -02:00 committed by Lucas De Marchi
parent c90b0e8659
commit e21d41afe3
2 changed files with 12 additions and 3 deletions

View File

@ -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],

View File

@ -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: