mirror of https://github.com/ArduPilot/ardupilot
waf: allow setup of double precision for some cpp files
This commit is contained in:
parent
6a8680d31d
commit
24425b4155
|
@ -205,12 +205,34 @@ class ap_library_check_headers(Task.Task):
|
||||||
def keyword(self):
|
def keyword(self):
|
||||||
return 'Checking included headers'
|
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')
|
@feature('ap_library_object')
|
||||||
@after_method('process_source')
|
@after_method('process_source')
|
||||||
def ap_library_register_for_check(self):
|
def ap_library_register_for_check(self):
|
||||||
if not hasattr(self, 'compiled_tasks'):
|
if not hasattr(self, 'compiled_tasks'):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
double_precision_check(self.compiled_tasks)
|
||||||
|
|
||||||
if not self.env.ENABLE_HEADER_CHECKS:
|
if not self.env.ENABLE_HEADER_CHECKS:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -221,3 +243,4 @@ def ap_library_register_for_check(self):
|
||||||
def configure(cfg):
|
def configure(cfg):
|
||||||
cfg.env.AP_LIBRARIES_OBJECTS_KW = dict()
|
cfg.env.AP_LIBRARIES_OBJECTS_KW = dict()
|
||||||
cfg.env.AP_LIB_EXTRA_SOURCES = dict()
|
cfg.env.AP_LIB_EXTRA_SOURCES = dict()
|
||||||
|
cfg.env.DOUBLE_PRECISION_SOURCES = dict()
|
||||||
|
|
2
wscript
2
wscript
|
@ -328,6 +328,8 @@ def configure(cfg):
|
||||||
cfg.end_msg('enabled')
|
cfg.end_msg('enabled')
|
||||||
cfg.recurse('libraries/AP_Scripting')
|
cfg.recurse('libraries/AP_Scripting')
|
||||||
|
|
||||||
|
cfg.recurse('libraries/AP_GPS')
|
||||||
|
|
||||||
cfg.start_msg('Scripting runtime checks')
|
cfg.start_msg('Scripting runtime checks')
|
||||||
if cfg.options.scripting_checks:
|
if cfg.options.scripting_checks:
|
||||||
cfg.end_msg('enabled')
|
cfg.end_msg('enabled')
|
||||||
|
|
Loading…
Reference in New Issue