Skip to content
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

Easier setup for PlatformIO for ESP-IDF using idf_component.yml #596

Closed
nicklasb opened this issue Nov 5, 2023 · 11 comments
Closed

Easier setup for PlatformIO for ESP-IDF using idf_component.yml #596

nicklasb opened this issue Nov 5, 2023 · 11 comments

Comments

@nicklasb
Copy link

nicklasb commented Nov 5, 2023

Hi,

So I have been a bit annoyed by how complex this library is to use in PlatformIO and ESP-IDF, as mentioned here it is quite the chore to get it building. So first, I went another way and cobbled the files together using CMake instead (my env is ESP32cam and it is a esp32 target):

FILE(GLOB_RECURSE app_sources ${CMAKE_SOURCE_DIR}/examples/*.*)
FILE(GLOB espcam_sources ${CMAKE_SOURCE_DIR}/.pio/libdeps/ESP32cam/esp32-camera/target/*.*)
FILE(GLOB_RECURSE espcam_sources_esp32 ${CMAKE_SOURCE_DIR}/.pio/libdeps/ESP32cam/esp32-camera/target/esp32/*.*)

idf_component_register(
    SRCS ${app_sources} ${espcam_sources} ${espcam_sources_esp32}
    INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/.pio/libdeps/ESP32cam/esp32-camera/target/jpeg_include 
        ${CMAKE_SOURCE_DIR}/.pio/libdeps/ESP32cam/esp32-camera/target/private_include
)

I certainly did not like that solution, as it is just everything else than portable.

Instead, the easiest way for me was to be add an idf_component.yml-file and add esp32-camera as a simple dependency:

version: "0.1.0"
description: "Testing esp32-camera"
dependencies:
  # Required IDF version
  idf: ">=4.1"
  esp32-camera:
    git: https://github.com/espressif/esp32-camera

and a

 REQUIRES esp32-cam

..to the CMakeLists.txt and it works? (or at least it builds)

So wouldn't the idf_component.yml path be much easier, or at least deserved to be mentioned, for most PlatformIO ESP-IDF users?

@me-no-dev
Copy link
Member

We do not control what and how is installed using PIO. What you ask about is documented for ESP-IDF. The component is standard structure and has no issues being used in ESP-IDF projects otherwise.

@nicklasb
Copy link
Author

nicklasb commented Nov 9, 2023

We do not control what and how is installed using PIO. What you ask about is documented for ESP-IDF. The component is standard structure and has no issues being used in ESP-IDF projects otherwise.

I am merely suggesting that there are two more ways of using the component with the ESP-IDF platform in PlatformIO.
And that the latter is not only easier than the one suggested in your documentation, but less "wonky", as you put it, and more aligned with the ESP-IDF component model as it uses the idf_component.yml path.
Obviously, you don't have to agree. I am just trying to help out, as people, and myself, have had issues.

@me-no-dev
Copy link
Member

I am a bit confused. Which documentation are you quoting? You opted to use the package manager, which is the default documented way going forward. Did you find some instructions elsewhere?

@nicklasb
Copy link
Author

nicklasb commented Nov 9, 2023

I am a bit confused. Which documentation are you quoting? You opted to use the package manager, which is the default documented way going forward. Did you find some instructions elsewhere?

The installation instructions on the repo first page (and below):
https://github.com/espressif/esp32-camera#platformio-libsubmodule-for-frameworkespidf

As according in the documentation above it, the package manager method only work with the Arduino platform.

@igrr
Copy link
Member

igrr commented Nov 9, 2023

Just my 2c: since

dependencies:
  espressif/esp32-camera: "^2.0.5"

works in IDF build system (whether you invoke CMake from idf.py or from PlatformIO), it might be the easiest option to document that as a single installation method at this point?

There is a fair amount of text in the installation section of the project readme now, mentioning also submodules as an installation method. We could simplify this all to a fairly brief set of instructions based on idf_component.yml.

@nicklasb
Copy link
Author

nicklasb commented Nov 9, 2023

Just my 2c: since

dependencies:
  espressif/esp32-camera: "^2.0.5"

works in IDF build system (whether you invoke CMake from idf.py or from PlatformIO), it might be the easiest option to document that as a single installation method at this point?

There is a fair amount of text in the installation section of the project readme now, mentioning also submodules as an installation method. We could simplify this all to a fairly brief set of instructions based on idf_component.yml.

That would be even better of course, just pointed to master since the documentation did that for ESP-IDF.

@igrr
Copy link
Member

igrr commented Nov 9, 2023

Have opened #597. @nicklasb Could you please sanity-check what I wrote from a perspective of a PlatformIO user?

igrr added a commit that referenced this issue Nov 9, 2023
igrr added a commit that referenced this issue Nov 9, 2023
igrr added a commit that referenced this issue Nov 9, 2023
@nicklasb
Copy link
Author

nicklasb commented Nov 9, 2023

Have opened #597. @nicklasb Could you please sanity-check what I wrote from a perspective of a PlatformIO user?

Tested using the dependency. Worked.
I would make PlatformIO bold or something, it is easy to miss that alternative in the text.

Thanks!

me-no-dev pushed a commit that referenced this issue Nov 9, 2023
* maint(build): remove legacy GNU Make build system support

* maint(example): move the example so that component manager finds it

* maint(example): specify component dependency

* maint(build): clean up legacy 'register_component' usage

* maint(build): specify more fields in component manifest

* doc(readme): simplify installation instructions

See #596

* maint(ci): remove tests for EOL versions (v4.1, v4.2)

* fix(build): add missing transitive dependency on driver component
@juliankrieger
Copy link

@nicklasb I am currently struggling with the same problem - just for a quick reference, using idf_component.yml and adding REQUIRES for my dependency in CMakeLists.txt -- for example for the main component -- in idf_component_register should just work?

@nicklasb
Copy link
Author

Yes, worked with having this dependency, haven't build it for a while but should still work. Not sure if you have to REQUIRE if it is in the idf_component.yml, actually. Note that you cannot have really old versions of ESP-IDF.

What is your problem?

@juliankrieger
Copy link

No problem here, I was just wondering since the documentation mentions both ways, but I didn't see any mention of having to use "REQUIRES" for esp internal dependencies and idf_components.yml for external dependencies from the component library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants