-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Add OpenGL::GL cmake imported targets #23705
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
Conversation
Added OpenGL::GL and OpenGL::GLU to FindOpenGL.cmake following CMake's own FindOpenGL.cmake
Can we test this? Perhaps by adding to the existing |
@sbc100 I added a few lines to validate the |
include_directories(${OPENAL_INCLUDE_DIR}) | ||
target_link_libraries(test_prog ${OPENAL_LIBRARY}) | ||
message(" test: OPENGL_LIBRARIES: ${OPENAL_LIBRARIES}") | ||
message(" test: OPENAL_LIBRARIES: ${OPENAL_LIBRARIES}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use STATUS
here too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't add STATUS
to pre-existing messages because I thought perhaps the outputting to stderr was intentional (adding STATUS
directs it to stdout), but I can certainly do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should be consistent within this file. i don't think anything else is reading the stdout or std of the cmake process.
message(" test: SDL2_LIBRARIES: ${SDL2_LIBRARIES}") | ||
message(" test: SDL2_INCLUDE_DIRS: ${SDL2_INCLUDE_DIRS}") | ||
|
||
get_target_property(lib OpenGL::GL IMPORTED_LIBNAME) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this creating a new lib
variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, although an admittedly lazy naming choice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Should we check INTERFACE_LINK_LIBRARIES too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm % comments
This doesn't seem to work on Windows: Oddy I tried it locally I got a different error:
Any ideas from either of those? |
I think you need to make sure sdl2 is built before you can run that test. We should probably add an embuilder command in there to fix that. |
Fixes a bug introduced in emscripten-core#23705.
Fixes a bug introduced in emscripten-core#23705.
Fixes a bug introduced in #23705.
This allows projects to include OpenGL like so
Link to CMake's documentation: https://cmake.org/cmake/help/latest/module/FindOpenGL.html#imported-targets
CMake's
FindOpenGL.cmake
also produces GLES-related imported targets. While I think they would be nice to add, I've omitted them as I don't know if it would be as simple as duplicating theOpenGL::GL
target or more needs to be to communicate that choice of flavor to emscripten.