After a bunch of searching, I think I need to do one of the following:
Do I just need add the platform.local.txt file to:
.platformio/packages/framework
Or do I need to somehow add these precompilation flags to the platform.ini file?
I’ve seen some examples of adding flags here, but by the line in the platform.txt file, its specified to a certain file.
No. PlatformIO reimplements the build system in SCons, to which you can feed your compile flags using e.g. Redirecting... (You also have access to certain environment variables). The platform.txt (and any platform.local.txt) is completely ignored on PlatformIO.
Will make inject -DBOARD=\"esp32dev\" and the other flags.
(And even without defining BOARD, there are already enough identifiying macros for the board in the build process by default: -DARDUINO_VARIANT=\"esp32\" "-DARDUINO_BOARD=\"Espressif ESP32 Dev Module\"" for board = esp32dev).