diff --git a/APMrover2/wscript b/APMrover2/wscript index a8c4aefefb..e63f470672 100644 --- a/APMrover2/wscript +++ b/APMrover2/wscript @@ -21,7 +21,6 @@ def build(bld): 'AP_ServoRelayEvents', 'PID', ], - use='mavlink', ) bld.ap_program( diff --git a/AntennaTracker/wscript b/AntennaTracker/wscript index aa403b3e12..687ebf2a98 100644 --- a/AntennaTracker/wscript +++ b/AntennaTracker/wscript @@ -9,7 +9,6 @@ def build(bld): ap_libraries=bld.ap_common_vehicle_libraries() + [ 'AC_PID', ], - use='mavlink', ) bld.ap_program( diff --git a/ArduCopter/wscript b/ArduCopter/wscript index f8c218803d..b65da2a87c 100644 --- a/ArduCopter/wscript +++ b/ArduCopter/wscript @@ -30,7 +30,6 @@ def build(bld): 'AP_ServoRelayEvents', 'AP_Avoidance', ], - use='mavlink', ) frames = ( diff --git a/ArduPlane/wscript b/ArduPlane/wscript index 0e3f71c633..62730d2e1f 100644 --- a/ArduPlane/wscript +++ b/ArduPlane/wscript @@ -31,7 +31,6 @@ def build(bld): 'AC_Fence', 'AC_Avoidance' ], - use='mavlink', ) bld.ap_program( diff --git a/Tools/Replay/wscript b/Tools/Replay/wscript index e0bee5c961..c416eef218 100644 --- a/Tools/Replay/wscript +++ b/Tools/Replay/wscript @@ -15,7 +15,6 @@ def build(bld): ap_libraries=bld.ap_common_vehicle_libraries() + [ 'AP_InertialNav', ], - use='mavlink', ) bld.ap_program( diff --git a/Tools/ardupilotwaf/ardupilotwaf.py b/Tools/ardupilotwaf/ardupilotwaf.py index 47531357e0..115528a1ec 100644 --- a/Tools/ardupilotwaf/ardupilotwaf.py +++ b/Tools/ardupilotwaf/ardupilotwaf.py @@ -15,8 +15,6 @@ SOURCE_EXTS = [ '*.cpp', ] -UTILITY_SOURCE_EXTS = [ 'utility/' + glob for glob in SOURCE_EXTS ] - COMMON_VEHICLE_DEPENDENT_LIBRARIES = [ 'AP_AccelCal', 'AP_ADC', @@ -147,17 +145,6 @@ def ap_example(bld, **kw): kw['program_groups'] = 'examples' ap_program(bld, use_legacy_defines=False, **kw) -# NOTE: Code in libraries/ is compiled multiple times. So ensure each -# compilation is independent by providing different index for each. -# The need for this should disappear when libraries change to be -# independent of vehicle type. -LAST_IDX = 0 - -def _get_next_idx(): - global LAST_IDX - LAST_IDX += 1 - return LAST_IDX - def unique_list(items): '''remove duplicate elements from a list while maintaining ordering''' return list(OrderedDict.fromkeys(items)) @@ -171,22 +158,13 @@ def ap_stlib(bld, **kw): if 'ap_libraries' not in kw: bld.fatal('Missing ap_libraries for ap_stlib') - sources = [] - libraries = unique_list(kw['ap_libraries'] + bld.env.AP_LIBRARIES) + kw['ap_libraries'] = unique_list(kw['ap_libraries'] + bld.env.AP_LIBRARIES) + for l in kw['ap_libraries']: + bld.ap_library(l, kw['ap_vehicle']) - for lib_name in libraries: - lib_node = bld.srcnode.find_dir('libraries/' + lib_name) - if lib_node is None: - bld.fatal('Could not find library ' + lib_name) - lib_sources = lib_node.ant_glob(SOURCE_EXTS + UTILITY_SOURCE_EXTS) - sources.extend(lib_sources) - - kw['cxxflags'] = kw.get('cxxflags', []) + ['-include', 'ap_config.h'] - kw['features'] = kw.get('features', []) + bld.env.AP_STLIB_FEATURES - kw['source'] = sources + kw['features'] = kw.get('features', []) + ['cxx', 'cxxstlib'] kw['target'] = kw['name'] - kw['defines'] = get_legacy_defines(kw['ap_vehicle']) - kw['idx'] = _get_next_idx() + kw['source'] = [] bld.stlib(**kw) @@ -395,10 +373,5 @@ my board". def build(bld): - global LAST_IDX - # FIXME: This is done to prevent same task generators being created with - # different idx when build() is called multiple times (e.g. waf bin tests). - # Ideally, task generators should be created just once. - LAST_IDX = 0 bld.add_pre_fun(_process_build_command) bld.add_pre_fun(_select_programs_from_group) diff --git a/wscript b/wscript index cb0a55e56f..4b03869886 100644 --- a/wscript +++ b/wscript @@ -152,6 +152,8 @@ def configure(cfg): cfg.msg('Using static linking', 'yes', color='YELLOW') cfg.env.STATIC_LINKING = True + cfg.load('ap_library') + cfg.msg('Setting board to', cfg.options.board) cfg.get_board().configure(cfg) @@ -272,7 +274,6 @@ def _build_common_taskgens(bld): name='ap', ap_vehicle='UNKNOWN', ap_libraries=bld.ap_get_all_libraries(), - use='mavlink', ) if bld.env.HAS_GTEST: @@ -344,6 +345,11 @@ def build(bld): bld.load('ardupilotwaf') + bld.env.AP_LIBRARIES_OBJECTS_KW.update( + use='mavlink', + cxxflags=['-include', 'ap_config.h'], + ) + _build_cmd_tweaks(bld) if bld.env.SUBMODULE_UPDATE: