Experimental support for parsing source file in pair with a header when they have the same name // Issue #1175

This commit is contained in:
Ivan Kravets
2017-11-26 18:51:08 +02:00
parent d8ee64a545
commit 200cbae177
2 changed files with 15 additions and 2 deletions

View File

@ -334,8 +334,20 @@ class LibBuilderBase(object):
sys.stderr.write( sys.stderr.write(
"Warning! Classic Pre Processor is used for `%s`, " "Warning! Classic Pre Processor is used for `%s`, "
"advanced has failed with `%s`\n" % (path, e)) "advanced has failed with `%s`\n" % (path, e))
incs = self.env.File(path).get_found_includes( _incs = self.env.File(path).get_found_includes(
self.env, LibBuilderBase.CLASSIC_SCANNER, tuple(inc_dirs)) self.env, LibBuilderBase.CLASSIC_SCANNER, tuple(inc_dirs))
incs = []
for inc in _incs:
incs.append(inc)
_h_path = inc.get_abspath()
if not self.env.IsFileWithExt(_h_path,
piotool.SRC_HEADER_EXT):
continue
_f_part = _h_path[:_h_path.rindex(".")]
for ext in piotool.SRC_C_EXT:
if isfile("%s.%s" % (_f_part, ext)):
incs.append(
self.env.File("%s.%s" % (_f_part, ext)))
# print path, map(lambda n: n.get_abspath(), incs) # print path, map(lambda n: n.get_abspath(), incs)
for inc in incs: for inc in incs:
if inc not in result: if inc not in result:

View File

@ -27,8 +27,9 @@ from SCons.Util import case_sensitive_suffixes, is_Sequence
from platformio.util import glob_escape, pioversion_to_intstr from platformio.util import glob_escape, pioversion_to_intstr
SRC_BUILD_EXT = ["c", "cc", "cpp", "S", "spp", "SPP", "sx", "s", "asm", "ASM"]
SRC_HEADER_EXT = ["h", "hpp"] SRC_HEADER_EXT = ["h", "hpp"]
SRC_C_EXT = ["c", "cc", "cpp"]
SRC_BUILD_EXT = SRC_C_EXT + ["S", "spp", "SPP", "sx", "s", "asm", "ASM"]
SRC_FILTER_DEFAULT = ["+<*>", "-<.git%s>" % sep, "-<svn%s>" % sep] SRC_FILTER_DEFAULT = ["+<*>", "-<.git%s>" % sep, "-<svn%s>" % sep]