Pages: [1]   Go Down
Author Topic: How about a settings file for libraries?  (Read 549 times)
0 Members and 1 Guest are viewing this topic.
UK
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4153
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
LibName/
LibName/LibName.h
LibName/LibName.cpp
LibName/utility/
LibName/utility/*.c[pp]

(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:
[MyLibrary]
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...

Thoughts?
Logged

Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

North Queensland, Australia
Online Online
Edison Member
*
Karma: 65
Posts: 2107
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#include <LibName.h>
#include <LibName/SomeFldr/SomeFldr.h> //SomeFldr.h would be empty, just there to include
Logged


Pages: [1]   Go Up
Jump to: