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

Link to the OpenGL::GL target instead of OPENGL_LIBRARIES #1603

Merged

Conversation

pmolodo
Copy link
Contributor

@pmolodo pmolodo commented Nov 22, 2023

This prevents absolute paths from creeping into the output MaterialXConfig.cmake, which makes it not portable.

Also, in general in modern CMake, targets are preferred over baked paths. Additionally, at least on Linux,
${OPENGL_LIBRARIES} includes libGLU, which is not actually a required dependency

@pmolodo pmolodo force-pushed the pr/cmake-GL-abs-path branch 3 times, most recently from b1648f1 to c110ef3 Compare November 23, 2023 00:43
@pmolodo
Copy link
Contributor Author

pmolodo commented Nov 23, 2023

Fixed an issue with requiring OpenGL on iOS builds. Refactored the way COMMON_LIBRARIES was used to make the iOS library changes clearer / grouped with other target_link_library statements

The point of COMMON_LIBRARIES was apparently to allow all library
linking to be done with a single command; however, continuing this
paradigm becomes difficult as more complex conditions are built up -
for instance, in MaterialXRenderMsl/CMakeLists.txt, we were altering
COMMON_LIBRARIES if APPLE and NOT iOS... which, at best, made the name
COMMON_LIBRARIES unclear.

Refactored to simply make multiple calls to target_link_libraries, which
is the way most other CMakeLists.txt in this repo handle this.
This prevents absolute paths from creeping into the output
MaterialXConfig.cmake, which makes it not portable.

Also, in general in modern CMake, targets are preferred over baked
paths.  Plus, at least on Linux, ${OPENGL_LIBRARIES} includes libGLU,
which is not actually a required dependency
@jstone-lucasfilm
Copy link
Member

This looks like a good proposal, @pmolodo, and the one caveat is that we'll need to raise our minimum required version of CMake, which is currently set to 3.5:

https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/CMakeLists.txt#L8

We've been interested in raising this minimum version for quite a while, and one option would be to align with OpenImageIO and raise the minimum version of CMake to 3.15:

https://github.com/AcademySoftwareFoundation/OpenImageIO/blob/master/CMakeLists.txt#L5

Let's bring this up as a topic in the MaterialX channel of the ASWF Slack, so that we can gather consensus on what minimum version we should align with.

@jstone-lucasfilm
Copy link
Member

Following up on a discussion on the MaterialX channel of the ASWF Slack, we've raised the minimum CMake version to 3.16:

#1607

@jstone-lucasfilm jstone-lucasfilm changed the title Link to the OpenGL::GL target, instead of ${OPENGL_LIBRARIES} Link to the OpenGL::GL target instead of OPENGL_LIBRARIES Nov 28, 2023
Copy link
Member

@jstone-lucasfilm jstone-lucasfilm left a comment

Choose a reason for hiding this comment

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

This looks good to me, thanks @pmolodo!

@jstone-lucasfilm jstone-lucasfilm merged commit b50dea8 into AcademySoftwareFoundation:main Nov 28, 2023
31 checks passed
@pmolodo
Copy link
Contributor Author

pmolodo commented Nov 29, 2023

Great, 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.

2 participants