cmake/sdlchecks.cmake
changeset 11175 cbc6a8a5b701
parent 11139 4c165b1a0596
child 11207 4ed2e42b7497
equal deleted inserted replaced
11174:3767cdd2d64b 11175:cbc6a8a5b701
  1147       list(APPEND EXTRA_LIBS ${VIDEO_RPI_LIBS})
  1147       list(APPEND EXTRA_LIBS ${VIDEO_RPI_LIBS})
  1148       set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}")
  1148       set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}")
  1149     endif(SDL_VIDEO AND HAVE_VIDEO_RPI)
  1149     endif(SDL_VIDEO AND HAVE_VIDEO_RPI)
  1150   endif(VIDEO_RPI)
  1150   endif(VIDEO_RPI)
  1151 endmacro(CheckRPI)
  1151 endmacro(CheckRPI)
       
  1152 
       
  1153 # Requires:
       
  1154 # - EGL
       
  1155 # - PkgCheckModules
       
  1156 # Optional:
       
  1157 # - KMSDRM_SHARED opt
       
  1158 # - HAVE_DLOPEN opt
       
  1159 macro(CheckKMSDRM)
       
  1160   if(VIDEO_KMSDRM)
       
  1161     pkg_check_modules(KMSDRM libdrm gbm egl)
       
  1162     if(KMSDRM_FOUND)
       
  1163       link_directories(
       
  1164         ${KMSDRM_LIBRARY_DIRS}
       
  1165       )
       
  1166       include_directories(
       
  1167         ${KMSDRM_INCLUDE_DIRS}
       
  1168       )
       
  1169       set(HAVE_VIDEO_KMSDRM TRUE)
       
  1170       set(HAVE_SDL_VIDEO TRUE)
       
  1171 
       
  1172       file(GLOB KMSDRM_SOURCES ${SDL2_SOURCE_DIR}/src/video/kmsdrm/*.c)
       
  1173       set(SOURCE_FILES ${SOURCE_FILES} ${KMSDRM_SOURCES})
       
  1174 
       
  1175       list(APPEND EXTRA_CFLAGS ${KMSDRM_CLFLAGS})
       
  1176 
       
  1177       set(SDL_VIDEO_DRIVER_KMSDRM 1)
       
  1178 
       
  1179       if(KMSDRM_SHARED)
       
  1180         if(NOT HAVE_DLOPEN)
       
  1181           message_warn("You must have SDL_LoadObject() support for dynamic KMS/DRM loading")
       
  1182         else()
       
  1183           FindLibraryAndSONAME(drm)
       
  1184           FindLibraryAndSONAME(gbm)
       
  1185           set(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC "\"${DRM_LIB_SONAME}\"")
       
  1186           set(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM "\"${GBM_LIB_SONAME}\"")
       
  1187           set(HAVE_KMSDRM_SHARED TRUE)
       
  1188         endif()
       
  1189       else()
       
  1190         set(EXTRA_LIBS ${KMSDRM_LIBRARIES} ${EXTRA_LIBS})
       
  1191       endif()
       
  1192     endif()
       
  1193   endif()
       
  1194 endmacro()