[KMSDRM] Enable full OpenGL detection (MESA/libglvnd) on both the make and cmake buildsystems.
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1d4b9f2..4fef447 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1197,6 +1197,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS)
# Need to check EGL before checking KMSDRM because KMSDRM depends on it.
CheckEGLKMSDRM()
CheckKMSDRM()
+ CheckOpenGLKMSDRM()
endif()
if(UNIX)
diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake
index 364cdb3..64089c6 100644
--- a/cmake/sdlchecks.cmake
+++ b/cmake/sdlchecks.cmake
@@ -778,6 +778,22 @@ macro(CheckVivante)
endmacro(CheckVivante)
# Requires:
+# - libglvnd
+macro(CheckOpenGLKMSDRM)
+ if(VIDEO_OPENGL AND HAVE_VIDEO_KMSDRM)
+ check_c_source_compiles("
+ #include <GL/gl.h>
+ int main(int argc, char** argv) {}" HAVE_VIDEO_OPENGL)
+
+ if(HAVE_VIDEO_OPENGL)
+ set(HAVE_VIDEO_OPENGL TRUE)
+ set(SDL_VIDEO_OPENGL 1)
+ set(SDL_VIDEO_RENDER_OGL 1)
+ endif()
+ endif()
+endmacro()
+
+# Requires:
# - nada
macro(CheckOpenGLX11)
if(VIDEO_OPENGL)
diff --git a/configure.ac b/configure.ac
index 30d17a1..4d0a980 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2384,6 +2384,27 @@ CheckOpenGLX11()
fi
}
+dnl Find KMSDRM OpenGL (GLVND)
+CheckOpenGLKMSDRM()
+{
+ if test x$enable_video = xyes -a x$enable_video_opengl = xyes -a x$enable_video_kmsdrm = xyes; then
+ AC_MSG_CHECKING(for OpenGL (GLVND) support)
+ video_opengl=no
+ AC_TRY_COMPILE([
+ #include <GL/gl.h>
+ ],[
+ ],[
+ video_opengl=yes
+ ])
+ AC_MSG_RESULT($video_opengl)
+ if test x$video_opengl = xyes; then
+ AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
+ AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
+ SUMMARY_video="${SUMMARY_video} opengl"
+ fi
+ fi
+}
+
dnl Check to see if OpenGL ES support is desired
AC_ARG_ENABLE(video-opengles,
[AS_HELP_STRING([--enable-video-opengles], [include OpenGL ES support [default=yes]])],
@@ -3656,6 +3677,7 @@ case "$host" in
# Need to check for EGL first because KMSDRM depends on it.
CheckEGLKMSDRM
CheckKMSDRM
+ CheckOpenGLKMSDRM
CheckOpenGLX11
CheckOpenGLESX11
CheckVulkan