Skip to content

Commit

Permalink
Issue #4762 compiledb include toolchains with user defined libs (#4763)
Browse files Browse the repository at this point in the history
Issue #4762 separated out the optional addition of toolchains to compiledb include paths and added a call to it in the library building step for user defined libraries, allowing the automatic inclusion of toolchains in private lib compiledb generation
  • Loading branch information
pvbaudin authored Nov 16, 2023
1 parent 5f8c15b commit e78bf51
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions platformio/builder/tools/piobuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ def _append_pio_macros():
# remove specified flags
env.ProcessUnFlags(env.get("BUILD_UNFLAGS"))

env.ProcessCompileDbToolchainOption()


def ProcessCompileDbToolchainOption(
env,
): # separated out to selectively add to lib build step
if "compiledb" in COMMAND_LINE_TARGETS:
# Resolve absolute path of toolchain
for cmd in ("CC", "CXX", "AS"):
Expand All @@ -138,6 +144,7 @@ def _append_pio_macros():
)

if env.get("COMPILATIONDB_INCLUDE_TOOLCHAIN"):
print("Warning! `COMPILATIONDB_INCLUDE_TOOLCHAIN` is scoping")
for scope, includes in env.DumpIntegrationIncludes().items():
if scope in ("toolchain",):
env.Append(CPPPATH=includes)
Expand Down Expand Up @@ -376,6 +383,7 @@ def generate(env):
env.AddMethod(GetBuildType)
env.AddMethod(BuildProgram)
env.AddMethod(ProcessProgramDeps)
env.AddMethod(ProcessCompileDbToolchainOption)
env.AddMethod(ProcessProjectDeps)
env.AddMethod(ParseFlagsExtended)
env.AddMethod(ProcessFlags)
Expand Down
2 changes: 2 additions & 0 deletions platformio/builder/tools/piolib.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,8 @@ def build(self):

self.env.PrependUnique(CPPPATH=self.get_include_dirs())

self.env.ProcessCompileDbToolchainOption()

if self.lib_ldf_mode == "off":
for lb in self.env.GetLibBuilders():
if self == lb or not lb.is_built:
Expand Down

0 comments on commit e78bf51

Please sign in to comment.