mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 18:17:13 +02:00
Don't export `CPPPATH
` of project dependent libraries to frameworks // Resolve #1665
This commit is contained in:
@ -4,6 +4,12 @@ Release Notes
|
|||||||
PlatformIO 3.0
|
PlatformIO 3.0
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
3.5.4 (2018-??-??)
|
||||||
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
* Don't export ``CPPPATH`` of project dependent libraries to frameworks
|
||||||
|
(`issue #1665 <https://github.com/platformio/platformio-core/issues/1665>`_)
|
||||||
|
|
||||||
3.5.3 (2018-06-01)
|
3.5.3 (2018-06-01)
|
||||||
~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
2
docs
2
docs
Submodule docs updated: 3ad76be8f7...e80a1091b0
@ -821,7 +821,7 @@ def BuildProjectLibraries(env):
|
|||||||
title = "<%s>" % lb.name
|
title = "<%s>" % lb.name
|
||||||
vcs_info = lb.vcs_info
|
vcs_info = lb.vcs_info
|
||||||
if lb.version:
|
if lb.version:
|
||||||
title += " v%s" % lb.version
|
title += " %s" % lb.version
|
||||||
if vcs_info and vcs_info.get("version"):
|
if vcs_info and vcs_info.get("version"):
|
||||||
title += " #%s" % vcs_info.get("version")
|
title += " #%s" % vcs_info.get("version")
|
||||||
sys.stdout.write("%s|-- %s" % (margin, title))
|
sys.stdout.write("%s|-- %s" % (margin, title))
|
||||||
@ -836,7 +836,6 @@ def BuildProjectLibraries(env):
|
|||||||
print_deps_tree(lb, level + 1)
|
print_deps_tree(lb, level + 1)
|
||||||
|
|
||||||
project = ProjectAsLibBuilder(env, "$PROJECT_DIR")
|
project = ProjectAsLibBuilder(env, "$PROJECT_DIR")
|
||||||
project.env = env
|
|
||||||
ldf_mode = LibBuilderBase.lib_ldf_mode.fget(project)
|
ldf_mode = LibBuilderBase.lib_ldf_mode.fget(project)
|
||||||
|
|
||||||
print "Library Dependency Finder -> http://bit.ly/configure-pio-ldf"
|
print "Library Dependency Finder -> http://bit.ly/configure-pio-ldf"
|
||||||
@ -858,7 +857,8 @@ def BuildProjectLibraries(env):
|
|||||||
else:
|
else:
|
||||||
print "No dependencies"
|
print "No dependencies"
|
||||||
|
|
||||||
return project.build()
|
libs = project.build()
|
||||||
|
return dict(LIBS=libs, CPPPATH=project.env.get("CPPPATH"))
|
||||||
|
|
||||||
|
|
||||||
def exists(_):
|
def exists(_):
|
||||||
|
@ -22,7 +22,7 @@ from os.path import basename, dirname, isdir, join, realpath
|
|||||||
|
|
||||||
from SCons import Builder, Util
|
from SCons import Builder, Util
|
||||||
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild,
|
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild,
|
||||||
DefaultEnvironment, SConscript)
|
DefaultEnvironment, Export, SConscript)
|
||||||
|
|
||||||
from platformio.util import glob_escape, pioversion_to_intstr
|
from platformio.util import glob_escape, pioversion_to_intstr
|
||||||
|
|
||||||
@ -41,6 +41,36 @@ def scons_patched_match_splitext(path, suffixes=None):
|
|||||||
return tokens
|
return tokens
|
||||||
|
|
||||||
|
|
||||||
|
def _build_project_deps(env):
|
||||||
|
deps = env.BuildProjectLibraries()
|
||||||
|
srcnodes = None
|
||||||
|
if "__test" in COMMAND_LINE_TARGETS:
|
||||||
|
srcnodes = env.ProcessTest()
|
||||||
|
else:
|
||||||
|
srcnodes = env.CollectBuildFiles(
|
||||||
|
"$BUILDSRC_DIR",
|
||||||
|
"$PROJECTSRC_DIR",
|
||||||
|
src_filter=env.get("SRC_FILTER"))
|
||||||
|
|
||||||
|
projenv = env.Clone()
|
||||||
|
Export("projenv")
|
||||||
|
|
||||||
|
# CPPPATH from dependencies
|
||||||
|
projenv.PrependUnique(CPPPATH=deps['CPPPATH'])
|
||||||
|
# extra build flags from `platformio.ini`
|
||||||
|
projenv.ProcessFlags(env.get("SRC_BUILD_FLAGS"))
|
||||||
|
|
||||||
|
# prepend dependent libs before built-in
|
||||||
|
env.Prepend(
|
||||||
|
LIBS=deps['LIBS'], PIOBUILDFILES=[projenv.Object(n) for n in srcnodes])
|
||||||
|
|
||||||
|
if not env['PIOBUILDFILES'] and not COMMAND_LINE_TARGETS:
|
||||||
|
sys.stderr.write(
|
||||||
|
"Error: Nothing to build. Please put your source code files "
|
||||||
|
"to '%s' folder\n" % env.subst("$PROJECTSRC_DIR"))
|
||||||
|
env.Exit(1)
|
||||||
|
|
||||||
|
|
||||||
def BuildProgram(env):
|
def BuildProgram(env):
|
||||||
|
|
||||||
def _append_pio_macros():
|
def _append_pio_macros():
|
||||||
@ -62,6 +92,7 @@ def BuildProgram(env):
|
|||||||
# process extra flags from board
|
# process extra flags from board
|
||||||
if "BOARD" in env and "build.extra_flags" in env.BoardConfig():
|
if "BOARD" in env and "build.extra_flags" in env.BoardConfig():
|
||||||
env.ProcessFlags(env.BoardConfig().get("build.extra_flags"))
|
env.ProcessFlags(env.BoardConfig().get("build.extra_flags"))
|
||||||
|
|
||||||
# apply user flags
|
# apply user flags
|
||||||
env.ProcessFlags(env.get("BUILD_FLAGS"))
|
env.ProcessFlags(env.get("BUILD_FLAGS"))
|
||||||
|
|
||||||
@ -74,8 +105,8 @@ def BuildProgram(env):
|
|||||||
# remove specified flags
|
# remove specified flags
|
||||||
env.ProcessUnFlags(env.get("BUILD_UNFLAGS"))
|
env.ProcessUnFlags(env.get("BUILD_UNFLAGS"))
|
||||||
|
|
||||||
# build dependent libs; place them before built-in libs
|
# build project with dependencies
|
||||||
env.Prepend(LIBS=env.BuildProjectLibraries())
|
_build_project_deps(env)
|
||||||
|
|
||||||
# append specified LD_SCRIPT
|
# append specified LD_SCRIPT
|
||||||
if ("LDSCRIPT_PATH" in env
|
if ("LDSCRIPT_PATH" in env
|
||||||
@ -87,24 +118,6 @@ def BuildProgram(env):
|
|||||||
env.Prepend(_LIBFLAGS="-Wl,--start-group ")
|
env.Prepend(_LIBFLAGS="-Wl,--start-group ")
|
||||||
env.Append(_LIBFLAGS=" -Wl,--end-group")
|
env.Append(_LIBFLAGS=" -Wl,--end-group")
|
||||||
|
|
||||||
# Handle SRC_BUILD_FLAGS
|
|
||||||
env.ProcessFlags(env.get("SRC_BUILD_FLAGS"))
|
|
||||||
|
|
||||||
if "__test" in COMMAND_LINE_TARGETS:
|
|
||||||
env.Append(PIOBUILDFILES=env.ProcessTest())
|
|
||||||
else:
|
|
||||||
env.Append(
|
|
||||||
PIOBUILDFILES=env.CollectBuildFiles(
|
|
||||||
"$BUILDSRC_DIR",
|
|
||||||
"$PROJECTSRC_DIR",
|
|
||||||
src_filter=env.get("SRC_FILTER")))
|
|
||||||
|
|
||||||
if not env['PIOBUILDFILES'] and not COMMAND_LINE_TARGETS:
|
|
||||||
sys.stderr.write(
|
|
||||||
"Error: Nothing to build. Please put your source code files "
|
|
||||||
"to '%s' folder\n" % env.subst("$PROJECTSRC_DIR"))
|
|
||||||
env.Exit(1)
|
|
||||||
|
|
||||||
program = env.Program(
|
program = env.Program(
|
||||||
join("$BUILD_DIR", env.subst("$PROGNAME")), env['PIOBUILDFILES'])
|
join("$BUILD_DIR", env.subst("$PROGNAME")), env['PIOBUILDFILES'])
|
||||||
|
|
||||||
@ -275,7 +288,7 @@ def BuildFrameworks(env, frameworks):
|
|||||||
env.ConvertInoToCpp()
|
env.ConvertInoToCpp()
|
||||||
|
|
||||||
if f in board_frameworks:
|
if f in board_frameworks:
|
||||||
SConscript(env.GetFrameworkScript(f))
|
SConscript(env.GetFrameworkScript(f), exports="env")
|
||||||
else:
|
else:
|
||||||
sys.stderr.write(
|
sys.stderr.write(
|
||||||
"Error: This board doesn't support %s framework!\n" % f)
|
"Error: This board doesn't support %s framework!\n" % f)
|
||||||
|
@ -29,8 +29,9 @@ build_flags = %s
|
|||||||
""" % " ".join([f[0] for f in build_flags]))
|
""" % " ".join([f[0] for f in build_flags]))
|
||||||
|
|
||||||
tmpdir.join("extra.py").write("""
|
tmpdir.join("extra.py").write("""
|
||||||
Import("env")
|
Import("projenv")
|
||||||
env.Append(CPPDEFINES="POST_SCRIPT_MACRO")
|
|
||||||
|
projenv.Append(CPPDEFINES="POST_SCRIPT_MACRO")
|
||||||
""")
|
""")
|
||||||
|
|
||||||
tmpdir.mkdir("src").join("main.cpp").write("""
|
tmpdir.mkdir("src").join("main.cpp").write("""
|
||||||
|
Reference in New Issue
Block a user