eried / Arduino

open-source electronics prototyping platform - enhanced release for Windows
http://arduino.cc/forum/index.php/topic,118440.0.html
Other
10 stars 2 forks source link

allow #defines to be passed to the compilation process (aka -D option on GCC) #21

Open markthepiggy opened 9 years ago

markthepiggy commented 9 years ago

I don't know if this can be done already but I haven't found a way.

I #define TESTING (for instance). If I want to change this, i have to remember to do it in every file. GCC lets me do this with the -D flag...

-D name or -D name=definition

Is there any way you can fix things to pass #defines through to the compiler?

eried commented 9 years ago

Why you don't define that in the sketch itself?

Chris--A commented 9 years ago

Consider libraries.

Serial Rx/Tx buffer sizes, pulseIn max pulse width (anything that is compiled before the sketch needs this).

I personally would like each sketch to have the ability to define a platform.txt with compiler.cpp.flags and compiler.c.flags

Then sketches can then default C++98 or C++11, change compiler options easy (not just adding defines). And possibly the addition of a default board/port which others have asked for.

I don't know how I got here, and only just realized, so I'm going to post anyway! But it is what I want for the original/upstream IDE.