-
Notifications
You must be signed in to change notification settings - Fork 132
Support for library projects #1506
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
Your believe is wrong.
It does not have to be outside of the workspace. It can be; but I would advice against it as you may want to trigger version control from inside sloeber.
Sloeber does not do anything with "dependent projects" so Sloeber behaviour should be standard CDT behaviour.
One executable sketch per configuration.
Sloeber only creates a sloeber.ino.cpp when your project contains an ino file. This has nothing to do with libraries.
Sloeber does not support a "library project" Library projects should be standard eclipse projects. You seem to have many views very different from me. You really should try the way as it has been designed. |
Well, if you search the forum I first posted about this back in 2016. What I wanted wasn't supported by Sloeber then and you effectively confirmed that. I am now picking up 6 years later. Perhaps the trouble is in our use of the term "library". I am not talking about a formal C/C++ library. I am talking about a dependent project containing source code that gets included in the parent executable project's build. Perhaps I am misunderstanding what you are recommending but for what I want to do, in 2016 as well as now, what I described seems to work just fine for me with minimal problems as long as I stick to the procedure I described. BTW: I confirmed what you said that, without an .ino file, no sloeber file is generated. Thanks for the correction. Also, for projects containing multiple .ino files (e.g. unit tests), I simply edit the "#includes" reference in the one sloeber file. Not sure if there is anything more to discuss. Thanks again. |
I fully understand the Libraries confusion problem.
I though that that the definition of a Arduino library is "source code from somewhere else that gets included in the project's build". I think your definition matches mine. I'm serious, I really do not see the difference between your library and an Arduino library.
I guess I was thinking about binary libraries then. But he; 6 years ago ... I don't remember and Sloeber came a long way since then. Thanks for being a long term user. The original epistle is below For me in a Sloeber/arduino context libraries are Arduino libraries and are source code level sharing. Simply because I'm not aware of any binary library support in the Arduino framework. I currently do not see a good way to use "binary" libraries" in sloeber. Your way described above uses source code sharing. Look at your point 1.2 If you really want to use binary libraries there is something new. #1498 (if compatible with the board/use case you are using) allows for including "binary libraries". in short With #1126 and #1498 and "CDT project dependencies" and "standard eclipse linking capabilities" it should be possible to use "binary libraries" in Sloeber And a final note on this. When using this new functionality you will have to take into account that the binary library is compiled with a toolchain for a specific board with a specific version. I don't know a easy way to pick the "right for your board binary library" |
I am in no way advocating or attempting to use binary libraries -- way beyond my pay grade. As for "importing" dependent projects, yes, what you mention is the same as what I am doing. To be clear, however, your writeup specifically mentioned the library directory being outside of the workspace. Mine are all inside the workspace, i.e. other projects. As for the "complication" of my approach it may just look that way because I was trying to be thorough and helpful, especially for a newbie to Sloeber. Besides the project importing, the only real complication is in projects that also include executables, such as unit tests. In this case you have to make sure you have the proper sloeber file when using the project as an executable, and no sloeber references (.o, .d iin the Release directory) when using the project as a library -- the root executable must only have one and only one sloeber reference. If a project is just a library or just an executable then things are a lot easier. Hmmm. It would be great if there were a way to designate a project as being an executable or a library project. The former would get a sloeber file, and the latter would not, even if the project contains .ino files (i.e. unit tests and such). Also, I am able to include multiple .ino files in a given project, such as for unit testing, by editing the sloeber file accordingly. (I noticed that if I have multiple .ino files Sloeber will include all of them automatically, and I have to manually edit it to include only one .ino reference and one set of setup()/loop() calls. I also generally delete all includes except arduino.h). It would be great if, in the case of multiple .ino files in a project, Sloeber would ask which one will be the uploadable executable, if any (i.e. if used as a library project then it should have no executable and no sloeber references). Thanks |
I guess you are referring to
The reason I write is this way is because most people assume that when they copy a eclipse project they have all the source code. (That was how eclipse used to be and that was my assumpion and I was bitten by this so I want to warn people) As in this example I wrote:
The source code is in the C:\Users\jan\Documents\Arduino\libraries folder which is not in your project.
Then becomes in the project ArduinoLibraries in your workspace create a subfolder with the library name
Is still true as the code is in the git folder which is unlikely to be in the current workspace. In other words: The source code is not in the workspace because in this example I specifically opted to not do so. This is not a limitation of the functionality but a consequence of the decisions made in this example. I'm curious on how you do the unit tests. Are you using my hardware repository?
I have reread this a couple of times but I can't make sense of it. Could we have a video chat so I have a better understanding?
Please understand that Sloeber does not need .ino files. I started supporting .ino files when I started to add code to support library development. Because if you want to create examples you need .ino files. |
The arduino framework specifies that when multiple .ino files are in the project all the ino files need to be processed with the .ino file with the same name as the folder first. |
Sorry I haven't gotten back to you sooner. I've been sick this week. Hopefully I'll be better later this week and can catch up and schedule a call with you. Thanks so much for your offer. --jon |
I thought I had posted earlier. Oh well..... I have some time in the next week or so if you want to pursue this issue I raised last year. --jon |
Can this be closed? |
I've since moved on to other things and haven't done Arduino in quite a while. I may need to revisit old projects in the future. The ability to have sloeber projects reference other projects for whatever reason (libraries and/or executables), the same as other eclipse projects, I feel, is a good feature to have. However, if you would like to close it I understand. |
I agree and that feature exists in several ways. |
As you (jantje) suggested, I have started a new issue rather than commenting on an old issue.. I also included below what I have developed as a workaround for support of "library" projects, which was previously posted in the old issue.
I read the article http://eclipse.baeyens.it/how_to.shtml#/j that you suggested regarding the creation of user libraries as a solution to the problem I was trying to solve. I think your solution has a major deficiency when compared to mine: In mine, if I edit a source file in a library project, and then verify/upload the parent executable, the child project will be rebuilt automatically and the changes included in the executable. I believe in your solution the edited source files must be explicitly copied to the external library directory before rebuild, which is outside of the workspace and therefore not managed by and Eclipse.
I look forward to discussing this and hopefully in the process helping to improve the IDE you have developed.
Thanks
--jon
============================
Background:
Using the latest Eclipse and Sloeber Arduino plugin as of 2022-10-15, the plugin
provides Eclipse with an Arduino IDE. It has several serious limitations as
regards project development involving reusable "libaries":
Details:
The following procedures have been developed through trial and error. These are
not foolproof, especially since the Eclipse-Sloeber platform is brittle, easily
succumbing to missteps and synchronization problems.
The text was updated successfully, but these errors were encountered: