-
Notifications
You must be signed in to change notification settings - Fork 7.6k
How Do I add a library from GitHub when setting up Arduino as an ESP-IDF component (IDFGH-8420) #7839
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 think that there are 2 necessary steps to get a library working within the Arduino as Component Model:
set(LIBRARY_SRCS
libraries/ArduinoOTA/src/ArduinoOTA.cpp
libraries/AsyncUDP/src/AsyncUDP.cpp
.... |
It may also be necessary to modify the include list in "components/arduino/CMakeList.txt" set(includedirs
variants/${CONFIG_ARDUINO_VARIANT}/
cores/esp32/
libraries/ArduinoOTA/src
libraries/AsyncUDP/src
libraries/BLE/src
libraries/BluetoothSerial/src
..... |
To make it easier, these are the changes necessary to include ESPAsyncWebServer and also for AsyncTCP (if necessary). This modifications were done in "components/arduino/CMakeList.txt" and it can build the sketch using that library.
|
I think we can close this issue as solved. This is not a bug. |
There is another way to solve this issue. Maybe easier. In your
It will include all library source code and include files to your project and it will also solve the issue. |
Thanks so much. I used the first solution. I appreciate it! I'll close the issue now |
Sorry I just reopened this issue again but do you know how I could by any chance include any of the two the following 2 libraries after downloading them and extracting them to my project: https://github.com/mobizt/Firebase-ESP32 I tried the strategies you mentioned above but I'm getting lots of errors! Your help is greatly appreciated!! |
@SuGlider your help would be greatly appreciated - you really helped me out last time too! |
@MatthewGerges2 - Please be more specific in order to help me to help you. What is the sketch you are trying to run? |
At a first glance, I'd suggest you to: 1- clone Firebase-ESP32 under
2- Copy some Firebase-ESP32 example there, such as
2- Modify your
4- build it
|
I proceeded exactly as explained above and I've successfully built the |
Hi @SuGlider, I there any official documentation on how to include existing esp32 library in to your project? |
No.... not that I have knowledge, at least. |
The general rule would something like: Example:
The Folder Structure for this Arduino as Component project would be something like this: arduino-proj/ The main changes are all to 1- Copy 2- Set you main project
3- Modify your
4- Now, just build it
|
Wow tanks you very much! |
For me, I had to add every CPP and C file into SRC in addition to what you have done like the following
otherwise I get the following error
|
This will be solved with the PR #8115 |
Answers checklist.
IDF version.
4.4.2
Operating System used.
Windows
How did you build your project?
VS Code IDE
If you are using Windows, please specify command line type.
CMD
What is the expected behavior?
After following the instructions listed here: https://docs.espressif.com/projects/arduino-esp32/en/latest/esp-idf_component.html to build my code in Arduino as an esp-idf component, I quickly came to the realization that libraries such as OneWire.h and ESPAsyncWebServer.h were not supported in this framework so I went to GitHub, downloaded these libraries and added them under components/arduino/libraries. However, after doing so and trying to build my project again using idf.py build in the esp-idf terminal withing VSCode, the compilation terminated because it could not find the file or directory. I tried inserting the library in a different way inside my project by adding it as a git submodule but that resulted in the same error. I then tried adding the relative path in the #include statement using "../components/arduino/espasyncwebserver-master/espasyncwebserver.h" and the main.cpp folder compiled but the the actual .h had a bunch of unresolved include statements. Any idea on how to fix the issue?
What is the actual behavior?
Instead of building properly, the build fails because it cannot find the specified file or directory
Steps to reproduce.
...
Build or installation Logs.
More Information.
No response
The text was updated successfully, but these errors were encountered: