waf: added AP_LIB_EXTRA_SOURCES

used to allow building of dynamically generated library components
This commit is contained in:
Andrew Tridgell 2020-05-11 12:43:17 +10:00
parent 9cf464e570
commit be812f490f
1 changed files with 10 additions and 0 deletions

View File

@ -62,6 +62,9 @@ _depends_on_vehicle_cache = {}
def _depends_on_vehicle(bld, source_node):
path = source_node.srcpath()
if path.startswith('build/'):
_depends_on_vehicle_cache[path] = False
if path not in _depends_on_vehicle_cache:
s = _remove_comments(source_node.read())
_depends_on_vehicle_cache[path] = _macros_re.search(s) is not None
@ -96,6 +99,12 @@ def ap_library(bld, library, vehicle):
src = library_dir.ant_glob(wildcard)
# allow for dynamically generated sources in a library that inherit the
# dependencies and includes
if library in bld.env.AP_LIB_EXTRA_SOURCES:
for s in bld.env.AP_LIB_EXTRA_SOURCES[library]:
src.append(bld.bldnode.find_or_declare(os.path.join('libraries', library, s)))
if not common_tg:
kw = dict(bld.env.AP_LIBRARIES_OBJECTS_KW)
kw['features'] = kw.get('features', []) + ['ap_library_object']
@ -209,3 +218,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()