diff --git a/Tools/ardupilotwaf/ap_library.py b/Tools/ardupilotwaf/ap_library.py index 91c34a79c5..c6aa0dba83 100644 --- a/Tools/ardupilotwaf/ap_library.py +++ b/Tools/ardupilotwaf/ap_library.py @@ -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) diff --git a/Tools/ardupilotwaf/ardupilotwaf.py b/Tools/ardupilotwaf/ardupilotwaf.py index 92143564d8..97e7aaaec5 100644 --- a/Tools/ardupilotwaf/ardupilotwaf.py +++ b/Tools/ardupilotwaf/ardupilotwaf.py @@ -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