From b22ca10f8c785959052e8c9a67ec189d73ab6cc3 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 19 Nov 2018 17:45:53 +0200 Subject: [PATCH] Prepend CPPATH of library dependencies instead of appending // Resolve #1914 --- HISTORY.rst | 2 ++ platformio/builder/tools/pioide.py | 3 ++- platformio/builder/tools/piolib.py | 10 +++++----- platformio/builder/tools/platformio.py | 6 +++--- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 413a82c0..56dd7863 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -9,6 +9,8 @@ PlatformIO 3.0 * Fixed an issue with VSCode IntelliSense warning about the missed headers located in `include `__ folder * Fixed incorrect wording when initializing/updating project +* Fixed an issue with incorrect order for library dependencies ``CPPPATH`` + (`issue #1914 `_) 3.6.1 (2018-10-29) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/builder/tools/pioide.py b/platformio/builder/tools/pioide.py index ed932818..9a35b6e3 100644 --- a/platformio/builder/tools/pioide.py +++ b/platformio/builder/tools/pioide.py @@ -54,7 +54,8 @@ def _dump_includes(env): includes.append(unity_dir) includes.extend( - [env.subst("$PROJECTINCLUDE_DIR"), env.subst("$PROJECTSRC_DIR")]) + [env.subst("$PROJECTINCLUDE_DIR"), + env.subst("$PROJECTSRC_DIR")]) # remove duplicates result = [] diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index d9e5733c..720f1eba 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -432,23 +432,23 @@ class LibBuilderBase(object): libs.extend(lb.build()) # copy shared information to self env 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: - self.env.AppendUnique(CPPPATH=lb.get_include_dirs()) + self.env.PrependUnique(CPPPATH=lb.get_include_dirs()) if self._is_built: return libs 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": for lb in self.env.GetLibBuilders(): if self == lb or not lb.is_built: continue 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: libs.append( @@ -743,7 +743,7 @@ class ProjectAsLibBuilder(LibBuilderBase): def build(self): 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) diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index 321e8ea1..b93499ae 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -44,10 +44,10 @@ def scons_patched_match_splitext(path, suffixes=None): def _build_project_deps(env): 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()) - # append extra linker related options from libs - env.AppendUnique( + # prepend extra linker related options from libs + env.PrependUnique( **{ key: project_lib_builder.env.get(key) for key in ("LIBS", "LIBPATH", "LINKFLAGS")