-
-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to specify additional compiler flags [imported] #421
Comments
Here's a summary for the original Google Code issue. It talks about:
There are a few links to possible implementations in the original issue as well (but nobody really commented on those). Finally, one of the last comments seems quite insightful to me, so I'll repeat that one here verbatim:
|
Now, I also have some opinions of my own:
|
Anyone had a chance to look over this recently? There were patches proposed back in the Google Code bug that looked promising. Whilst I agree with matthijskooijman (Particularly around sketch specific options), just having some form of user accessible option for compile time options would be a big step up from what we have now. |
I think that -D definitions are probably one of the most common use cases, and should be handled separately from other compiler options. Ideally any sketch or library would be able to have an options.txt file, which would define a list of options that could be changed in a simple dialog box. Either that or a special pragmatic that would let you add things to the dialog from code directly. Since that would be difficult, the easy way might just be to allow the user to create a file in a tab just like a code file containing compiler directives. It could be as simple as concatenating all the lines of the file, putting spaces in between and escaping anything within a line that needs escaping, and tacking it onto the command line, or it could be a more structured file, something like YAML, that would let you override things in boards.tx, like if you had a sketch that is meant to run with a different clock rate. But overriding boards.txt might just be useless bloat because of the overlap with sketchbook/hardware/boards.tx This could be a big deal for libraries. Libraries could become a lot more customizable and faster. The point by matthijskooijman about options going with sketches is important. Nobody likes to modify a library just for one sketch. If the options file was just in another tab, then library writers are free to write in hooks to change stuff. |
HI EternityForest, Some months ago, I worked on a patch to allow sketch to support library options. |
The patch looks good to me. Personally I'd prefer to add the configuration file to my sketch manually, and just have a single optional configuration file per sketch that affected all libraries, but your way is much easier for beginners I think. |
Hi does anyone know what the compiler settings are currently set to in the Arduino IDE and where can I find this? |
I think I found it, though I don't know what I'm looking at exactly. |
Yup, that's the right place. See https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification for (slightly out-of-date) documentation. |
It's really a long-term issue.... But I still want to vote it, because the application-wise definition (-D option) is really important for me. I'm going to write a library, and I want user to use If this's hard to be done in IDE, could you add some special 'higher level' comments in code? For example, let user can define compiler options in code (*.ino file) like this:
You can parse it before send code to compiler, and append/replace the option set in code explicitly. |
@anders-liu could something like this work? facchinm/arduino-builder@904250f |
@facchinm, this looks overpowered to me: AFAICS it allows setting any build property, which is really flexible, but also allows overriding e.g. the entire compiler commandline, which allows executing arbitrary commands as well (e.g. I'm not quite sure where the balance lies: Limiting to just #defines might be good (and perhaps make the syntax more specific for that ( |
Totally agree, right now that approach is very insecure but I like the cgo approach (see https://golang.org/cmd/cgo/#hdr-Using_cgo_with_the_go_command).
into something like
which is super readable and debuggable. |
@facchinm First your efforts are great. But why do I need to involve such heavy build process? I just making some toys... If I need the heavy works, why don't I just switch to an IDE, such as Atmel Studio. |
It's very strange that I can not configure libraries even through the build flags. Vote for this issue |
I need to specify the following easily (currently I'm modifying platform.txt directly, which is terrible because it's not portable):
I like the idea above that would allow me to do something like the following in the sketch:
Making them direct overrides of platform.txt keys would be my preference. That way, it's very obvious what you're modifying. You could also support a simple append functionality if someone just wanted to add a flag (which is probably what I actually need):
Syntax is up for debate; as long as I can do this in the .ino or a .cpp file, I'm pretty comfortable with anything. |
FWIW, I have a somewhat different application for the ability to be able to specify I have multiple very similar hardware units to program that require only minor differences in the source code (which is currently over 1000 lines long), e.g., each has to have a unique IP address, and some have different sensors connected. I'd very much like to have something like Based on a half century of programming, I'd suggest an "Additional Compiler Options" under "Tools" in the IDE. |
This is a very interesting idea @facchinm
Would Arduino maintainers agree with such a PRoposal or has anybody already started to be working on such a great feature ? |
I have a proposal for this issue. |
This is Issue 421 moved from a Google Code project.
Added by 2010-11-30T03:12:51.000Z by [email protected].
Please review that bug for more context and additional comments, but update this bug.
Original labels: Type-Enhancement, Priority-Medium, Component-IDE
Original description
A simple option in preferences.txt to change compiler flags instead of having them hard-wired in would be very nice.
A way to change it in the GUI would be even better.
The text was updated successfully, but these errors were encountered: