cmake/sdlchecks.cmake
changeset 9409 9df20f292907
parent 9277 f0bd40782fc7
child 9414 669bf9fb901e
     1.1 --- a/cmake/sdlchecks.cmake	Fri Mar 20 10:02:45 2015 -0400
     1.2 +++ b/cmake/sdlchecks.cmake	Fri Mar 20 10:35:42 2015 -0400
     1.3 @@ -505,8 +505,13 @@
     1.4    endif()
     1.5  endmacro()
     1.6  
     1.7 +# Requires:
     1.8 +# - EGL
     1.9 +# - PkgCheckModules
    1.10 +# Optional:
    1.11 +# - MIR_SHARED opt
    1.12 +# - HAVE_DLOPEN opt
    1.13  macro(CheckMir)
    1.14 -# !!! FIXME: hook up dynamic loading here.
    1.15      if(VIDEO_MIR)
    1.16          find_library(MIR_LIB mirclient mircommon egl)
    1.17          pkg_check_modules(MIR_TOOLKIT mirclient mircommon)
    1.18 @@ -522,15 +527,31 @@
    1.19              set(SDL_VIDEO_DRIVER_MIR 1)
    1.20  
    1.21              list(APPEND EXTRA_CFLAGS ${MIR_TOOLKIT_CFLAGS} ${EGL_CLFAGS} ${XKB_CLFLAGS})
    1.22 -            list(APPEND EXTRA_LDFLAGS ${MIR_TOOLKIT_LDFLAGS} ${EGL_LDLAGS} ${XKB_LDLAGS})
    1.23 -        endif (MIR_LIB AND MIR_TOOLKIT_FOUND AND EGL_FOUND AND XKB_FOUND)
    1.24 +
    1.25 +            if(MIR_SHARED)
    1.26 +                if(NOT HAVE_DLOPEN)
    1.27 +                    message_warn("You must have SDL_LoadObject() support for dynamic Mir loading")
    1.28 +                else()
    1.29 +                    FindLibraryAndSONAME(mirclient)
    1.30 +                    FindLibraryAndSONAME(xkbcommon)
    1.31 +                    set(SDL_VIDEO_DRIVER_MIR_DYNAMIC "\"${MIRCLIENT_LIB_SONAME}\"")
    1.32 +                    set(SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON "\"${XKBCOMMON_LIB_SONAME}\"")
    1.33 +                    set(HAVE_MIR_SHARED TRUE)
    1.34 +                endif()
    1.35 +            else()
    1.36 +                set(EXTRA_LIBS ${MIR_TOOLKIT_LIBRARIES} ${EXTRA_LIBS})
    1.37 +            endif()
    1.38 +        endif()
    1.39      endif()
    1.40  endmacro()
    1.41  
    1.42  # Requires:
    1.43  # - EGL
    1.44 +# - PkgCheckModules
    1.45 +# Optional:
    1.46 +# - WAYLAND_SHARED opt
    1.47 +# - HAVE_DLOPEN opt
    1.48  macro(CheckWayland)
    1.49 -# !!! FIXME: hook up dynamic loading here.
    1.50    if(VIDEO_WAYLAND)
    1.51      pkg_check_modules(WAYLAND wayland-client wayland-cursor wayland-egl egl xkbcommon)
    1.52      if(WAYLAND_FOUND)
    1.53 @@ -540,12 +561,34 @@
    1.54        include_directories(
    1.55            ${WAYLAND_INCLUDE_DIRS}
    1.56        )
    1.57 -      set(EXTRA_LIBS ${WAYLAND_LIBRARIES} ${EXTRA_LIBS})
    1.58        set(HAVE_VIDEO_WAYLAND TRUE)
    1.59        set(HAVE_SDL_VIDEO TRUE)
    1.60  
    1.61        file(GLOB WAYLAND_SOURCES ${SDL2_SOURCE_DIR}/src/video/wayland/*.c)
    1.62        set(SOURCE_FILES ${SOURCE_FILES} ${WAYLAND_SOURCES})
    1.63 +
    1.64 +      if(VIDEO_WAYLAND_QT_TOUCH)
    1.65 +          set(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1)
    1.66 +      endif()
    1.67 +
    1.68 +      if(WAYLAND_SHARED)
    1.69 +        if(NOT HAVE_DLOPEN)
    1.70 +          message_warn("You must have SDL_LoadObject() support for dynamic Wayland loading")
    1.71 +        else()
    1.72 +          FindLibraryAndSONAME(wayland-client)
    1.73 +          FindLibraryAndSONAME(wayland-egl)
    1.74 +          FindLibraryAndSONAME(wayland-cursor)
    1.75 +          FindLibraryAndSONAME(xkbcommon)
    1.76 +          set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC "\"${WAYLAND_CLIENT_LIB_SONAME}\"")
    1.77 +          set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL "\"${WAYLAND_EGL_LIB_SONAME}\"")
    1.78 +          set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR "\"${WAYLAND_CURSOR_LIB_SONAME}\"")
    1.79 +          set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON "\"${XKBCOMMON_LIB_SONAME}\"")
    1.80 +          set(HAVE_WAYLAND_SHARED TRUE)
    1.81 +        endif()
    1.82 +      else()
    1.83 +        set(EXTRA_LIBS ${WAYLAND_LIBRARIES} ${EXTRA_LIBS})
    1.84 +      endif()
    1.85 +
    1.86        set(SDL_VIDEO_DRIVER_WAYLAND 1)
    1.87      endif()
    1.88    endif()