|
|
@ -57,6 +57,11 @@ _vehicle_macros = ['SKETCHNAME', 'SKETCH', 'APM_BUILD_DIRECTORY', |
|
|
|
'AP_NavEKF3_core.h', 'lua_generated_bindings.h'] |
|
|
|
'AP_NavEKF3_core.h', 'lua_generated_bindings.h'] |
|
|
|
_macros_re = re.compile(r'\b(%s)\b' % '|'.join(_vehicle_macros)) |
|
|
|
_macros_re = re.compile(r'\b(%s)\b' % '|'.join(_vehicle_macros)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# some cpp files are not available at the time we run this check so need to be |
|
|
|
|
|
|
|
# unilaterally added |
|
|
|
|
|
|
|
_vehicle_cpp_need_macros = ['lua_generated_bindings.cpp'] |
|
|
|
|
|
|
|
_macros_cpp_re = re.compile(r'\b(%s)\b' % '|'.join(_vehicle_cpp_need_macros)) |
|
|
|
|
|
|
|
|
|
|
|
def _remove_comments(s): |
|
|
|
def _remove_comments(s): |
|
|
|
return c_preproc.re_cpp.sub(c_preproc.repl, s) |
|
|
|
return c_preproc.re_cpp.sub(c_preproc.repl, s) |
|
|
|
|
|
|
|
|
|
|
@ -66,15 +71,10 @@ def _depends_on_vehicle(bld, source_node): |
|
|
|
|
|
|
|
|
|
|
|
if not bld.env.BUILDROOT: |
|
|
|
if not bld.env.BUILDROOT: |
|
|
|
bld.env.BUILDROOT = bld.bldnode.make_node('').abspath() |
|
|
|
bld.env.BUILDROOT = bld.bldnode.make_node('').abspath() |
|
|
|
if path.startswith(bld.env.BUILDROOT) or path.startswith("build.tmp.binaries/"): |
|
|
|
|
|
|
|
_depends_on_vehicle_cache[path] = False |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if path.startswith("build/") or path.startswith(bld.env.BUILDROOT): |
|
|
|
if _macros_cpp_re.search(path) is not None: |
|
|
|
# allow vehicle dependend #if in cpp generated in build/ |
|
|
|
|
|
|
|
# only scripting bindings currently |
|
|
|
|
|
|
|
_depends_on_vehicle_cache[path] = True |
|
|
|
_depends_on_vehicle_cache[path] = True |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if path not in _depends_on_vehicle_cache: |
|
|
|
if path not in _depends_on_vehicle_cache: |
|
|
|
try: |
|
|
|
try: |
|
|
|
s = _remove_comments(source_node.read()) |
|
|
|
s = _remove_comments(source_node.read()) |
|
|
|