2

I want to have a define from my sketch be picked up by a library. Here is a similar question for references: Using #define and multiple classes

I have a CI server that compiles my arduino sketchs on commmit. It pulls all my personal libs from an other repository and compiles the sketch using arduino-builder.

Now i want it to also make a debug build. (Some of my library's have debugstatments in them i enable using a #define debugsomething.

Is there any way i can get the compiler to pickup the #define in the sketch or am i better off making a very complex build script that modifies the headers between builds?

Pimmetje
  • 103
  • 8

1 Answers1

2

You need a common place that the building of all the places can get the definition from.

That isn't the sketch. The sketch is one of the things that would have to look at that common place.

That can either be a single shared header that everything else (that needs it) includes, or it can be a -D flag added to the compilation command.

For instance, adding:

-DDEBUG=1

to your compilation command is the same as adding

#define DEBUG 1

to every single file you compile.

Majenko
  • 105,851
  • 5
  • 82
  • 139