builder

Optional | Type: String

Override default PlatformIOLibBuilder with another builder. Currently supported builders:

Examples

  1. Custom macros/defines

"build": {
    "flags": "-D MYLIB_REV=1.2.3 -DRELEASE"
}
  1. Extra includes for C preprocessor

"build": {
    "flags": [
        "-I inc",
        "-I inc/target_x13"
    ]
}
  1. Force to use C99 standard instead of C11

"build": {
    "unflags": "-std=gnu++11",
    "flags": "-std=c99"
}
  1. Build source files (c, cpp, h) at the top level of the library

"build": {
    "srcFilter": [
        "+<*.c>",
        "+<*.cpp>",
        "+<*.h>"
    ]
}
  1. Extend PlatformIO Build System with own extra script

"build": {
    "extraScript": "generate_headers.py"
}

generate_headers.py

Import('env')
# print(env.Dump())
env.Append(
    CPPDEFINES=["HELLO=WORLD", "TAG=1.2.3", "DEBUG"],
    CPPPATH=["inc", "inc/devices"]
)

# some python code that generates header files "on-the-fly"