build_src_filter

Type: String (Templates) | Multiple: Yes

This option allows one to specify which source files should be included or excluded from src_dir for a build process. Filter supports two templates:

  • +<PATH> include template

  • -<PATH> exclude template

PATH is relative to src_dir. All patterns will be applied in their order of definition. GLOB Patterns are allowed.

By default, build_src_filter is predefined to +<*> -<.git/> -<.svn/>, meaning “include ALL files, then exclude the .git and svn repository folders.

This option can also be set by the global environment variable PLATFORMIO_BUILD_SRC_FILTER.

Example

Include all .c and .cpp files recursively (** means ANY path) to the build process but exclude assembly files .S and .asm:

[env:myenv]
build_src_filter =
  +<**/*.c>
  +<**/*.cpp>
  -<**/*.S>
  -<**/*.asm>