summaryrefslogtreecommitdiff
path: root/dev-qt/qtbase/files/qtbase-6.5.2-no-glx.patch
blob: f8263d10c022c656380cdb374dbe5d4148a0d97c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Fixes build with libglvnd[-X].

https://github.com/qt/qtbase/commit/929d9a4ca5c9eb0a590479182471d0bbc81589aa
From: Yaroslav Isakov <yaroslav.isakov@gmail.com>
Date: Sat, 8 Jul 2023 22:09:40 +0200
Subject: [PATCH] Allow OpenGL to be found on X11-less Linux systems (using
 libOpenGL)

Cmake supports finding OpenGL, even if there is no GLX (for glvnd) or
old-style libGL. This change keeps old behavior, but in case, if
X11-related OpenGL libraries cannot be found on Linux, it adds logic
to check for (and link with) libOpenGL, if it is present.
--- a/cmake/FindWrapOpenGL.cmake
+++ b/cmake/FindWrapOpenGL.cmake
@@ -47,4 +47,14 @@
         target_link_libraries(WrapOpenGL::WrapOpenGL INTERFACE OpenGL::GL)
     endif()
+elseif(UNIX AND NOT APPLE AND NOT CMAKE_SYSTEM_NAME STREQUAL "Integrity")
+    # Requesting only the OpenGL component ensures CMake does not mark the package as
+    # not found if neither GLX nor libGL are available. This allows finding OpenGL
+    # on an X11-less Linux system.
+    find_package(OpenGL ${WrapOpenGL_FIND_VERSION} COMPONENTS OpenGL)
+    if (OpenGL_FOUND)
+        set(WrapOpenGL_FOUND ON)
+        add_library(WrapOpenGL::WrapOpenGL INTERFACE IMPORTED)
+        target_link_libraries(WrapOpenGL::WrapOpenGL INTERFACE OpenGL::OpenGL)
+    endif()
 endif()