diff --git a/Tools/ardupilotwaf/ap_library.py b/Tools/ardupilotwaf/ap_library.py index e3e16cc38e..7f7f57703d 100644 --- a/Tools/ardupilotwaf/ap_library.py +++ b/Tools/ardupilotwaf/ap_library.py @@ -205,12 +205,34 @@ class ap_library_check_headers(Task.Task): def keyword(self): return 'Checking included headers' +def double_precision_check(tasks): + '''check for tasks marked as double precision''' + + for t in tasks: + if len(t.inputs) == 1: + # get a list of tasks we need to change to be double precision + double_tasks = [] + for library in t.env.DOUBLE_PRECISION_SOURCES.keys(): + for s in t.env.DOUBLE_PRECISION_SOURCES[library]: + double_tasks.append([library, s]) + + src = str(t.inputs[0]).split('/')[-2:] + if src in double_tasks: + single_precision_option='-fsingle-precision-constant' + t.env.CXXFLAGS = t.env.CXXFLAGS[:] + if single_precision_option in t.env.CXXFLAGS: + t.env.CXXFLAGS.remove(single_precision_option) + t.env.CXXFLAGS.append("-DALLOW_DOUBLE_MATH_FUNCTIONS") + + @feature('ap_library_object') @after_method('process_source') def ap_library_register_for_check(self): if not hasattr(self, 'compiled_tasks'): return + double_precision_check(self.compiled_tasks) + if not self.env.ENABLE_HEADER_CHECKS: return @@ -221,3 +243,4 @@ def ap_library_register_for_check(self): def configure(cfg): cfg.env.AP_LIBRARIES_OBJECTS_KW = dict() cfg.env.AP_LIB_EXTRA_SOURCES = dict() + cfg.env.DOUBLE_PRECISION_SOURCES = dict() diff --git a/wscript b/wscript index 6e02bb52b7..7812ed6f58 100644 --- a/wscript +++ b/wscript @@ -328,6 +328,8 @@ def configure(cfg): cfg.end_msg('enabled') cfg.recurse('libraries/AP_Scripting') + cfg.recurse('libraries/AP_GPS') + cfg.start_msg('Scripting runtime checks') if cfg.options.scripting_checks: cfg.end_msg('enabled')