mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Fixed an issue with preprocessing of `*.ino
` when macros were not handled // Resolve #2972
This commit is contained in:
@ -12,6 +12,7 @@ PlatformIO Core 4.0
|
||||
* Extend project environment configuration in "platformio.ini" with other sections using a new `extends <http://docs.platformio.org/page/projectconf/section_env_advanced.html#extends>`__ option (`issue #2953 <https://github.com/platformio/platformio-core/issues/2953>`_)
|
||||
* Fixed an issue with project generator for `CLion IDE <http://docs.platformio.org/page/ide/clion.html>`__ when 2 environments were used (`issue #2824 <https://github.com/platformio/platformio-core/issues/2824>`_)
|
||||
* Fixed default PIO Unified Debugger configuration for `J-Link probe <http://docs.platformio.org/en/latest/plus/debug-tools/jlink.html>`__
|
||||
* Fixed an issue with preprocessing of ``*.ino`` files when macros were not handled (`issue #2972 <https://github.com/platformio/platformio-core/issues/2972>`_)
|
||||
|
||||
4.0.3 (2019-08-30)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
@ -816,15 +816,21 @@ class ProjectAsLibBuilder(LibBuilderBase):
|
||||
|
||||
def get_search_files(self):
|
||||
# project files
|
||||
items = LibBuilderBase.get_search_files(self)
|
||||
search_files = LibBuilderBase.get_search_files(self)
|
||||
# test files
|
||||
if "__test" in COMMAND_LINE_TARGETS:
|
||||
items.extend([
|
||||
search_files.extend([
|
||||
join("$PROJECTTEST_DIR",
|
||||
item) for item in self.env.MatchSourceFiles(
|
||||
"$PROJECTTEST_DIR", "$PIOTEST_SRC_FILTER")
|
||||
])
|
||||
return items
|
||||
if "arduino" in self.env.get("PIOFRAMEWORK", []):
|
||||
search_files.extend([
|
||||
join(self.src_dir, item)
|
||||
for item in fs.match_src_files(self.src_dir, self.src_filter, (
|
||||
"ino", "pde"))
|
||||
])
|
||||
return search_files
|
||||
|
||||
@property
|
||||
def lib_ldf_mode(self):
|
||||
|
@ -88,11 +88,13 @@ class InoToCPPConverter(object):
|
||||
tmp_path = mkstemp()[1]
|
||||
with open(tmp_path, "w") as fp:
|
||||
fp.write(contents)
|
||||
self.env.Execute(
|
||||
self.env.VerboseAction(
|
||||
'$CXX -o "{0}" -x c++ -fpreprocessed -dD -E "{1}"'.format(
|
||||
out_file, tmp_path),
|
||||
"Converting " + basename(out_file[:-4])))
|
||||
env = self.env.Clone()
|
||||
env.Append(CCFLAGS=["-x", "c++", "-E"])
|
||||
cmd = env["CXXCOM"]\
|
||||
.replace("$TARGET", '"%s"' % out_file)\
|
||||
.replace("$SOURCES", '"%s"' % tmp_path)
|
||||
env.Execute(
|
||||
env.VerboseAction(cmd, "Converting " + basename(out_file[:-4])))
|
||||
atexit.register(_delete_file, tmp_path)
|
||||
return isfile(out_file)
|
||||
|
||||
|
@ -63,6 +63,10 @@ def _build_project_deps(env):
|
||||
# extra build flags from `platformio.ini`
|
||||
projenv.ProcessFlags(env.get("SRC_BUILD_FLAGS"))
|
||||
|
||||
if ("nobuild" not in COMMAND_LINE_TARGETS
|
||||
and "arduino" in projenv.get("PIOFRAMEWORK", [])):
|
||||
projenv.ConvertInoToCpp()
|
||||
|
||||
is_test = "__test" in COMMAND_LINE_TARGETS
|
||||
if is_test:
|
||||
projenv.BuildSources("$BUILDTEST_DIR", "$PROJECTTEST_DIR",
|
||||
@ -284,8 +288,6 @@ def BuildFrameworks(env, frameworks):
|
||||
if f == "arduino":
|
||||
# Arduino IDE appends .o the end of filename
|
||||
Builder.match_splitext = scons_patched_match_splitext
|
||||
if "nobuild" not in COMMAND_LINE_TARGETS:
|
||||
env.ConvertInoToCpp()
|
||||
|
||||
if f in board_frameworks:
|
||||
SConscript(env.GetFrameworkScript(f), exports="env")
|
||||
|
Reference in New Issue
Block a user