Waf: Modify build directory define if heli build command is given

This commit is contained in:
Gone4Dirt 2021-09-27 20:39:15 +01:00 committed by Peter Barker
parent 7c20658acf
commit 7fab70b8f1
2 changed files with 12 additions and 3 deletions

View File

@ -139,7 +139,7 @@ def ap_library(bld, library, vehicle):
kw.update(
name=_vehicle_tgen_name(library, vehicle),
source=source,
defines=ap.get_legacy_defines(vehicle),
defines=ap.get_legacy_defines(vehicle, bld),
idx=_vehicle_index(vehicle),
)
bld.objects(**kw)

View File

@ -109,7 +109,16 @@ COMMON_VEHICLE_DEPENDENT_LIBRARIES = [
'AP_FETtecOneWire',
]
def get_legacy_defines(sketch_name):
def get_legacy_defines(sketch_name, bld):
# If we are building heli, we adjust the build directory define so that
# we do not need to actually split heli and copter directories
if bld.cmd == 'heli' or 'heli' in bld.targets:
return [
'APM_BUILD_DIRECTORY=APM_BUILD_Heli',
'SKETCH="' + sketch_name + '"',
'SKETCHNAME="' + sketch_name + '"',
]
return [
'APM_BUILD_DIRECTORY=APM_BUILD_' + sketch_name,
'SKETCH="' + sketch_name + '"',
@ -253,7 +262,7 @@ def ap_program(bld,
program_name = bld.path.name
if use_legacy_defines:
kw['defines'].extend(get_legacy_defines(bld.path.name))
kw['defines'].extend(get_legacy_defines(bld.path.name, bld))
kw['features'] = kw.get('features', []) + bld.env.AP_PROGRAM_FEATURES