-
-
Notifications
You must be signed in to change notification settings - Fork 114
Better library dependencies detection #12
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
Comments
I guess you mean "against every source file (in sketch and libraries), not just the .ino files" ? In general, I think that the library detection should never be run on header files at all, just source files (which might include header files). The current situation, requiring that a library includes any libraries it needs from its own public header file(s) and not just its source files, seems inelegant (it discourages proper separation of concerns), but it could be considered acceptable if the proper solution runs into performance problems. We'd certainly have to try it before drawing this conclusion, of course. |
Yes I meant library source files, not its examples .ino As for running gcc -M against .h or .cpp, I'm not a c++ expert, but my knowledge is that every c++ dev out there uses a different "code philosophy", which may lead to including stuff only in headers, only in cpps, or (more linkely) in both of them. So I think running gcc -M against every source file is fair enough |
If you run gcc -M against source files (.cpp / .c / etc.) then any includes in header files included by those source files will be automatically processed as well. Any includes happening in .h files that are never actually included in a source file themselves will be ignored, as I think they should be (since these includes and .h files aren't actually used in the real compilation either). But I think you might be already saying this :-) |
Current implementation of library dependencies detection works only if dependent libraries are included via header files.
If a .cpp file includes a library, that library won't be detected. An example case is SD library version 1.0.5. See https://github.com/arduino-libraries/SD/blob/1.0.5/src/utility/Sd2Card.cpp#L26
A better implementation, suggested in arduino/Arduino#2792, run
gcc -M
against every single library file, not just headersThe text was updated successfully, but these errors were encountered: