cmake/sdlchecks.cmake
changeset 9409 9df20f292907
parent 9277 f0bd40782fc7
child 9414 669bf9fb901e
equal deleted inserted replaced
9408:93ba64cb5e16 9409:9df20f292907
   503       set(CMAKE_REQUIRED_LIBRARIES)
   503       set(CMAKE_REQUIRED_LIBRARIES)
   504     endif()
   504     endif()
   505   endif()
   505   endif()
   506 endmacro()
   506 endmacro()
   507 
   507 
       
   508 # Requires:
       
   509 # - EGL
       
   510 # - PkgCheckModules
       
   511 # Optional:
       
   512 # - MIR_SHARED opt
       
   513 # - HAVE_DLOPEN opt
   508 macro(CheckMir)
   514 macro(CheckMir)
   509 # !!! FIXME: hook up dynamic loading here.
       
   510     if(VIDEO_MIR)
   515     if(VIDEO_MIR)
   511         find_library(MIR_LIB mirclient mircommon egl)
   516         find_library(MIR_LIB mirclient mircommon egl)
   512         pkg_check_modules(MIR_TOOLKIT mirclient mircommon)
   517         pkg_check_modules(MIR_TOOLKIT mirclient mircommon)
   513         pkg_check_modules(EGL egl)
   518         pkg_check_modules(EGL egl)
   514         pkg_check_modules(XKB xkbcommon)
   519         pkg_check_modules(XKB xkbcommon)
   520             file(GLOB MIR_SOURCES ${SDL2_SOURCE_DIR}/src/video/mir/*.c)
   525             file(GLOB MIR_SOURCES ${SDL2_SOURCE_DIR}/src/video/mir/*.c)
   521             set(SOURCE_FILES ${SOURCE_FILES} ${MIR_SOURCES})
   526             set(SOURCE_FILES ${SOURCE_FILES} ${MIR_SOURCES})
   522             set(SDL_VIDEO_DRIVER_MIR 1)
   527             set(SDL_VIDEO_DRIVER_MIR 1)
   523 
   528 
   524             list(APPEND EXTRA_CFLAGS ${MIR_TOOLKIT_CFLAGS} ${EGL_CLFAGS} ${XKB_CLFLAGS})
   529             list(APPEND EXTRA_CFLAGS ${MIR_TOOLKIT_CFLAGS} ${EGL_CLFAGS} ${XKB_CLFLAGS})
   525             list(APPEND EXTRA_LDFLAGS ${MIR_TOOLKIT_LDFLAGS} ${EGL_LDLAGS} ${XKB_LDLAGS})
   530 
   526         endif (MIR_LIB AND MIR_TOOLKIT_FOUND AND EGL_FOUND AND XKB_FOUND)
   531             if(MIR_SHARED)
       
   532                 if(NOT HAVE_DLOPEN)
       
   533                     message_warn("You must have SDL_LoadObject() support for dynamic Mir loading")
       
   534                 else()
       
   535                     FindLibraryAndSONAME(mirclient)
       
   536                     FindLibraryAndSONAME(xkbcommon)
       
   537                     set(SDL_VIDEO_DRIVER_MIR_DYNAMIC "\"${MIRCLIENT_LIB_SONAME}\"")
       
   538                     set(SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON "\"${XKBCOMMON_LIB_SONAME}\"")
       
   539                     set(HAVE_MIR_SHARED TRUE)
       
   540                 endif()
       
   541             else()
       
   542                 set(EXTRA_LIBS ${MIR_TOOLKIT_LIBRARIES} ${EXTRA_LIBS})
       
   543             endif()
       
   544         endif()
   527     endif()
   545     endif()
   528 endmacro()
   546 endmacro()
   529 
   547 
   530 # Requires:
   548 # Requires:
   531 # - EGL
   549 # - EGL
       
   550 # - PkgCheckModules
       
   551 # Optional:
       
   552 # - WAYLAND_SHARED opt
       
   553 # - HAVE_DLOPEN opt
   532 macro(CheckWayland)
   554 macro(CheckWayland)
   533 # !!! FIXME: hook up dynamic loading here.
       
   534   if(VIDEO_WAYLAND)
   555   if(VIDEO_WAYLAND)
   535     pkg_check_modules(WAYLAND wayland-client wayland-cursor wayland-egl egl xkbcommon)
   556     pkg_check_modules(WAYLAND wayland-client wayland-cursor wayland-egl egl xkbcommon)
   536     if(WAYLAND_FOUND)
   557     if(WAYLAND_FOUND)
   537       link_directories(
   558       link_directories(
   538           ${WAYLAND_LIBRARY_DIRS}
   559           ${WAYLAND_LIBRARY_DIRS}
   539       )
   560       )
   540       include_directories(
   561       include_directories(
   541           ${WAYLAND_INCLUDE_DIRS}
   562           ${WAYLAND_INCLUDE_DIRS}
   542       )
   563       )
   543       set(EXTRA_LIBS ${WAYLAND_LIBRARIES} ${EXTRA_LIBS})
       
   544       set(HAVE_VIDEO_WAYLAND TRUE)
   564       set(HAVE_VIDEO_WAYLAND TRUE)
   545       set(HAVE_SDL_VIDEO TRUE)
   565       set(HAVE_SDL_VIDEO TRUE)
   546 
   566 
   547       file(GLOB WAYLAND_SOURCES ${SDL2_SOURCE_DIR}/src/video/wayland/*.c)
   567       file(GLOB WAYLAND_SOURCES ${SDL2_SOURCE_DIR}/src/video/wayland/*.c)
   548       set(SOURCE_FILES ${SOURCE_FILES} ${WAYLAND_SOURCES})
   568       set(SOURCE_FILES ${SOURCE_FILES} ${WAYLAND_SOURCES})
       
   569 
       
   570       if(VIDEO_WAYLAND_QT_TOUCH)
       
   571           set(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1)
       
   572       endif()
       
   573 
       
   574       if(WAYLAND_SHARED)
       
   575         if(NOT HAVE_DLOPEN)
       
   576           message_warn("You must have SDL_LoadObject() support for dynamic Wayland loading")
       
   577         else()
       
   578           FindLibraryAndSONAME(wayland-client)
       
   579           FindLibraryAndSONAME(wayland-egl)
       
   580           FindLibraryAndSONAME(wayland-cursor)
       
   581           FindLibraryAndSONAME(xkbcommon)
       
   582           set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC "\"${WAYLAND_CLIENT_LIB_SONAME}\"")
       
   583           set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL "\"${WAYLAND_EGL_LIB_SONAME}\"")
       
   584           set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR "\"${WAYLAND_CURSOR_LIB_SONAME}\"")
       
   585           set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON "\"${XKBCOMMON_LIB_SONAME}\"")
       
   586           set(HAVE_WAYLAND_SHARED TRUE)
       
   587         endif()
       
   588       else()
       
   589         set(EXTRA_LIBS ${WAYLAND_LIBRARIES} ${EXTRA_LIBS})
       
   590       endif()
       
   591 
   549       set(SDL_VIDEO_DRIVER_WAYLAND 1)
   592       set(SDL_VIDEO_DRIVER_WAYLAND 1)
   550     endif()
   593     endif()
   551   endif()
   594   endif()
   552 endmacro()
   595 endmacro()
   553 
   596