mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
waf: support extra C and C++ flags on a per library basis
This commit is contained in:
parent
6f3c1dcd2b
commit
5c3d464754
@ -239,6 +239,25 @@ class ap_library_check_headers(Task.Task):
|
|||||||
def keyword(self):
|
def keyword(self):
|
||||||
return 'Checking included headers'
|
return 'Checking included headers'
|
||||||
|
|
||||||
|
def custom_flags_check(tgen):
|
||||||
|
'''
|
||||||
|
check for tasks marked as having custom cpp or c flags
|
||||||
|
a library can do this by setting AP_LIB_EXTRA_CXXFLAGS and AP_LIB_EXTRA_CFLAGS
|
||||||
|
|
||||||
|
For example add this is the configure section of the library, using AP_DDS as an example:
|
||||||
|
|
||||||
|
cfg.env.AP_LIB_EXTRA_CXXFLAGS['AP_DDS'] = ['-DSOME_CXX_FLAG']
|
||||||
|
cfg.env.AP_LIB_EXTRA_CFLAGS['AP_DDS'] = ['-DSOME_C_FLAG']
|
||||||
|
'''
|
||||||
|
if not tgen.name.startswith("objs/"):
|
||||||
|
return
|
||||||
|
libname = tgen.name[5:]
|
||||||
|
if libname in tgen.env.AP_LIB_EXTRA_CXXFLAGS:
|
||||||
|
tgen.env.CXXFLAGS.extend(tgen.env.AP_LIB_EXTRA_CXXFLAGS[libname])
|
||||||
|
if libname in tgen.env.AP_LIB_EXTRA_CFLAGS:
|
||||||
|
tgen.env.CFLAGS.extend(tgen.env.AP_LIB_EXTRA_CFLAGS[libname])
|
||||||
|
|
||||||
|
|
||||||
def double_precision_check(tasks):
|
def double_precision_check(tasks):
|
||||||
'''check for tasks marked as double precision'''
|
'''check for tasks marked as double precision'''
|
||||||
|
|
||||||
@ -284,6 +303,7 @@ def ap_library_register_for_check(self):
|
|||||||
if not hasattr(self, 'compiled_tasks'):
|
if not hasattr(self, 'compiled_tasks'):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
custom_flags_check(self)
|
||||||
double_precision_check(self.compiled_tasks)
|
double_precision_check(self.compiled_tasks)
|
||||||
if self.env.ENABLE_ONVIF:
|
if self.env.ENABLE_ONVIF:
|
||||||
gsoap_library_check(self.bld, self.compiled_tasks)
|
gsoap_library_check(self.bld, self.compiled_tasks)
|
||||||
@ -298,4 +318,6 @@ 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.AP_LIB_EXTRA_CXXFLAGS = dict()
|
||||||
|
cfg.env.AP_LIB_EXTRA_CFLAGS = dict()
|
||||||
cfg.env.DOUBLE_PRECISION_SOURCES = dict()
|
cfg.env.DOUBLE_PRECISION_SOURCES = dict()
|
||||||
|
Loading…
Reference in New Issue
Block a user