cmake/sdlchecks.cmake
changeset 9077 28e6de55eb07
parent 8991 13b0df1793e8
child 9127 a8c38ed1a674
     1.1 --- a/cmake/sdlchecks.cmake	Sat Aug 16 23:25:02 2014 -0700
     1.2 +++ b/cmake/sdlchecks.cmake	Sat Aug 16 23:28:40 2014 -0700
     1.3 @@ -917,3 +917,32 @@
     1.4      set(CMAKE_REQUIRED_FLAGS)
     1.5    endif(HAVE_USBHID)
     1.6  endmacro(CheckUSBHID)
     1.7 +
     1.8 +# Requires:
     1.9 +# - n/a
    1.10 +macro(CheckRPI)
    1.11 +  if(VIDEO_RPI)
    1.12 +    set(VIDEO_RPI_INCLUDE_DIRS "/opt/vc/include" "/opt/vc/include/interface/vcos/pthreads" "/opt/vc/include/interface/vmcs_host/linux/" )
    1.13 +    set(VIDEO_RPI_LIBRARY_DIRS "/opt/vc/lib" )
    1.14 +    set(VIDEO_RPI_LIBS bcm_host )
    1.15 +    listtostr(VIDEO_RPI_INCLUDE_DIRS VIDEO_RPI_INCLUDE_FLAGS "-I")
    1.16 +    listtostr(VIDEO_RPI_LIBRARY_DIRS VIDEO_RPI_LIBRARY_FLAGS "-L")
    1.17 +
    1.18 +    set(CMAKE_REQUIRED_FLAGS "${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}")
    1.19 +    set(CMAKE_REQUIRED_LIBRARIES "${VIDEO_RPI_LIBS}")
    1.20 +    check_c_source_compiles("
    1.21 +        #include <bcm_host.h>
    1.22 +        int main(int argc, char **argv) {}" HAVE_VIDEO_RPI)
    1.23 +    set(CMAKE_REQUIRED_FLAGS)
    1.24 +    set(CMAKE_REQUIRED_LIBRARIES)
    1.25 +
    1.26 +    if(SDL_VIDEO AND HAVE_VIDEO_RPI)
    1.27 +      set(HAVE_SDL_VIDEO TRUE)
    1.28 +      set(SDL_VIDEO_DRIVER_RPI 1)
    1.29 +      file(GLOB VIDEO_RPI_SOURCES ${SDL2_SOURCE_DIR}/src/video/raspberry/*.c)
    1.30 +      set(SOURCE_FILES ${SOURCE_FILES} ${VIDEO_RPI_SOURCES})
    1.31 +      list(APPEND EXTRA_LIBS ${VIDEO_RPI_LIBS})
    1.32 +      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}")
    1.33 +    endif(SDL_VIDEO AND HAVE_VIDEO_RPI)
    1.34 +  endif(VIDEO_RPI)
    1.35 +endmacro(CheckRPI)