Skip to content

Add CMake Config#1242

Merged
davidgyu merged 4 commits intoPixarAnimationStudios:devfrom
theblackunknown:cmake-config
Sep 15, 2022
Merged

Add CMake Config#1242
davidgyu merged 4 commits intoPixarAnimationStudios:devfrom
theblackunknown:cmake-config

Conversation

@theblackunknown
Copy link
Copy Markdown
Contributor

@theblackunknown theblackunknown commented Apr 27, 2022

Description

This PR adds a CMake Config to OpenSubdiv and expose preprocessor macros for OpenSubdiv enabled features for clients to depend on them.
This allow for a more robust and consistent way to pull OpenSubdiv as a dependency in other projects through CMake find_package calls.
Moreover, this enhance the experience when using package manager such as microsoft/vcpkg and alikes.

@theblackunknown theblackunknown force-pushed the cmake-config branch 2 times, most recently from c5dd789 to 195d216 Compare April 27, 2022 17:20
@theblackunknown
Copy link
Copy Markdown
Contributor Author

Note that as the minimum required version is 2.8 I have to do some detection.
It would be nice to bump this requirement up to avoid this extra complexity if possible.

@thomthom
Copy link
Copy Markdown
Contributor

Ah, nice. I have an open issue in the vcpkg regarding this: microsoft/vcpkg#20932

Does this PR provide a config that allows to choose what features to use? The vcpkg package had to patch the OSD project to handle this: microsoft/vcpkg#20871

@theblackunknown
Copy link
Copy Markdown
Contributor Author

Does this PR provide a config that allows to choose what features to use? The vcpkg package had to patch the OSD project to handle this: microsoft/vcpkg#20871

It seems that Jack already took care of most of the features in microsoft/vcpkg#20895, is this what you are looking for ?

Regarding OpenSubdiv vcpkg port, I plan to improve it with what is not yet supported (e.g. OpengGL backend) later after this PR.

@theblackunknown
Copy link
Copy Markdown
Contributor Author

Ah, nice. I have an open issue in the vcpkg regarding this: microsoft/vcpkg#20932

I was not aware of your issue but I feel this we aim for the same goal :)

@theblackunknown
Copy link
Copy Markdown
Contributor Author

Hey @thomthom , I am working on microsoft/vcpkg#24467 which offers a CMake config in the current vcpkg port while we wait for this PR to move forward.

@davidgyu
Copy link
Copy Markdown
Member

Hi, would you submit a CLA Thanks!

@theblackunknown
Copy link
Copy Markdown
Contributor Author

Hi, would you submit a CLA Thanks!

@davidgyu thanks for the link I did not notice this page before !
Let me run some double check, and then I'll sign it asap

@theblackunknown
Copy link
Copy Markdown
Contributor Author

Hi, would you submit a CLA Thanks!

@davidgyu I have just signed and sent my CLA, let me know when this is good to move forward with this PR


endif()

# Expose preprocessor macro to the interface so that client know which feature are enabled
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This portion is useful so that client consuming this any OpenSubdiv library can introspect which feature are enabled directly on the exported CMake targets.

For example, USD would benefit from this as they are checking if header exists and recompute those exact preprocessor macros because they are not exported
cf. https://github.com/PixarAnimationStudios/USD/blob/3b097e3ba8fabf1777a1256e241ea15df83f3065/cmake/modules/FindOpenSubdiv.cmake#L110-L117

@theblackunknown
Copy link
Copy Markdown
Contributor Author

@davidgyu is there anything new on this PR ?
I am happy to discuss/improve it if need be, otherwise let me know if this is good to merge

@theblackunknown
Copy link
Copy Markdown
Contributor Author

Gently bumping this PR for any news @davidgyu ?

@davidgyu
Copy link
Copy Markdown
Member

davidgyu commented Jul 8, 2022

Filed as internal issue #OSD-382

@davidgyu
Copy link
Copy Markdown
Member

davidgyu commented Aug 1, 2022

We have a few changes that we're going to be merging ahead of this PR and there may be some additional work (hopefully minor) that will be needed for this PR. We'll post additional notes here when the necessary changes are clear. Thanks!

@theblackunknown
Copy link
Copy Markdown
Contributor Author

Thanks for the news David, I'll wait for your changes and adapt my PR when they arrived.

@davidgyu
Copy link
Copy Markdown
Member

davidgyu commented Sep 9, 2022

This can be simplified since many of these are not primary artifacts and shouldn't be exported as config targets.

Specifically, we should remove the changes in the examples, regression, tutorials, and opensubdiv/tools/stringify CMakeLists.txt files.

Thanks!

@thomthom
Copy link
Copy Markdown
Contributor

thomthom commented Sep 9, 2022

And there is a PR open to bump minimum CMake version, which sounds like it would aid in simplifying this PR.

Downstream projects should not depend on these.
davidgyu added a commit to davidgyu/OpenSubdiv that referenced this pull request Sep 15, 2022
The cmake config export paths are now more consistent
with other vfx platform projects.

The target names are now more consistent with existing
opensubdiv static and dynamic library names.
@davidgyu
Copy link
Copy Markdown
Member

I've pushed some commits to remove the non-primary export targets and to update the config and target names to be more consistent with other packages in the vfx platform.

@davidgyu
Copy link
Copy Markdown
Member

Thank you @theblackunknown this is great to have!

@davidgyu davidgyu merged commit 287cb80 into PixarAnimationStudios:dev Sep 15, 2022
@theblackunknown
Copy link
Copy Markdown
Contributor Author

This is great !
Thank you @davidgyu for tackling the last bits and your patience !

@theblackunknown
Copy link
Copy Markdown
Contributor Author

And there is a PR open to bump minimum CMake version, which sounds like it would aid in simplifying this PR.

I would love too as well, but I think it depends on the minimum CMake version Pixar - and anyone else consuming OpenSubdiv - requires which does not seems to be that recent ?

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