-
Notifications
You must be signed in to change notification settings - Fork 447
Add automatic lib detection #341
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
the main thing that bugs me is shelling out to another python script :-( what does this do that the current detection doesn't - libs that call other libs or something? as system, platform and user lib autodetection already works quite well i think. can you provide some build output so we can get an idea? |
Yes exactly. The idea is to be able to only include the main lib in your sketch and let the makefile figure out which other libs it needs to link and compile. This is something the IDE is going to support real soon. Here is the output of the build process: https://gist.github.com/ladislas/b5d245e9f8f4ffa6a26a |
i'm surprised it doesn't remove a shedload of code from Arduino.mk then, for instance all of this lot becomes redundant doesn't it? https://github.com/sudar/Arduino-Makefile/blob/master/Arduino.mk#L825 another two things i can think of - we'd need to search for the binary in the path, not just ARDMK_DIR/bin, like we do here (as debian etc. would want it in /usr/bin/): https://github.com/sudar/Arduino-Makefile/blob/master/Arduino.mk#L737 which probably means giving it a more specific name than "lib-detection", maybe "ard-lib-detection"? and also it would need a manpage, which also means we'd have to update the fedora specfile (and the debian package). and replace tabs with spaces in the python script. and the regex only matches quotes not brackets, so this doesn't work: edit: hang on, does this only work on user libs? this regex works for me:
then use although there's a stray newline somewhere between system/platform:
Here's my "fixes" for the above issues for you to look at (minus the manpage): but it still seems to be replacing code without actually removing it from Arduino.mk (maybe?) and i'm still not convinced, it seems to be replacing USER_LIBS and ignoring ARDUINO_LIBS if manually set. and it doesn't find libs in the same directory as the sketch as it only searches USER_LIB_PATH, so doesn't appear to be any better than the current auto-detection. Does this fix any of these issues? Either way, we should probably tag a new release before merging this sort of big change in. |
thanks for all your feedbacks! :) I'm currently working on it and to answer your questions:
yes.
Ok, I'll do that.
Changing that.
sure.
yes, the idea was to only work on user libs and not on the Arduino core and platform libs. Do you think it could be useful as well?
I'll look into that as well as into the useless code.
Already done.
Yes for #93 and #251. Haven't tried #249 yet.
Agreed |
@ladislas - if you look at my branch linked above, i've already fixed most of the items other than removing "legacy" code and writing a manpage. see what you think. i don't think its worth supporting platform/system libs, it'll just slow things down more and they shouldn't change often anyway. might be worth documenting though. issues #249 / #251 don't seem to be fixed for me. libraries stored within my sketch directory are not printed, although they seem to be linked: directory:
output:
sketch:
Although I guess putting libraries inside the sketch is bad form anyway, and the IDE wouldn't work with that either. |
Hey there!
It's been a while, but I'm back with my automatic library detection PR ;)
I've tested it on Bare Arduino Project and Moti and it works great.
Would love to have some feedbacks :)