Skip to content

+ improve CMake-based package config files. #246

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

Merged
merged 2 commits into from
Nov 11, 2021
Merged

+ improve CMake-based package config files. #246

merged 2 commits into from
Nov 11, 2021

Conversation

moodyhunter
Copy link
Contributor

@moodyhunter moodyhunter commented Jun 30, 2021

  • CMake package config files for uvw, they are now installed as ${LIBDIR}/cmake/uvw/uvwConfig.cmake with target files for appropriate configuration (e.g. debug, release, etc...).

  • A uvw::uvw ALIAS target is created for uvw static library, to make persistency with what is done to the header-only version,

Callers can now use find_package(uvw) and link with the uvw::uvw target to use uvw in their projects directly using CMake.

@skypjack
Copy link
Owner

@stefanofiorentino it looks good to me but could you review it too?
I'm far from being a cmake expert, so two extra eyes can help here. 😅

@stefanofiorentino
Copy link
Collaborator

stefanofiorentino commented Jun 30, 2021 via email

Copy link
Collaborator

@stefanofiorentino stefanofiorentino left a comment

Choose a reason for hiding this comment

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

Change request: I would spin-off the conan-related commit in an other PR.

I fully agree with the uvwConfig.cmake file installation along with the libs path.
As I cannot check all config/flags paths, I'm not 100% sure.
The CI/CD are green, though. ;) so I'll approve it once conan was stripped out or approved by @skypjack .

NOTE: the pkg-config related stuff was taken as is from libuv

@skypjack
Copy link
Owner

skypjack commented Jul 4, 2021

Change request: I would spin-off the conan-related commit in an other PR.

I'm fine with the request from @stefanofiorentino I don't have a strong opinion here, so I follow him. 🙂

Previously, uvw provides only a pkg-config .pc file, although a uvw.cmake presents,
it's not properly installed and placed in to a correct cmake `find_package` search path.

This leads to many problems, where in this commit, a `uvw::uvw` ALIAS target is created for uvw static library,

- if `BUILD_UVW_LIBS` is set, FETCH_LIBUV must be set as well (otherwise it'll not build, it's the current behavior).
- if `BUILD_UVW_LIBS` is NOT set:
    - when `FETCH_LIBUV` is set, it's guaranteed that uv::uv-static target exists, so a genex is removed.
    - when `FETCH_LIBUV` is NOT set, it's the caller's responsibility to make sure libuv can be properly linked

This commit also fixes CMake package config files for uvw, they are now installed as ${LIBDIR}/cmake/uvw/uvwConfig.cmake
with target files for appropriate configuration (e.g. debug, release, etc...).

Callers can now use `find_package(uvw)` and link with the `uvw::uvw` target to use uvw in their projects directly using CMake.
@moodyhunter
Copy link
Contributor Author

Hi all, I've just force pushed and removed that conanfile related commit from the git log, for now, it should be clean and only contains a single commit.

@moodyhunter moodyhunter changed the title + fixed a typo in conanfile.py and fixed CMake-based package config files. + improve CMake-based package config files. Jul 5, 2021
@stefanofiorentino
Copy link
Collaborator

@skypjack should we put this into an experimental branch and let us time to be tried by someone else?

@moodyhunter
Copy link
Contributor Author

moodyhunter commented Jul 28, 2021

I agree, I deleted my fork by accident :( , it'll be better if an experimental branch can be created, this also allows more people to test the changes.

@skypjack
Copy link
Owner

Makes sense. I would update uvw to wrap libuv v1.42 though, then we can create a branch from the last version.

@moodyhunter
Copy link
Contributor Author

It seems that a dl library is missing, (See https://github.com/moodyhunter/QvPersonal/runs/3201566023?check_suite_focus=true#step:8:273 and https://github.com/skypjack/uvw/blob/master/src/CMakeLists.txt#L80) however the fork is deleted and I can't update this PR.

@stefanofiorentino
Copy link
Collaborator

It seems that a dl library is missing, (See https://github.com/moodyhunter/QvPersonal/runs/3201566023?check_suite_focus=true#step:8:273 and https://github.com/skypjack/uvw/blob/master/src/CMakeLists.txt#L80) however the fork is deleted and I can't update this PR.

This dependency comes from libuv (and that's the only one IIRC), as they have API regarding the management of shared libraries.
Now, is it uvw responsibility to link under-the-hood to dl or is better to leave it to-do to the final linker?
That's a matter of taste and philosophy up-to-me.
So I guess @skypjack has to be invoked to the final decision: uvw users would link to dl implicitly or explicitly?

@skypjack
Copy link
Owner

I'd make users link it explicitly. dl isn't a direct dependency of uvw. Instead, it's a dependency of the underlying library.
As an user, I wouldn't feel comfortable with an indirect dependency pulled in by a third party library honestly.

@stefanofiorentino
Copy link
Collaborator

I'd make users link it explicitly. dl isn't a direct dependency of uvw. Instead, it's a dependency of the underlying library.
As an user, I wouldn't feel comfortable with an indirect dependency pulled in by a third party library honestly.

I like when the linker breaks and I discover hidden dependencies. I feel the developers are playing fair with me. So we agreed.

stefanofiorentino added a commit to stefanofiorentino/uvw that referenced this pull request Oct 19, 2021
Close skypjack#246

Signed-off-by: Fiorentino Ing. Stefano <[email protected]>
@stefanofiorentino
Copy link
Collaborator

Ciao, I've committed some more modifications to this PR here: experimental.
As already stated somewhere, this additions will encapsulate the right version of libuv in the uvw subfolder of system folders during installation. This avoid system folders pollution/overwriting.
I guess that's the best we can achieve up to now.
Do you agree?

@stefanofiorentino
Copy link
Collaborator

@moodyhunter could you please try this and see if it finally solve your issue?
https://github.com/skypjack/uvw/tree/experimental
Long story short: the installation phase of the dependent libuv is done in the uvw subfolder.

@moodyhunter
Copy link
Contributor Author

Yeah, it seems to be good, all header-only, shared and static libraries are properly installed now.

@skypjack
Copy link
Owner

skypjack commented Nov 3, 2021

@stefanofiorentino I would merge this upstream. Any objection?

@moodyhunter
Copy link
Contributor Author

No, I certainly agree.

@stefanofiorentino
Copy link
Collaborator

stefanofiorentino commented Nov 4, 2021

@stefanofiorentino I would merge this upstream. Any objection?

Let's proceed with this. I mean upstream is to me your repo as my origin is my fork.
Anyway I think we will get it to master too, right? That's ok to me.

@skypjack skypjack merged commit b388750 into skypjack:master Nov 11, 2021
skypjack pushed a commit that referenced this pull request Feb 1, 2022
Close #246

Signed-off-by: Fiorentino Ing. Stefano <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants