When developing a library for PlatformIO and ESP32 (but also other platforms/environments), what ifdef macro name can be used to determine if the code is being compiled using PlatformIO?
For example, #ifdef ESP32
can be used to determine whether the build target is an ESP32. Is there a similar #ifdef PLATFORM_IO
macro that PlatformIO automatically sets that determines whether it's being built using PlatformIO?
I tried Googling for a macro set by PlatformIO, but no results.
You could add your own in build_flags
. Since such a macro would be defined in platformio.ini, it would be implicit that it is a PlatformIO build environment.
Otherwise inspect platformio.ini, there may already be a suitable macro. This suggests that PLATFORMIO
may be defined, further suggests: pio run -v
or pio run -t envdump
to check macros predefined in the build environment. YMMV - I'm just Googling this stuff!