mirror of https://github.com/ArduPilot/ardupilot
waf: add dynamic source option to ap_stlib
This commit is contained in:
parent
0b3197727a
commit
3ec938fae6
|
@ -12,27 +12,20 @@ def build(bld):
|
|||
|
||||
# build external libcanard library
|
||||
bld.stlib(source='../../modules/DroneCAN/libcanard/canard.c',
|
||||
use='dronecan',
|
||||
target='libcanard')
|
||||
|
||||
bld.ap_program(
|
||||
use=['ap','libcanard','AP_Bootloader_libs'],
|
||||
program_groups='bootloader',
|
||||
includes=[bld.env.SRCROOT + '/modules/DroneCAN/libcanard',
|
||||
bld.env.BUILDROOT + '/modules/DroneCAN/libcanard/dsdlc_generated']
|
||||
)
|
||||
use=['ap','libcanard','AP_Bootloader_libs', 'dronecan'],
|
||||
program_groups='bootloader'
|
||||
)
|
||||
|
||||
bld.ap_stlib(
|
||||
name= 'AP_Bootloader_libs',
|
||||
use='dronecan',
|
||||
dynamic_source='modules/DroneCAN/libcanard/dsdlc_generated/src/**.c',
|
||||
ap_vehicle='AP_Bootloader',
|
||||
ap_libraries= flashiface_lib + [
|
||||
'AP_Math',
|
||||
'AP_CheckFirmware'
|
||||
])
|
||||
|
||||
bld(
|
||||
# build libcanard headers
|
||||
source=bld.path.ant_glob("modules/DroneCAN/DSDL/**/*.uavcan"),
|
||||
rule="python3 ${SRCROOT}/modules/DroneCAN/libcanard/dsdl_compiler/libcanard_dsdlc --header_only --outdir ${BUILDROOT}/modules/DroneCAN/libcanard/dsdlc_generated ${SRCROOT}/modules/DroneCAN/DSDL/uavcan ${SRCROOT}/modules/DroneCAN/DSDL/ardupilot ${SRCROOT}/modules/DroneCAN/DSDL/com ${SRCROOT}/modules/DroneCAN/DSDL/dronecan",
|
||||
group='dynamic_sources',
|
||||
)
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@ def build(bld):
|
|||
]
|
||||
bld.ap_stlib(
|
||||
name= 'AP_Periph_libs',
|
||||
dynamic_source='modules/DroneCAN/libcanard/dsdlc_generated/src/**.c',
|
||||
ap_vehicle='AP_Periph',
|
||||
ap_libraries= libraries,
|
||||
use='dronecan',
|
||||
|
@ -79,8 +80,8 @@ def build(bld):
|
|||
)
|
||||
|
||||
# build external libcanard library
|
||||
bld.stlib(source=['../../modules/DroneCAN/libcanard/canard.c'] +
|
||||
bld.bldnode.ant_glob('modules/DroneCAN/libcanard/dsdlc_generated/src/**.c'),
|
||||
bld.stlib(source='../../modules/DroneCAN/libcanard/canard.c',
|
||||
name='libcanard',
|
||||
use='dronecan',
|
||||
target='libcanard')
|
||||
|
||||
|
|
|
@ -156,6 +156,14 @@ def process_ap_libraries(self):
|
|||
if vehicle:
|
||||
self.use.append(_vehicle_tgen_name(l, vehicle))
|
||||
|
||||
@before_method('process_source')
|
||||
@feature('cxxstlib')
|
||||
def dynamic_post(self):
|
||||
if not getattr(self, 'dynamic_source', None):
|
||||
return
|
||||
self.source = Utils.to_list(self.source)
|
||||
self.source.extend(self.bld.bldnode.ant_glob(self.dynamic_source))
|
||||
|
||||
class ap_library_check_headers(Task.Task):
|
||||
color = 'PINK'
|
||||
before = 'cxx c'
|
||||
|
|
Loading…
Reference in New Issue