lvgl icon indicating copy to clipboard operation
lvgl copied to clipboard

cmake: Add missing "REQUIRES main" for ESP-IDF

Open huming2207 opened this issue 3 years ago • 10 comments

Description of the feature or fix

Hi there,

I realised that it may be necessary to add REQUIRES main in idf_component_register() in env_support/cmake/esp.cmake. Otherwise if I need to use any external libraries such as freetype2, the LVGL adapters like lv_freetype.c will complain about missing headers.

For example, I have a project that needs FreeType2, and I wrote a interface library (see here: https://github.com/huming2207/esp-ft2). I make it as a Git submodule and clone it into components directory of my ESP-IDF project. Meanwhile I also have a LVGL copy as a submodule in the components directory together. Now, if I enable the LV_USE_FREETYPE and start playing with the FreeType stuff, the compiler will complain something like this:

../components/lvgl/src/extra/libs/freetype/lv_freetype.c:12:10: fatal error: ft2build.h: No such file or directory

Even if I get the main/CMakeLists.txt to REQUIRE both lvgl and freetype, when compiling, the compiler will still complain the same error.

That is due to the LVGL component doesn't know the existence of my FreeType component. So we need to let lvgl component to know the existence of the project's main component, and since main component knows freetype, then lvgl component also knows the freetype.

Regards, Jackson

Checkpoints

  • [x] Follow the styling guide
  • [x] Run code-format.py from the scripts folder. astyle needs to be installed.
  • [x] Update the documentation

huming2207 avatar Mar 31 '22 03:03 huming2207

Hmm... we originally did not specify REQUIRES main because of https://github.com/lvgl/lvgl/issues/2403. I think merging this would cause that issue to regress.

embeddedt avatar Mar 31 '22 12:03 embeddedt

Hmm... we originally did not specify REQUIRES main because of https://github.com/lvgl/lvgl/issues/2403. I think merging this would cause that issue to regress.

Okay... what about PRIV_REQUIRES? I'll have a try tomorrow.

huming2207 avatar Mar 31 '22 12:03 huming2207

@embeddedt PRIV_REQUIRES works for me.

Meanwhile if say both PRIV_REQUIRES or REQUIRES are both not doable, then what should I do to include the freetype dependency anyway? Maybe add freetype to main component? But then I guess LVGL still won't know the existence of the freetype...

huming2207 avatar Mar 31 '22 22:03 huming2207

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days.

lvgl-bot avatar Apr 15 '22 02:04 lvgl-bot

We need some feedback on this issue.

Now we mark this as "stale" because there was no activity here for 14 days.

Remove the "stale" label or comment else this will be closed in 7 days.

lvgl-bot avatar May 04 '22 02:05 lvgl-bot

@C47D Could you take a look at this when you have some time?

embeddedt avatar May 04 '22 12:05 embeddedt

Hi, yes I will take a look at it.

C47D avatar May 05 '22 21:05 C47D

We need some feedback on this issue.

Now we mark this as "stale" because there was no activity here for 14 days.

Remove the "stale" label or comment else this will be closed in 7 days.

lvgl-bot avatar Jun 03 '22 02:06 lvgl-bot

Not stale.

embeddedt avatar Jun 10 '22 11:06 embeddedt

We need some feedback on this issue.

Now we mark this as "stale" because there was no activity here for 14 days.

Remove the "stale" label or comment else this will be closed in 7 days.

lvgl-bot avatar Jul 08 '22 02:07 lvgl-bot

We need some feedback on this pull request.

Now we mark this as "stale" because there was no activity here for 14 days.

Remove the "stale" label or comment else this will be closed in 7 days.

lvgl-bot avatar Sep 01 '22 02:09 lvgl-bot