Go Down

Topic: How about a settings file for libraries? (Read 917 times) previous topic - next topic


At the moment, when writing a library, you are quite restricted in what you can use as regards files.  From what I understand, you have:

Code: [Select]


(not including keywords, and examples)

It would be really really nice if you could include an "info" file that describes the library to the IDE/compiler.

I am thinking being able to list what .cpp files make up the library for compilation, so you're not restricted to having to put all your .cpp and .c files into "utility".  It could also list libraries this library requires, so that the compiler can include them for you without you needing to have them in your main sketch (which really sucks IMHO).

Something like:

Code: [Select]

cpp = main.cpp bits/something.cpp bits/somethingelse.cpp spoon/fork.cpp
h = MyLibrary.h include/myBits.h
requires = SPI.h Wire.h

It could even be expanded to allow multiple libraries to me built up from one library folder...



I agree with some sort of hint to add in libraries without adding them to a sketch. But I'm not to keen on a separate settings file. If the Arduino pre-compiler stage has to read a file for options it might as well scan a .h file and interpret its '#include' for additional libraries and folders. This code must already partly exist as its done to include the libraries from a sketch.

I also feel the temporary output directory should be created in the sketch folder. A 'clean' command from the IDE could solve any temp data left hanging around.

I have not run into the 'utility' folder restriction as yet I'm happy with all the files in the one spot. Does something like the code below not work?

in sketch .ino file.
Code: [Select]
#include <LibName.h>
#include <LibName/SomeFldr/SomeFldr.h> //SomeFldr.h would be empty, just there to include
Forum Mod anyone?

Go Up