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
|
# build external libcanard library
|
||||||
bld.stlib(source='../../modules/DroneCAN/libcanard/canard.c',
|
bld.stlib(source='../../modules/DroneCAN/libcanard/canard.c',
|
||||||
|
use='dronecan',
|
||||||
target='libcanard')
|
target='libcanard')
|
||||||
|
|
||||||
bld.ap_program(
|
bld.ap_program(
|
||||||
use=['ap','libcanard','AP_Bootloader_libs'],
|
use=['ap','libcanard','AP_Bootloader_libs', 'dronecan'],
|
||||||
program_groups='bootloader',
|
program_groups='bootloader'
|
||||||
includes=[bld.env.SRCROOT + '/modules/DroneCAN/libcanard',
|
|
||||||
bld.env.BUILDROOT + '/modules/DroneCAN/libcanard/dsdlc_generated']
|
|
||||||
)
|
)
|
||||||
|
|
||||||
bld.ap_stlib(
|
bld.ap_stlib(
|
||||||
name= 'AP_Bootloader_libs',
|
name= 'AP_Bootloader_libs',
|
||||||
|
use='dronecan',
|
||||||
|
dynamic_source='modules/DroneCAN/libcanard/dsdlc_generated/src/**.c',
|
||||||
ap_vehicle='AP_Bootloader',
|
ap_vehicle='AP_Bootloader',
|
||||||
ap_libraries= flashiface_lib + [
|
ap_libraries= flashiface_lib + [
|
||||||
'AP_Math',
|
'AP_Math',
|
||||||
'AP_CheckFirmware'
|
'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(
|
bld.ap_stlib(
|
||||||
name= 'AP_Periph_libs',
|
name= 'AP_Periph_libs',
|
||||||
|
dynamic_source='modules/DroneCAN/libcanard/dsdlc_generated/src/**.c',
|
||||||
ap_vehicle='AP_Periph',
|
ap_vehicle='AP_Periph',
|
||||||
ap_libraries= libraries,
|
ap_libraries= libraries,
|
||||||
use='dronecan',
|
use='dronecan',
|
||||||
|
@ -79,8 +80,8 @@ def build(bld):
|
||||||
)
|
)
|
||||||
|
|
||||||
# build external libcanard library
|
# build external libcanard library
|
||||||
bld.stlib(source=['../../modules/DroneCAN/libcanard/canard.c'] +
|
bld.stlib(source='../../modules/DroneCAN/libcanard/canard.c',
|
||||||
bld.bldnode.ant_glob('modules/DroneCAN/libcanard/dsdlc_generated/src/**.c'),
|
name='libcanard',
|
||||||
use='dronecan',
|
use='dronecan',
|
||||||
target='libcanard')
|
target='libcanard')
|
||||||
|
|
||||||
|
|
|
@ -156,6 +156,14 @@ def process_ap_libraries(self):
|
||||||
if vehicle:
|
if vehicle:
|
||||||
self.use.append(_vehicle_tgen_name(l, 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):
|
class ap_library_check_headers(Task.Task):
|
||||||
color = 'PINK'
|
color = 'PINK'
|
||||||
before = 'cxx c'
|
before = 'cxx c'
|
||||||
|
|
2
wscript
2
wscript
|
@ -783,6 +783,8 @@ def build(bld):
|
||||||
|
|
||||||
if bld.get_board().with_can:
|
if bld.get_board().with_can:
|
||||||
bld.env.AP_LIBRARIES_OBJECTS_KW['use'] += ['uavcan']
|
bld.env.AP_LIBRARIES_OBJECTS_KW['use'] += ['uavcan']
|
||||||
|
if bld.env.AP_PERIPH:
|
||||||
|
bld.env.AP_LIBRARIES_OBJECTS_KW['use'] += ['dronecan']
|
||||||
|
|
||||||
_build_cmd_tweaks(bld)
|
_build_cmd_tweaks(bld)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue