Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Implement "lib_extra_dirs" option for project environment #537
My platformio.ini :
I also have ../lib/mylib/lib.h that is #include in my sources
possible solution is to have two environment variables : lib_dir to specify where we PUT the required libs, and inc_dir to specify where are our private library not managed by platformio downloader.
I want to mention that in PlatformIO 3.0 the logic with Library Manager will be rewritten from the scratch. By default all libs will be installed in
I recommend to take a look on the all lib-related issues for PlatformIO 3.0. https://github.com/platformio/platformio/issues?q=is%3Aopen+milestone%3A3.0.0+label%3Alib
The question: will PlatformIO 3.0 resolve your issue?
The way you explain it, it won't, because my private library is in ../lib and not in ./lib .
In my case I need to have :
If I understood well, the first point is not possible in pio 3 , I assume the semver lib dir can be changed so the second point would be.
Currently, we have only 3 locations where LDF looks for libs https://github.com/platformio/platformio/blob/develop/platformio/builder/main.py#L91
I'm not very good at python.
What I see from ( https://github.com/platformio/platformio/blob/develop/platformio/util.py )
getprojectlib_dir should have its own resolution instead of static lib/, eg
def get_projectlib_dir(): return _get_projconf_option_dir( "inc_dir", join(get_home_dir(), "lib") )
then this method could return a list of directories ( change the get_projconf_option_dirS to split the option_dir by ',' then map using expanduser) which would be appended the two other lib directories in main.py
I'm not very good at python so I don't try to do that right now, but I may give it a try if you can't afford.
Sorry I didn't get a question in previous comment, so to be constructive I looked at your link which actually was some code. It took me some time and I feel awkward when you tell me to look at code then to not to after I did look at code.
Please rephrase your question. I can rephrase my issue if you don't get my point, as it seems we don't understand each other well.
My previous comment proposed to modify code in utils.py. It was composed of two successive modifications, the second one being optionnal
Those modifications do not require to modify LDF, furthermore they only ADD functions (the
This is equal to the default value
This is equal to the
If you don't want to put any info into
You don't understand me, and I'm tired of trying to explain myself.
Let me rephrase:
As I've said above, I don't like current PlatformIO 2.0 scheme with these lib folders. In this case, I propose these options:
*And the last... *
You want to have "OWN" PRIVATE INC dirs. No problems. See my #537 (comment). According to it you will have ability to specify OWN EXTRA LIB dirs. You can call them "PRIVATE" or even "SPONGE BOB DIRS". For example,
[env:myenv] platform = ... board = ... lib_extra_dirs = /path/to/private/dir1,/path/to/private/dir2,/path/to/sponge/bob/dir
Now, please forget about "i want inc_dir" and try to listen what I propose. If you have corrections/comments to my proposition, I'm glad to correct it.
@glelouet I am pretty sure working on such an important _open-source_ project and getting this kind of answers is tiring too. Just saying.
@ivankravets what you propose sounds good and reflected to me
@glelouet I'm having trouble reading the original request. If I'm reading you right, you've got two concerns;
Going back to your original requirements (I've fiddled with the names because the terminology is confusing);
My understanding is that the Arduino IDE is an ignorant beast, and it'll only include libs which sit inside
I'm not understanding how this would solve your problem. Using this method it sounds like you would be telling PlatformIO to use/place libs from/in
Concerning Arduino IDE compatibility, even if you tell platformio to dump libraries in the
You could work around this issue by using symlinks (yay for linux) or in PlatformIO 3 you can fold
@ivankravets suggestion of using a
I would expect the following to work just fine:
Honestly, I can't see a way to fix compatibility with the Arduino IDE if you keep using the
Bear in mind I'm not very familiar with the Arduino IDE because I find it horrible to use. If you know something we don't about how to include libraries, let us know.
Well, it also has a list of libraries folder to look into.
following this blog ( http://www.ikravets.com/computer-life/platformio/2014/10/07/integration-of-platformio-library-manager-to-arduino-and-energia-ides ) it would. (short : setting the lib_dir to ~/Arduino/Libraries )
I didn't understand the [env:xxx] and it was about platformio 3 .
I only had ONE issue with platformio 2 , and this was, that I could not override the ./lib/ as being the SPONGE BOB folder. Maybe the example of code I gave you could help, maybe it was stupid ; but in the end you throw it away and this is rude.
Yes but when I feel like my point is out of the discussion there is no reason for me to try to discuss. I don't want to waste time, nor to waste yours - platformio is good and I'm sure you can enhance it.
I unsuscribe, just realized I didn't get nor bring anything good from this.
@glelouet Why did you close this issue? Please read my comments above. I don't have any objections to resolve this issue but it will be done in PlatformIO 3.0. Also, please read carefully #537 (comment) and I wait for the answer: "Will PlatformIO 3.0 resolve your issue?" according #537 (comment)
P.S: You are right, let's save time each other. What is more, all PlatformIO users are equal for me. I mentioned a few PlatformIO users above "not for the help to humble @glelouet", but for the constructive answer as for #537 (comment).
I don't know these users, but they are authors/commentors of a few issues related to PlatformIO 3.0 Library Manager. See https://github.com/platformio/platformio/labels/lib
As you can see, I don't have aim to "discard all users requests" but quite the contrary I'm grateful them for the comments, ideas and corrections. The only this friendly and politely discussions in our community will help PlatformIO Team to create PlatformIO FOR THE ALL, but not only for @ivankravets.
@glelouet don't be discouraged, your requests are still valid. The biggest problem with this issue is the terminology and requirements are slightly confusing, so unfortunately you will need to bear with us while we confirm exactly what the issue is, and if it's something PlatformIO can/should resolve.
Thanks for the link, that's very informative about what it is you're trying to accomplish.
Unfortunately, I think this still doesn't address the problem of Arduino IDE not being able to see the
With that covered, let's ignore the issue of Arduino IDE's terrible library management and address this whole
I think Ivan is really trying to concentrate his efforts on bringing PlatformIO3 into production, as it'll fix a massive range of issues rather than just this one concern, so he's looking for how a feature could be added to PlatformIO3 which will solve this issue, rather than continuing to work on deprecated PlatformIO2 code, which will only be thrown away in the coming months.
Unfortunately with OSS, unless you're willing to make your own contributions, it can mean waiting until the authors goals align with yours and also coming to a compromise with them.
As an aside, using CLion I achieved the same ability - adding multiple lib dirs in PlatformIO2, by adding the following configs:
and I think I also used:
How do you set this? I Googled for it and I couldn't find anything.
///// Thanks for the clarification.
That is compiler/preprocessor flag. PlatformIO Library Dependency Finder doesn't handle it. We have 2 different meaning under
As for Arduino IDE & PlatformIO. @glelouet is right, we can share the same folder between PlatformIO & Arduino IDE without problems.
The issue here that @glelouet wants to keep "some private" libs between both sides. I hope that PlatformIO 3.0 will help him to achieve it.
@glelouet please answer. Thanks.
I gave up arduino IDE and gave Atom+Platformio a try.
well I wont discuss the variable name, I think separating global and project-specific libs like this is good
Well, I think we should have a separation between platformio
Besides those may-be issues, it seems good to me.
changed the title from
Implement "lib_extra_dirs"; use "lib_dir" for private libs
Implement "lib_extra_dirs" option for project environment
Jul 15, 2016
added a commit
Jul 15, 2016
Temporary link to development version of PlatformIO 3.0 docs http://docs.platformio.org/en/feature-platformio-30/projectconf.html#lib-extra-dirs
this thread got me confused as hell, i have a couple of questions:
note: build_flags = -Ldidn't work as well
You can place temporary your own libraries to
PIO3 is planned for release tomorrow.