-
-
Notifications
You must be signed in to change notification settings - Fork 398
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
How to add required library with the code in src or some relvant folder to enable compilation #699
Comments
If it's a public repository, please post a link to it so we can get a better idea of what you're trying to accomplish.
Why would you need to change the libraries? Is it because you're bundling them with the sketch under the
It's not clear to me what you mean by this. Are you saying that something that works when you use the Arduino IDE doesn't work when you use Arduino CLI? |
I have written fec.c and fec.h and few other such header and c files which I include in my sketch with #include<fec.h> #include<abc.h> on my computer... I am able to compile my sketch because I have kept these files in /Documents/Arduino/Libraries/custom/ on my windows PC. I want to take my same code that runs on the desktop and upload it to GitHub while having CI for it. Read somewhere that when compiling sctech if you keep headers and c files in /src subfolder in your folder it compiles similarly. But it is not doing so In this case |
https://github.com/ArminJo/arduino-test-compile |
OK, I understand now. It is possible to do this using Arduino CLI. Arduino CLI allows you to place a configuration file in the sketch folder. So you can have sketch-specific configurations. This means you can define any arbitrary location you like for your user directory (this is just another term for what we call the "sketchbook directory" when using the Arduino IDE) to be installed, including in a subdirectory of the sketch! The libraries are installed in the Let's say you have this sketch folder structure:
and in arduino-cli.yaml: directories:
user: user (You can name the user directory anything you like, I just happened to name it Then if you have in Foo.ino: #include <Bar.h> It will work just as it does if you had the Bar library installed in your global sketchbook when using the Arduino IDE. There is a request for adding a formal system for doing this here: https://github.com/arduino/Arduino/issues/7755 (as well as a couple related ones I linked to from that issue). Since we already have that feature request, and I think I've answered your question, I'll go ahead and close this. If you find that the current capabilities of Arduino CLI or the feature requests won't provide for your use case, you are welcome to reply here with more information and I'll consider re-opening the issue. |
Are you sure? From reviewing the code, I think it allows putting a config file in the current working directory (or any parent directory), which might not necessarily be the same as the sketch directory. Lines 154 to 156 in 8220b32
Unless the current dir is changed to the sketch directory, but I think this code runs way before figuring out what sketch to use, and I could not find any |
Yes, you're right. I should have been more specific about that. Thanks for clarifying. I meant that you should place the configuration file that is used to provide the configuration specific to a sketch in that sketch's directory. This way, you are bundling the Arduino CLI configuration that is required for the sketch to work with that sketch. I didn't mean to imply that Arduino CLI treats the configuration file in that location any differently than it would a configuration file in any other random location (though that would be a nice feature now that I think of it EDIT: one that has already been discussed in detail: #30 (comment)). It's convenient to run arduino-cli commands from the sketch directory because this way you don't need to add the sketch path argument to your commands. |
Am trying to setup CI for my Arduino project on Github. My sketch uses many self-made header files and which I want to be included in /src subfolder. Tried to write #include "/src/abc.h" . However then different libraries again depend on other libraries. I don't want to change all of those libraries. Does Arduino-cli has any option or any way in which I could compile the files as they are without changing the path like I run in desktop
The text was updated successfully, but these errors were encountered: