You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PlatformIO Core.
If you’ve found a bug, please provide an information below.
Configuration
Operating system: Windows 10 x64
PlatformIO Version (platformio --version): 6.1.12a1
Description of problem
Per documentation it is possible to use env.AddBuildMiddleware(callback, pattern) to modify the compile settings of specific files (SCons objects).
However, even returning env.Object(node), that is without any other options to modify compiler settings, in the callback to this function breaks PlatformIO's ability to identify the library dependencies or at least add the proper include compiler settings to the build of that specific file. Specifically, creating a minimal library MyTestLib in the lib/ folder with one .h and .cpp file implemeting a simple return 42; function and adding #include "MyTestLib.h" to the src/main.cpp will fail compilation if this extra_scripts = pre:test.py is added:
Import("env")
defpass_through(node):
print("Node '%s'"% (node.name))
#print("Type: " + str(type(node)))# pass through works fine#return node# wrapped in env.Object() fails, even when not modfying settingsreturnenv.Object(node)
env.AddBuildMiddleware(pass_through)
Note that return node itself works fine, but that eliminates any possibility to modify compiler settings for just that file.
Scanning dependencies...
Dependency Graph
|-- MyTestLib (License: Unknown, Path: C:\Users\Max\temp\gran\lib\MyTestLib)
Node 'MyTestLib.cpp'
Node 'main.cpp'
Building in release mode
avr-g++ -o .pio\build\controllino_mega\src\main.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -mmcu=atmega2560 -Os -Wall -ffunction-sections -fdata-sections -flto -DPLATFORMIO=60112 -DARDUINO_AVR_MEGA2560 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10808 -IC:\Users\Max\.platformio\packages\framework-arduino-avr\cores\arduino -IC:\Users\Max\.platformio\packages\framework-arduino-avr\variants\Controllino_mega src\main.cpp
src\main.cpp:2:10: fatal error: MyTestLib.h: No such file or directory
Expected Results
Should compile fine since no compiler settings were modified (yet), node was just wrapped into an env.Object() like the documentation suggests is possible.
What kind of issue is this?
If you’ve found a bug, please provide an information below.
Configuration
Operating system: Windows 10 x64
PlatformIO Version (
platformio --version
): 6.1.12a1Description of problem
Per documentation it is possible to use
env.AddBuildMiddleware(callback, pattern)
to modify the compile settings of specific files (SCons objects).However, even returning
env.Object(node)
, that is without any other options to modify compiler settings, in the callback to this function breaks PlatformIO's ability to identify the library dependencies or at least add the proper include compiler settings to the build of that specific file. Specifically, creating a minimal libraryMyTestLib
in thelib/
folder with one.h
and.cpp
file implemeting a simplereturn 42;
function and adding#include "MyTestLib.h"
to thesrc/main.cpp
will fail compilation if thisextra_scripts = pre:test.py
is added:Note that
return node
itself works fine, but that eliminates any possibility to modify compiler settings for just that file.Steps to Reproduce
return node
Actual Results
Expected Results
Should compile fine since no compiler settings were modified (yet), node was just wrapped into an
env.Object()
like the documentation suggests is possible.If problems with PlatformIO Build System:
The content of
platformio.ini
:Source file to reproduce issue:
Additional info
Relevant use-case per https://community.platformio.org/t/how-to-use-custom-debug-build-flags-per-file/35593.
The text was updated successfully, but these errors were encountered: