-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Include library paths used by libraries in the compiler search path. #1250
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
Conversation
LibraryA.h can now include LibraryB.h, and the path for LibraryB will be added to the compile line.
Are you ever going to merge this? I think it just confuses users if they are present with a lot extra includes in the top of the sketch. |
+1 |
Looking at the actual code, I have a few remarks:
In other words, I think most of the code should be written differently. I might have a go at this if I can find some time. As for the library spec Jantje mentioned, I think he's right saying that if this autodetection is implemented, the explicit library dependencies which were proposed for the 1.5-style libraries is no longer strictly needed. It could still be useful to specify version constraints, but the need for that is a lot less pressing. I still think we need a proper library spec for metadata and better structured libraries, but that's another matter. In any case, I think it makes sense to implement auto detection of library dependencies, since:
If we fix this issue, btw, I think we should also try to fix #636 at the same time. |
Note that this pullrequest fixes #236 |
Huh? You're proposing that, when you import a library through the menu, it should scan that library for any libraries it uses and add #includes for them too? That sounds like the wrong way to fix this: if the imported library changes and later requires an extra library, any sketches created before will break. It seems to me that this autodetection should work at verify time in all cases? Or did I misunderstand your point? |
I think there exists 2 options. I did not advocate one above the other. I assumed this was one and #636 was the other. |
The point of this pull request was to simply add intelligence to the It should follow #includes of dependent libraries, and be able to do so -Rob On Sunday, December 8, 2013, jantje wrote:
|
och I get it. This one is about the ino file and #636 is about other c cpp files in the sketch folder. |
No worries. I was just clearing up my intent. I'm not sure without checking the code if it works now (with this pull On Sunday, December 8, 2013, jantje wrote:
|
Rob, this pull request cannot be merged cleanly any more, too much changes happened upstream in the meantime. I reworked it and I'll publish in another pull request for review. C |
Ok, thank you. On Sunday, December 8, 2013, Cristian Maglie wrote:
|
I think this pullrequest can be closed in favor of #1726? |
Yes, I'm closing this one. |
This pull fixes a case where libraries that a sketch uses indirectly (other libraries is uses require them) need to be included directly in order to compile.
It is necessary to #include a library's file in your sketch in order for the IDE to add that library's path to the compiler command line. This patch searches the files that are included as well, adding dependent libraries to the search path. This removes then need to directly #include indirectly used libraries.
The upside is that this will not break any existing code. The workaround that's needed now will continue to work, but will simply become unnecessary.
An example, in the Adafruit SSD1331 OLED driver test sketch (https://github.com/adafruit/Adafruit-SSD1331-OLED-Driver-Library-for-Arduino/blob/master/examples/test/test.pde) contains this code:
With this pull, only the directly relevant library to the sketch is needed to be added, and so it could be simplified to:
The library itself includes those files, and so the IDE is able to locate them and add them to the include path. Of course, the old code will continue to work as well.