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

cmake: link libOpenGL instead of legacy libGL #44

Merged
merged 1 commit into from
Aug 10, 2024
Merged

Conversation

ziyao233
Copy link
Contributor

From cmake documentation, Linux-specific chapter:

Projects may use the OpenGL::GL target (or OPENGL_LIBRARIES
variable) to use legacy GL interfaces. These will use the legacy GL
library located by OPENGL_gl_LIBRARY, if available. If
OPENGL_gl_LIBRARY is empty or not found and GLVND is available,
the OpenGL::GL target will use GLVND OpenGL::OpenGL and
OpenGL::GLX (and the OPENGL_LIBRARIES variable will use the
corresponding libraries). Thus, for non-EGL-based Linux targets, the
OpenGL::GL target is most portable.

which means linking with OpenGL::GL makes cmake find legacy libGL.so or GLX libraries, and as for now, the former contains GLX symbols and cannot be built without X libraries. Since we are working with EGL, it wouldn't provide extra portability, either.

This patch switches to link aquamarine with modern OpenGL::OpenGL, which contains core OpenGL API only, makes it possible to build on a wayland-only system. Tested on eweOS, which is a distro without X libraries.

Link: https://os.ewe.moe/

From cmake documentation, Linux-specific chapter:

  Projects may use the ``OpenGL::GL`` target (or ``OPENGL_LIBRARIES``
  variable) to use legacy GL interfaces.  These will use the legacy GL
  library located by ``OPENGL_gl_LIBRARY``, if available.  If
  ``OPENGL_gl_LIBRARY`` is empty or not found and GLVND is available,
  the ``OpenGL::GL`` target will use GLVND ``OpenGL::OpenGL`` and
  ``OpenGL::GLX`` (and the ``OPENGL_LIBRARIES`` variable will use the
  corresponding libraries).  Thus, for non-EGL-based Linux targets, the
  ``OpenGL::GL`` target is most portable.

which means linking with OpenGL::GL makes cmake find legacy libGL.so or
GLX libraries, and as for now, the former contains GLX symbols and cannot
be built without X libraries. Since we are working with EGL, it wouldn't
provide extra portability, either.

This patch switches to link aquamarine with modern OpenGL::OpenGL, which
contains core OpenGL API only, makes it possible to build on a
wayland-only system. Tested on eweOS, which is a distro without X
libraries.

Link: https://os.ewe.moe/
Signed-off-by: Yao Zi <ziyao@disroot.org>
Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

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

thanks!

@vaxerski vaxerski merged commit 9b33a38 into hyprwm:main Aug 10, 2024
1 check passed
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