Hi,
I’m having a lot of trouble making sense of the chain
rules here.
It says
It also parses C, CC, CPP files from libraries which have the same name as included header file.
I am interpreting this as “it parses the sources files whose names prior to the extension match the name of the header prior to its extension,” i.e. foo.cpp for foo.h, regardless of library name. An alternate interpretation is that it parses all source files of library foo
if a file foo.h
is included, but based on the example, it seems to be the former.
Speaking of the example, it has furthered some of my confusion. In my testing, the name of the source file seemed not to be considered when the header was included. So I specced out the example:
[ben:testing]$ tree
.
├── lib
│ └── Foo
│ ├── extra.cpp
│ ├── foo.cpp
│ └── foo.h
├── platformio.ini
└── src
└── main.cpp
3 directories, 5 files
All files are empty except for main.cpp and platformio:
[ben:testing]$ cat src/main.cpp
#include <Arduino.h>
#include "foo.h"
void setup() {}
void loop() {}
[ben:testing]$ cat platformio.ini
[env:uno]
platform = atmelavr
board = uno
framework = arduino
lib_ldf_mode = chain
All three files are successfully found and compiled:
avr-g++ -o .pio/build/uno/src/main.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -mmcu=atmega328p -Os -Wall -ffunction-sections -fdata-sections -flt
o -DPLATFORMIO=60104 -DARDUINO_AVR_UNO -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10808 -Isrc -Ilib/Foo -I/home/ben/.platformio/packages/framework-arduino-avr/cores/arduino
-I/home/ben/.platformio/packages/framework-arduino-avr/variants/standard src/main.cpp
avr-g++ -o .pio/build/uno/libeb0/Foo/extra.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -mmcu=atmega328p -Os -Wall -ffunction-sections -fdata-secti
ons -flto -DPLATFORMIO=60104 -DARDUINO_AVR_UNO -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10808 -Ilib/Foo -I/home/ben/.platformio/packages/framework-arduino-avr/cores/arduin
o -I/home/ben/.platformio/packages/framework-arduino-avr/variants/standard lib/Foo/extra.cpp
avr-g++ -o .pio/build/uno/libeb0/Foo/foo.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -mmcu=atmega328p -Os -Wall -ffunction-sections -fdata-section
s -flto -DPLATFORMIO=60104 -DARDUINO_AVR_UNO -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10808 -Ilib/Foo -I/home/ben/.platformio/packages/framework-arduino-avr/cores/arduino
-I/home/ben/.platformio/packages/framework-arduino-avr/variants/standard lib/Foo/foo.cpp
Can someone help me find where my understanding is wrong?