Migrate arduino lib and src_filter

I’m trying to debug and develop an Arduino library. Searching I’ve found that src_dir, lib_dir & src_filter can be adjusted to work with the libraries examples folder, but I can’t make it work.

My library has this folder structure:

|-src
|  |-examples
|  |   |-Foo
|  |   L Bar
|  |     L Bar.ino
|  L MyLibrary.h
L platformio.ini

I’ve setup the contents of the platformio.ini file as:

[platformio]
src_dir = src/examples/
lib_dir = src/
default_envs = devel

[env:devel]
src_filter = +<Bar/>
platform = espressif8266
framework = arduino
board = nodemcuv2

But when I try to compile it seems to ignore the src_filter setting.

> Executing task: platformio run <

Processing devel (platform: espressif8266; framework: arduino; board: nodemcuv2)
-----------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/nodemcuv2.html
PLATFORM: Espressif 8266 2.2.3 > NodeMCU 1.0 (ESP-12E Module)
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
...
...
Error: Nothing to build. Please put your source code files to '/mnt/development/MyLibrary/src/examples' folder
====================== [FAILED] Took 1.47 seconds ======================
The terminal process terminated with exit code: 1

The environment is linux.
Can someone tell me how to correctly set src_filter or what is the problem?
Thanks very much.

take a look at this, might help you:
Ignore the comment in that file, it’s incorrect.

The new extends keyword might make this even easier and better to look at.

1 Like