The question is in the title.
I learned to do the opposite. Now I need to check, eg,
#define DRIVER_ILI9341 1
in the code before compilation and execute this or that script after compilation.
Is this possible?
Thanks.
The question is in the title.
I learned to do the opposite. Now I need to check, eg,
#define DRIVER_ILI9341 1
in the code before compilation and execute this or that script after compilation.
Is this possible?
Thanks.
Yes, Marlin already does this. It invokes the compiler with a special -E
flag that outputs what macros are set to what value after parsing one .h
or .c
file (source). Assuming you want to write an extra_script which checks if a macro was set in one particular header file and then execute one action or another, Marlin’s script is a good starting point.
I understand python very poorly. Probably after bash scripting in Linux. Please show me how to use this? Sorry, I’m ashamed .
I’ve setup a minimal project at GitHub - maxgerhardt/pio-check-flags: An example project that shows how to check if a certain macro is active in a file..
This is exactly what I wanted, thanks a lot!