Prepend CPPATH of library dependencies instead of appending // Resolve #1914

This commit is contained in:
Ivan Kravets
2018-11-19 17:45:53 +02:00
parent 95beb03aad
commit b22ca10f8c
4 changed files with 12 additions and 9 deletions

View File

@ -9,6 +9,8 @@ PlatformIO 3.0
* Fixed an issue with VSCode IntelliSense warning about the missed headers located in `include <http://docs.platformio.org/page/projectconf/section_platformio.html#include-dir>`__ folder * Fixed an issue with VSCode IntelliSense warning about the missed headers located in `include <http://docs.platformio.org/page/projectconf/section_platformio.html#include-dir>`__ folder
* Fixed incorrect wording when initializing/updating project * Fixed incorrect wording when initializing/updating project
* Fixed an issue with incorrect order for library dependencies ``CPPPATH``
(`issue #1914 <https://github.com/platformio/platformio-core/issues/1914>`_)
3.6.1 (2018-10-29) 3.6.1 (2018-10-29)
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~

View File

@ -54,7 +54,8 @@ def _dump_includes(env):
includes.append(unity_dir) includes.append(unity_dir)
includes.extend( includes.extend(
[env.subst("$PROJECTINCLUDE_DIR"), env.subst("$PROJECTSRC_DIR")]) [env.subst("$PROJECTINCLUDE_DIR"),
env.subst("$PROJECTSRC_DIR")])
# remove duplicates # remove duplicates
result = [] result = []

View File

@ -432,23 +432,23 @@ class LibBuilderBase(object):
libs.extend(lb.build()) libs.extend(lb.build())
# copy shared information to self env # copy shared information to self env
for key in ("CPPPATH", "LIBPATH", "LIBS", "LINKFLAGS"): for key in ("CPPPATH", "LIBPATH", "LIBS", "LINKFLAGS"):
self.env.AppendUnique(**{key: lb.env.get(key)}) self.env.PrependUnique(**{key: lb.env.get(key)})
for lb in self._circular_deps: for lb in self._circular_deps:
self.env.AppendUnique(CPPPATH=lb.get_include_dirs()) self.env.PrependUnique(CPPPATH=lb.get_include_dirs())
if self._is_built: if self._is_built:
return libs return libs
self._is_built = True self._is_built = True
self.env.AppendUnique(CPPPATH=self.get_include_dirs()) self.env.PrependUnique(CPPPATH=self.get_include_dirs())
if self.lib_ldf_mode == "off": if self.lib_ldf_mode == "off":
for lb in self.env.GetLibBuilders(): for lb in self.env.GetLibBuilders():
if self == lb or not lb.is_built: if self == lb or not lb.is_built:
continue continue
for key in ("CPPPATH", "LIBPATH", "LIBS", "LINKFLAGS"): for key in ("CPPPATH", "LIBPATH", "LIBS", "LINKFLAGS"):
self.env.AppendUnique(**{key: lb.env.get(key)}) self.env.PrependUnique(**{key: lb.env.get(key)})
if self.lib_archive: if self.lib_archive:
libs.append( libs.append(
@ -743,7 +743,7 @@ class ProjectAsLibBuilder(LibBuilderBase):
def build(self): def build(self):
self._is_built = True # do not build Project now self._is_built = True # do not build Project now
self.env.AppendUnique(CPPPATH=self.get_include_dirs()) self.env.PrependUnique(CPPPATH=self.get_include_dirs())
return LibBuilderBase.build(self) return LibBuilderBase.build(self)

View File

@ -44,10 +44,10 @@ def scons_patched_match_splitext(path, suffixes=None):
def _build_project_deps(env): def _build_project_deps(env):
project_lib_builder = env.ConfigureProjectLibBuilder() project_lib_builder = env.ConfigureProjectLibBuilder()
# append project libs to the beginning of list # prepend project libs to the beginning of list
env.Prepend(LIBS=project_lib_builder.build()) env.Prepend(LIBS=project_lib_builder.build())
# append extra linker related options from libs # prepend extra linker related options from libs
env.AppendUnique( env.PrependUnique(
**{ **{
key: project_lib_builder.env.get(key) key: project_lib_builder.env.get(key)
for key in ("LIBS", "LIBPATH", "LINKFLAGS") for key in ("LIBS", "LIBPATH", "LINKFLAGS")