Sub-project using only part of the main sources

My main project is building a library for ESP32/ESP8266. A small subset of it is used to build a Linux spinoff library (AMD64).

Up to now I am manually copying the necessary sources into the Linux directory and run a Makefile afterwards to build.

I would like to have that integrated into the main project, so that the Linux library gets built whenever the affected main project sources have changed. Is that possible at all?

Hi @miq19, it’s possible, but will require some advanced techniques. First of all, PlatformIO has a special platform called native that uses the toolchain installed on your host machine, so you probably can just add a new environment based on this native platform and thus make it part of your PlatformIO project to avoid copying sources and compiling it separately. Alternatively, you can also create an extra_script where you can automate whatever build steps you want (copying sources, running make, etc.)

1 Like