waf: allow for pre_build hook in board modules

This commit is contained in:
Andrew Tridgell 2018-03-01 18:26:28 +11:00
parent 74ed19f460
commit 2476a51908
1 changed files with 10 additions and 2 deletions

12
wscript
View File

@ -272,7 +272,7 @@ def _build_dynamic_sources(bld):
], ],
) )
if bld.get_board().with_uavcan: if bld.get_board().with_uavcan or bld.env.HAL_WITH_UAVCAN==True:
bld( bld(
features='uavcangen', features='uavcangen',
source=bld.srcnode.ant_glob('modules/uavcan/dsdl/uavcan/**/*.uavcan'), source=bld.srcnode.ant_glob('modules/uavcan/dsdl/uavcan/**/*.uavcan'),
@ -370,6 +370,12 @@ def _build_post_funs(bld):
if bld.env.SUBMODULE_UPDATE: if bld.env.SUBMODULE_UPDATE:
bld.git_submodule_post_fun() bld.git_submodule_post_fun()
def load_pre_build(bld):
'''allow for a pre_build() function in build modules'''
brd = bld.get_board()
if getattr(brd, 'pre_build', None):
brd.pre_build(bld)
def build(bld): def build(bld):
config_hash = Utils.h_file(bld.bldnode.make_node('ap_config.h').abspath()) config_hash = Utils.h_file(bld.bldnode.make_node('ap_config.h').abspath())
bld.env.CCDEPS = config_hash bld.env.CCDEPS = config_hash
@ -383,7 +389,9 @@ def build(bld):
use=['mavlink'], use=['mavlink'],
cxxflags=['-include', 'ap_config.h'], cxxflags=['-include', 'ap_config.h'],
) )
load_pre_build(bld)
if bld.get_board().with_uavcan: if bld.get_board().with_uavcan:
bld.env.AP_LIBRARIES_OBJECTS_KW['use'] += ['uavcan'] bld.env.AP_LIBRARIES_OBJECTS_KW['use'] += ['uavcan']