Build external sources

If your project depends on some arbitrary source files that are located outside of the usual source directory src_dir then you can use a preliminary extra script to add them to the build process. A typical situation when this approach may be useful is when a project depends on pregenerated files in a temporary folder. Here is a typical configuration with an extra_script that instructs PlatformIO to build all sources in an external folder:


platform = ...
extra_scripts = (place it near platformio.ini):

import os


    os.path.join("$BUILD_DIR", "external", "build"),
    os.path.join("$PROJECT_DIR", "external", "sources")