Hi All,
I have a few projects on the go and have created a number of functions that are common to them all. I am looking to create a common library for them and then use this library in my other projects. I have searched around but can't find any instructions on how to create the library and then how to add it into an ESP32 project. I am using the VSCode IDE and extension so how to do it in that would be ideal but can do it outside of it if needed.
Many thanks in advance
Lee.
Creating my own library
-
nopnop2002
- Posts: 347
- Joined: Thu Oct 03, 2019 10:52 pm
- Contact:
Re: Creating my own library
You can use EXTRA_COMPONENT_DIRS in CMakeLists.txt.
Here's an example.
https://github.com/nopnop2002/esp-idf-s ... sts.txt#L5
Here's an example.
https://github.com/nopnop2002/esp-idf-s ... sts.txt#L5
Re: Creating my own library
Thanks very much for getting back to me. I think this would include the component source and header files directly rather than create a binary that I could link into my project (e.g. a ".o" or ".a")? Is there a way of linking a pre-built binary or maybe this is how the ESP setup works?
Many thanks
Lee.
Many thanks
Lee.
-
nopnop2002
- Posts: 347
- Joined: Thu Oct 03, 2019 10:52 pm
- Contact:
-
MicroController
- Posts: 2661
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: Creating my own library
It most commonly is. One reason is that you often want the library/component to be configurable via Kconfig/menuconfig; another one is support for different SoCs, which a pre-built library may not be able to offer easily.or maybe this is how the ESP setup works?
Re: Creating my own library
Thanks for replying @MicroController. Very good points thanks very much.
Who is online
Users browsing this forum: PerplexityBot, Semrush [Bot] and 12 guests