logo elektroda
logo elektroda
X
logo elektroda

[Solved] [esp-idf] Adding a custom library from the project folder to CmakeLists.txt

NIXIE_123 1032 4
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 19442307
    NIXIE_123
    Level 34  
    Welcome

    I am able to add a library that is in the C:\esp-idf directory "led_strip.h" by adding the following entry to CmakeLists.txt:
    set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/led_strip)
    .
    then #include "led_strip.h" is seen in main.c and everything compiles

    How do I do the same, but with my own library which is in the project folder (eclipse workspace) and not in the C:³³³-idf directory?
    Doesn't work:
    -include itself (can't see)
    -adding the path as above leading to the project folder
  • ADVERTISEMENT
  • Helpful post
    #2 19442729
    khoam
    Level 42  
    Create a components/led_strip directory in your own project and add it to EXTRA_COMPONENT_DIRS. For example, in my case it is like this:
    Code: Bash
    Log in, to see the code
    In the components/idfp-core directory I have:

    CMakeLists.txt file
    Code: Bash
    Log in, to see the code
    Component.mk file
    Code: Bash
    Log in, to see the code
    .
  • ADVERTISEMENT
  • #3 19442977
    NIXIE_123
    Level 34  
    Thanks, this is exactly what I was looking for. Compilation successful. Esp-idf v4.2
  • ADVERTISEMENT
  • #4 19533898
    lechm56
    Moderator
    The topic has been unblocked at the request of the author.
  • #5 19534304
    NIXIE_123
    Level 34  
    Two words of conclusion.

    -Solution given by khoam
    You need to make a components folder inside a folder named libraries and in it CMakeLists.txt as below:
    [esp-idf] Adding a custom library from the project folder to CmakeLists.txt .

    -When we want to attach a component to a component, we have to add the following in CMakeLists.txt
    REQUIRES "nazwa_biblioteki"
    -When we want to attach a component to a component, we have to write in CMakeLists.txt.
    [esp-idf] Adding a custom library from the project folder to CmakeLists.txt .
ADVERTISEMENT