I am trying to create a platformio.ini for a project, that comprises multiple arduino sketches, as in:
├── Arduino
│ ├── v1
│ │ ├── some_lib.cpp
│ │ ├── some_lib.h
│ │ └── v1.ino
│ ├── v2
│ │ ├── some_lib.cpp
│ │ ├── some_lib.h
│ │ └── v2.ino
│ ├── v3
│ │ ├── some_lib.cpp
│ │ ├── some_lib.h
│ │ └── v3.ino
v1, v2 and v3 target different boards and have (safe for some_lib) completely independent source-codes. Now, this isn’t my project - the author is targeting the Arduino IDE (hence the .ino files). I would just like to contribute a multi-env platformio.ini without touching anything else. My first attempt looks like this:
[platformio]
src_dir = Arduino
[env]
framework = arduino
[env:v1]
platform = someplatform1
board = someboard2
build_src_filter =
-<*>
+<v1>
[env:v2]
platform = someplatform2
board = someboard2
build_src_filter =
-<*>
+<v2>
[env:v3]
platform = someplatform3
board = someboard3
build_src_filter =
-<*>
+<v3>
The issue here seems to be that PIO fails to convert the .ino to .cpp - the compiler only sees some_lib and the linker finally complains:
Linking .pio/build/v1/firmware.elf
.pio/build/v1/libFrameworkArduino.a(main.cpp.o): In function `main':
main.cpp:(.text.startup.main+0x22): undefined reference to `setup'
main.cpp:(.text.startup.main+0x26): undefined reference to `loop'
collect2: error: ld returned 1 exit status
It works fine when renaming the inos to cpp - but again: not my project, so that’s not really an option. Is there any way to do this without additional pre-scripts?
Oh, also: First post - hi everyone!