Page 1 of 1
A guide on how to add a component into a project
Posted: Wed Jul 21, 2021 2:00 pm
by Amir_El
Hello everyone, i would like to include this LoRaWAN Component in my project
https://github.com/TobleMiner/lmic-esp-idf but I always get a compilation error. Could someone kindly, guide me to how to include the library (what modification I should do in the CMake file and where is the directory should be) or give me a link to a source that explain this.
Thank you
Re: A guide on how to add a component into a project
Posted: Thu Jul 22, 2021 1:59 am
by mbratch
Did you clone the library into the components subdirectory of your project?
What is your project structure?
What compile errors are you getting?
Re: A guide on how to add a component into a project
Posted: Thu Jul 22, 2021 3:10 pm
by Amir_El
Hi, thank you for your replay.....
I copy it into a folder that I created inside the "main" folder and add the line
Code: Select all
idf_component_register(SRCS
"main.c"
INCLUDE_DIRS
"."
"./Lib/LoRaWAN"
)
To the CMake file inside the main folder.
my project structure is like
Re: A guide on how to add a component into a project
Posted: Sun Aug 15, 2021 6:11 am
by fasani
Please read the
Build system documentation part specifically where it specifies what is the right directory structure:
https://docs.espressif.com/projects/esp ... le-project
Code: Select all
myProject/
- CMakeLists.txt
- sdkconfig
- components/ - component1/ - CMakeLists.txt
- Kconfig
- src1.c
- component2/ - CMakeLists.txt
- Kconfig
- src1.c
- include/ - component2.h
- main/ - CMakeLists.txt
- src1.c
- src2.c
- build/
Re: A guide on how to add a component into a project
Posted: Tue Aug 24, 2021 6:44 pm
by Amir_El
Thank you for sharing this. I modified the directories as it's shown but I'm still struggling to register the component.
This is My Top Level CMakeLists:
This is the inside main folder CMakeLists
This is the Inside the LoRaWAN component folder CmakeLists file
please help
Re: A guide on how to add a component into a project
Posted: Sat Sep 18, 2021 6:35 am
by fasani
First of all, I see you didn’t read the Build system like I recommended and just focused to solve the problem.
But sometimes you need to put the problem aside and read documentation in order to come with a proper solution.
Also the error is clearly indicating that the component is not found in that directory. I guess at this point so long after your post you should have solve this anyways. Best!