I'm creating a library where I would like the user to be able to exclude specific parts from it in order to save some space if the memory is getting tight. The user should not be forced to edit the library, but just his own sketch.
In an ordinary gcc-project I'll probably just handle that in the makefile with some variables that will ifeq and add some defines to CFLAGS so it will be preprocessed on all .h and .ccp-files. Easy as pie....
Is there any neat trick that can do the same thing in the Arduino universe?
Doing
#define NO_FOO
#include <mylib.h>
only affects the mylib.h. The mylib.cpp never sees the NO_FOO-variable.
I've tried to put the #define in a separate .h-file
#include <mylib_no_foo.h>
#include <mylib.h>
in the hopes that some of the Arduino magic preprocessing would add all #includes too all source files but no dice. (I'm not really 100% how the Arduino IDE does its stuff.)
So - is it possible do do this? Or should I just let the users suffer?