cmake/sdlchecks.cmake
changeset 11829 fcbafc9e443c
parent 11367 e8fc755a89e8
child 11847 4249379583bc
equal deleted inserted replaced
11828:da1ca77eb713 11829:fcbafc9e443c
  1125 
  1125 
  1126 # Requires:
  1126 # Requires:
  1127 # - n/a
  1127 # - n/a
  1128 macro(CheckRPI)
  1128 macro(CheckRPI)
  1129   if(VIDEO_RPI)
  1129   if(VIDEO_RPI)
  1130     set(VIDEO_RPI_INCLUDE_DIRS "/opt/vc/include" "/opt/vc/include/interface/vcos/pthreads" "/opt/vc/include/interface/vmcs_host/linux/" )
  1130     pkg_check_modules(VIDEO_RPI bcm_host brcmegl)
  1131     set(VIDEO_RPI_LIBRARY_DIRS "/opt/vc/lib" )
  1131     if (NOT VIDEO_RPI_FOUND)
  1132     set(VIDEO_RPI_LIBS bcm_host )
  1132       set(VIDEO_RPI_INCLUDE_DIRS "/opt/vc/include" "/opt/vc/include/interface/vcos/pthreads" "/opt/vc/include/interface/vmcs_host/linux/" )
       
  1133       set(VIDEO_RPI_LIBRARY_DIRS "/opt/vc/lib" )
       
  1134       set(VIDEO_RPI_LIBRARIES bcm_host )
       
  1135     endif()
  1133     listtostr(VIDEO_RPI_INCLUDE_DIRS VIDEO_RPI_INCLUDE_FLAGS "-I")
  1136     listtostr(VIDEO_RPI_INCLUDE_DIRS VIDEO_RPI_INCLUDE_FLAGS "-I")
  1134     listtostr(VIDEO_RPI_LIBRARY_DIRS VIDEO_RPI_LIBRARY_FLAGS "-L")
  1137     listtostr(VIDEO_RPI_LIBRARY_DIRS VIDEO_RPI_LIBRARY_FLAGS "-L")
  1135 
  1138 
  1136     set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
  1139     set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
  1137     set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}")
  1140     set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}")
  1138     set(CMAKE_REQUIRED_LIBRARIES "${VIDEO_RPI_LIBS}")
  1141     set(CMAKE_REQUIRED_LIBRARIES "${VIDEO_RPI_LIBRARIES}")
  1139     check_c_source_compiles("
  1142     check_c_source_compiles("
  1140         #include <bcm_host.h>
  1143         #include <bcm_host.h>
  1141         int main(int argc, char **argv) {}" HAVE_VIDEO_RPI)
  1144         int main(int argc, char **argv) {}" HAVE_VIDEO_RPI)
  1142     set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}")
  1145     set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}")
  1143     set(CMAKE_REQUIRED_LIBRARIES)
  1146     set(CMAKE_REQUIRED_LIBRARIES)
  1145     if(SDL_VIDEO AND HAVE_VIDEO_RPI)
  1148     if(SDL_VIDEO AND HAVE_VIDEO_RPI)
  1146       set(HAVE_SDL_VIDEO TRUE)
  1149       set(HAVE_SDL_VIDEO TRUE)
  1147       set(SDL_VIDEO_DRIVER_RPI 1)
  1150       set(SDL_VIDEO_DRIVER_RPI 1)
  1148       file(GLOB VIDEO_RPI_SOURCES ${SDL2_SOURCE_DIR}/src/video/raspberry/*.c)
  1151       file(GLOB VIDEO_RPI_SOURCES ${SDL2_SOURCE_DIR}/src/video/raspberry/*.c)
  1149       set(SOURCE_FILES ${SOURCE_FILES} ${VIDEO_RPI_SOURCES})
  1152       set(SOURCE_FILES ${SOURCE_FILES} ${VIDEO_RPI_SOURCES})
  1150       list(APPEND EXTRA_LIBS ${VIDEO_RPI_LIBS})
  1153       list(APPEND EXTRA_LIBS ${VIDEO_RPI_LIBRARIES})
  1151       set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}")
  1154       set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}")
  1152     endif(SDL_VIDEO AND HAVE_VIDEO_RPI)
  1155     endif(SDL_VIDEO AND HAVE_VIDEO_RPI)
  1153   endif(VIDEO_RPI)
  1156   endif(VIDEO_RPI)
  1154 endmacro(CheckRPI)
  1157 endmacro(CheckRPI)
  1155 
  1158