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

FreeType: improve library dependency handling, add example #320

Merged
merged 3 commits into from
Jun 7, 2024

Conversation

igrr
Copy link
Member

@igrr igrr commented Apr 19, 2024

  • Updated Zlib library to be compatible with CMake FindPackage module. Now, third party libraries which callfind_package(ZLIB) will find espressif/zlib component automatically, provided that it has been added as a dependency into the project.

    • We should do the same in other common components, as well.
    • Updated freetype component to have a dependency on zlib
    • Will do the above in another PR
  • Configured freetype to not look for Brotli, Harfbuzz, BZ2, libpng, zlib libraries in the system (espressif__freetype component doesn't build (IEC-101) #317)

  • Added a simple example to freetype component to validate its operation, added pytest script

@igrr
Copy link
Member Author

igrr commented Apr 22, 2024

@fhrbata May I ask you to take a look at this MR, especially the part in e90d4a7? If you think this is a good idea, I'll add find_package support for other common-enough libraries, like libpng.

set(ZLIB_FOUND 1 CACHE BOOL "")
set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/zlib CACHE PATH "")
get_filename_component(component_name ${CMAKE_CURRENT_LIST_DIR} NAME)
set(ZLIB_LIBRARY idf::${component_name} CACHE STRING "" FORCE)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @igrr ,

with my limited understanding it looks ok to me. Maybe few questions if you don't mind.

  1. Do we need to keep this in cache or is this intentional to prevent possible future override?
  2. The idf prefix seems hardcoded in esp-idf, so it should be fine. But I'm wondering if this can change. Meaning is it possible that the target/alias will have different prefix than idf?
  3. I guess that using e.g. ZLIBConfig.cmake and CMAKE_FIND_PACKAGE_REDIRECTS_DIR or other cmake's ways how to find a package(config/module mode) is not suitable for this use case and IIUC it would be probably unnecessary complicated.

Thank you

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fhrbata Sorry for missing your comment.

Do we need to keep this in cache or is this intentional to prevent possible future override?

I will check this again, I guess it didn't work for me without defining the variables as CACHE due to the (otherwise limited) variable scope.

The idf prefix seems hardcoded in esp-idf, so it should be fine. But I'm wondering if this can change. Meaning is it possible that the target/alias will have different prefix than idf?

This is a good point! I guess it would be unreasonable to change this prefix now, as many components were already written under the assumption that alias targets such as idf::component_name exist...

CMAKE_FIND_PACKAGE_REDIRECTS_DIR

I didn't try this. I will need more time to check if this works.

For now I have removed Zlib changes from this PR, leaving just the fix to FreeType dependencies configuration, and the addition of the new example.

I will open another PR for FindPackage support once I check the two points mentioned above.

@igrr igrr linked an issue May 20, 2024 that may be closed by this pull request
2 tasks
@igrr igrr force-pushed the feat/freetype_improvements branch from 4f9b34e to 16435e6 Compare May 21, 2024 21:13
@igrr igrr requested a review from suda-morris May 21, 2024 21:22
@igrr igrr marked this pull request as ready for review May 21, 2024 21:23
@igrr igrr linked an issue May 21, 2024 that may be closed by this pull request
2 tasks
@igrr
Copy link
Member Author

igrr commented May 22, 2024

@espressif2022 PTAL as well

@igrr
Copy link
Member Author

igrr commented May 28, 2024

cc @espzav

@igrr
Copy link
Member Author

igrr commented Jun 6, 2024

@espressif2022 @suda-morris Could you please help review?

Copy link
Collaborator

@espzav espzav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@igrr Nice example! Thank you (I am thinking that it can be used for example for BSP NOGLIB - for testing)
LGTM

@igrr igrr merged commit 46213e9 into espressif:master Jun 7, 2024
71 checks passed
@igrr igrr deleted the feat/freetype_improvements branch June 7, 2024 06:38
@igrr
Copy link
Member Author

igrr commented Jun 7, 2024

Thanks for the review @espzav!

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

Successfully merging this pull request may close these issues.

espressif__freetype component doesn't build (IEC-101)
3 participants