[Buildsystem] Only build KMSDRM support if EGL+OpenGL is detected by CMake.

This commit is contained in:
Manuel Alfayate Corchete 2020-12-22 17:17:30 +01:00
parent a19c008a7f
commit 13244de5c2
2 changed files with 22 additions and 1 deletions

View File

@ -1180,6 +1180,8 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS)
CheckOpenGLESX11() CheckOpenGLESX11()
CheckWayland() CheckWayland()
CheckVivante() CheckVivante()
# Need to check EGL before checking KMSDRM because KMSDRM depends on it.
CheckEGLKMSDRM()
CheckKMSDRM() CheckKMSDRM()
endif() endif()

View File

@ -757,6 +757,25 @@ macro(CheckOpenGLX11)
endif() endif()
endmacro() endmacro()
# Requires:
# - PkgCheckModules
macro(CheckEGLKMSDRM)
if (HAVE_VIDEO_OPENGLES OR HAVE_VIDEO_OPENGL)
pkg_check_modules(EGL egl)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${EGL_CFLAGS}")
check_c_source_compiles("
#define EGL_API_FB
#define MESA_EGL_NO_X11_HEADERS
#define EGL_NO_X11
#include <EGL/egl.h>
#include <EGL/eglext.h>
int main (int argc, char** argv) {}" HAVE_VIDEO_OPENGL_EGL)
if(HAVE_VIDEO_OPENGL_EGL)
set(SDL_VIDEO_OPENGL_EGL 1)
endif()
endif()
endmacro()
# Requires: # Requires:
# - PkgCheckModules # - PkgCheckModules
macro(CheckOpenGLESX11) macro(CheckOpenGLESX11)
@ -1152,7 +1171,7 @@ endmacro(CheckRPI)
macro(CheckKMSDRM) macro(CheckKMSDRM)
if(VIDEO_KMSDRM) if(VIDEO_KMSDRM)
pkg_check_modules(KMSDRM libdrm gbm egl) pkg_check_modules(KMSDRM libdrm gbm egl)
if(KMSDRM_FOUND) if(KMSDRM_FOUND AND HAVE_VIDEO_OPENGL_EGL)
link_directories( link_directories(
${KMSDRM_LIBRARY_DIRS} ${KMSDRM_LIBRARY_DIRS}
) )