waf: use pre_build hook for ChibiOS

this fixes dynamic uavcan building
This commit is contained in:
Andrew Tridgell 2018-03-01 18:26:49 +11:00
parent 2476a51908
commit 2075a3da7d
2 changed files with 16 additions and 3 deletions

View File

@ -189,6 +189,10 @@ class Board:
cfg.define('__STDC_FORMAT_MACROS', 1)
def pre_build(self, bld):
'''pre-build hook that gets called before dynamic sources'''
pass
def build(self, bld):
bld.ap_version_append_str('GIT_VERSION', bld.git_head_hash(short=True))
import time
@ -366,6 +370,14 @@ class chibios(Board):
super(chibios, self).build(bld)
bld.load('chibios')
def pre_build(self, bld):
'''pre-build hook that gets called before dynamic sources'''
from waflib.Context import load_tool
module = load_tool('chibios', [], with_sys_path=True)
fun = getattr(module, 'pre_build', None)
if fun:
fun(bld)
class skyviper_f412(chibios):
name = 'skyviper-f412'
def configure_env(self, cfg, env):

View File

@ -225,12 +225,13 @@ def configure(cfg):
if env.HAL_WITH_UAVCAN:
setup_can_build(cfg)
def build(bld):
def pre_build(bld):
'''pre-build hook to change dynamic sources'''
load_env_vars(bld.env)
if bld.env.HAL_WITH_UAVCAN:
bld.get_board().with_uavcan = True
def build(bld):
bld(
# build hwdef.h and apj.prototype from hwdef.dat. This is needed after a waf clean
source=bld.path.ant_glob('libraries/AP_HAL_ChibiOS/hwdef/%s/hwdef.dat' % bld.env.get_flat('BOARD')),