summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorSam Lantinga <slouken@libsdl.org>2017-08-02 10:22:48 -0700
committerSam Lantinga <slouken@libsdl.org>2017-08-02 10:22:48 -0700
commitdaff55ad6e7ea39f7d8b91a574116eef338ce1eb (patch)
tree6f0a38391fdfb4ffdd837e5a882d39d36f9103a9 /cmake
parentb21c2dded7cfd05a8ca9e6e93fec7e86b63746a9 (diff)
downloadsdl-daff55ad6e7ea39f7d8b91a574116eef338ce1eb.tar.gz
Fixed bug 3690 - SDL2 KMS/DRM render context support
Manuel The attached patch adds support for KMS/DRM context graphics. It builds with no problem on X86_64 GNU/Linux systems, provided the needed libraries are present, and on ARM GNU/Linux systems that have KMS/DRM support and a GLES2 implementation. Tested on Raspberry Pi: KMS/DRM is what the Raspberry Pi will use as default in the near future, once the propietary DispmanX API by Broadcom is overtaken by open graphics stack, it's possible to boot current Raspbian system in KMS mode by adding "dtoverlay=vc4-kms-v3d" to config.txt on Raspbian's boot partition. X86 systems use KMS right away in every current GNU/Linux system. Simple build instructions: $./autogen.sh $./configure --enable-video-kmsdrm $make
Diffstat (limited to 'cmake')
-rw-r--r--cmake/sdlchecks.cmake43
1 files changed, 43 insertions, 0 deletions
diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake
index 770378828..6f6a41f90 100644
--- a/cmake/sdlchecks.cmake
+++ b/cmake/sdlchecks.cmake
@@ -1149,3 +1149,46 @@ macro(CheckRPI)
endif(SDL_VIDEO AND HAVE_VIDEO_RPI)
endif(VIDEO_RPI)
endmacro(CheckRPI)
+
+# Requires:
+# - EGL
+# - PkgCheckModules
+# Optional:
+# - KMSDRM_SHARED opt
+# - HAVE_DLOPEN opt
+macro(CheckKMSDRM)
+ if(VIDEO_KMSDRM)
+ pkg_check_modules(KMSDRM libdrm gbm egl)
+ if(KMSDRM_FOUND)
+ link_directories(
+ ${KMSDRM_LIBRARY_DIRS}
+ )
+ include_directories(
+ ${KMSDRM_INCLUDE_DIRS}
+ )
+ set(HAVE_VIDEO_KMSDRM TRUE)
+ set(HAVE_SDL_VIDEO TRUE)
+
+ file(GLOB KMSDRM_SOURCES ${SDL2_SOURCE_DIR}/src/video/kmsdrm/*.c)
+ set(SOURCE_FILES ${SOURCE_FILES} ${KMSDRM_SOURCES})
+
+ list(APPEND EXTRA_CFLAGS ${KMSDRM_CLFLAGS})
+
+ set(SDL_VIDEO_DRIVER_KMSDRM 1)
+
+ if(KMSDRM_SHARED)
+ if(NOT HAVE_DLOPEN)
+ message_warn("You must have SDL_LoadObject() support for dynamic KMS/DRM loading")
+ else()
+ FindLibraryAndSONAME(drm)
+ FindLibraryAndSONAME(gbm)
+ set(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC "\"${DRM_LIB_SONAME}\"")
+ set(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM "\"${GBM_LIB_SONAME}\"")
+ set(HAVE_KMSDRM_SHARED TRUE)
+ endif()
+ else()
+ set(EXTRA_LIBS ${KMSDRM_LIBRARIES} ${EXTRA_LIBS})
+ endif()
+ endif()
+ endif()
+endmacro()