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

Use find_package to search for Corrosion #7797

Merged

Conversation

scristall-bennu
Copy link
Contributor

This PR adds a cmake module search for corrosion via find_package. This is to enable Nix which requires downloading of dependencies prior to build time.

I've also created a proof-of-concept fork of the stm32 C++ template which shows a nix derivation for Slint:

https://github.com/scristall-bennu/slint-cpp-templates-stm32-nix

Copy link
Member

@ogoffart ogoffart left a comment

Choose a reason for hiding this comment

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

Looks good to me. (although I'd prefer not having a log message in the "normal" case)

@tronical, what do you think?

FetchContent_MakeAvailable(Corrosion)
find_package(Corrosion QUIET)
if (NOT Corrosion_FOUND)
message("Corrosion could not be located in the CMake module search path. Downloading it from Git and building it locally")
Copy link
Member

Choose a reason for hiding this comment

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

I think it'd be better to leave that message out. What do you think?

@ogoffart ogoffart requested a review from tronical March 5, 2025 07:25
@tronical
Copy link
Member

tronical commented Mar 5, 2025

I agree. Patch looks good, but I think the majority of our users don't get corrosion separately and would find the message confusing.

One last aspect worth considering perhaps: perhaps find_package should be called with a version to ensure it's the same that we expect?

@scristall-bennu scristall-bennu force-pushed the scristall/corrosion-find-package branch from b39495a to 0b9c154 Compare March 5, 2025 17:43
@scristall-bennu
Copy link
Contributor Author

scristall-bennu commented Mar 5, 2025

Thanks for the notes!

I removed the message and added a version to find_package.

Note that I had to use 0.5 instead of 0.5.1 for the version because I think I uncovered a bug in the Corrosion release through this: the version in CorrosionConfigVersion.cmake is 0.5.0 for the v0.5.1 tag. This means, find_package(Corrosion 0.5.1) will fail to find it. FetchContent circumvents this by grabbing via the tag.

@ogoffart ogoffart merged commit be59032 into slint-ui:master Mar 5, 2025
38 checks passed
@ogoffart
Copy link
Member

ogoffart commented Mar 5, 2025

Thanks!

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.

3 participants