PlatformIO Community

Common source sharing

Hi,
I have multiple ESP32 with Arduino framework projects that share some common code (like connecting to Wifi and uploading sensor data). So I created another Folder that contains this common code, but I don’t quite understand how to link that.
Structure:

ProjectA
ProjectB
ProjectC
    src
        main.cpp (include CommonCode.h)
CommonCode
    src
        CommonCode.cpp
        CommonCode.h

With lib_extra_dirs I get it to compile, but it doesn’t link. How can I do that? (Without uploading it as a library to Github)
Also, how do I specify that this code is board agnostic? I don’t want to build that library towards a certain board, but against a certain framework (Arduino).

Karsten

Probably it would be a good idea to use your common code in form of a standalone library.

ProjectA
ProjectB
ProjectC
    src
        main.cpp (include CommonCode.h)
Libs
    CommonCode
        CommonCode.h
        CommonCode.cpp