Build Flags Script Fail

String escaping is tricky. If you get a compile error it seems to me that the script is indeed called and will appear in project tasks “Advanced → Verbose Build” but will not have the correct form of quotes around it.

Please see Inject Board Name into Code - #2 by maxgerhardt for string escaping.

It it is maybe also preferable to not do a build_flags = !python build_flags.py but use extra_scripts as there you can directly add into the build environment settings (env["CPPDEFINES"] etc.).

Either that, or use the stringifaction macro in your code.

#define stringify(s) _stringifyDo(s)
#define _stringifyDo(s) #s

// use this macro instead
#define GIT_REV_STR stringify(GIT_REV)