Hi!
I have a library with a common interface contained in a header file. It is split into multiple implementation in separate source files.
Lib structure:
- lib
-- example_lib
--- include
---- example_lib.h
--- src
---- impl_a
----- example_lib.cpp
---- impl_b
----- example_lib.cpp
--- example_lib_impl_a_scope.py
--- example_lib_impl_b_scope.py
And in example_lib_impl_a_scope.py
:
Import("env")
env.Append(SRC_FILTER=["+<lib/example_lib/src/impl_a/example_lib.cpp>"])
In platformio.ini
:
[env:env_that_uses_impl_a]
build_src_filter =
+<main-env_that_uses_impl_a.cpp>
extra_scripts =
pre:lib/example_lib/example_lib_impl_a_scope.py
I have tried adding example_lib_impl_a_scope.py
to library.json
and then it works/build only the impl_a/example_lib.cpp
source file (but doesn’t fulfill what I want since I want to control which implementation to use from platform.ini
). However, when calling the script from platform.ini
it builds both source files in lib.
How do I accomplish what I want here? I’m sure there is a way.