Skip to content
Permalink
Browse files

Added Mir video target (thanks, Brandon!).

  • Loading branch information
icculus committed Feb 3, 2014
1 parent dce9b7b commit 19f8c6224fd126d25c58a3088a9c65c3467ca0d0
@@ -231,6 +231,7 @@ set_option(SNDIO "Support the sndio audio API" ${UNIX_SYS})
set_option(RPATH "Use an rpath when linking SDL" ${UNIX_SYS})
set_option(CLOCK_GETTIME "Use clock_gettime() instead of gettimeofday()" OFF)
set_option(INPUT_TSLIB "Use the Touchscreen library for input" ${UNIX_SYS})
set_option(VIDEO_MIR "Use Mir video driver" ${UNIX_SYS})
set_option(VIDEO_X11 "Use X11 video driver" ${UNIX_SYS})
set_option(VIDEO_WAYLAND "Use Wayland video driver" ${UNIX_SYS})
dep_option(X11_SHARED "Dynamically load X11 support" ON "VIDEO_X11" OFF)
@@ -654,6 +655,7 @@ if(UNIX AND NOT APPLE)

if(SDL_VIDEO)
CheckX11()
CheckMir()
CheckDirectFB()
CheckOpenGLX11()
CheckOpenGLESX11()
@@ -505,6 +505,27 @@ macro(CheckX11)
endif(VIDEO_X11)
endmacro(CheckX11)

macro(CheckMir)
if(VIDEO_MIR)
find_library(MIR_LIB mirclient mircommon egl)
pkg_check_modules(MIR_TOOLKIT mirclient mircommon)
pkg_check_modules(EGL egl)
pkg_check_modules(XKB xkbcommon)

if (MIR_LIB AND MIR_TOOLKIT_FOUND AND EGL_FOUND AND XKB_FOUND)
set(HAVE_VIDEO_MIR TRUE)
set(HAVE_SDL_VIDEO TRUE)

file(GLOB MIR_SOURCES ${SDL2_SOURCE_DIR}/src/video/mir/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${MIR_SOURCES})
set(SDL_VIDEO_DRIVER_MIR 1)

list(APPEND EXTRA_CFLAGS ${MIR_TOOLKIT_CFLAGS} ${EGL_CLFAGS} ${XKB_CLFLAGS})
list(APPEND EXTRA_LDFLAGS ${MIR_TOOLKIT_LDFLAGS} ${EGL_LDLAGS} ${XKB_LDLAGS})
endif (MIR_LIB AND MIR_TOOLKIT_FOUND AND EGL_FOUND AND XKB_FOUND)
endif(VIDEO_MIR)
endmacro(CheckMir)

# Requires:
# - EGL
macro(CheckWayland)
100 configure
@@ -817,6 +817,7 @@ enable_sndio
enable_sndio_shared
enable_diskaudio
enable_dummyaudio
enable_video_mir
enable_video_wayland
enable_video_wayland_qt_touch
enable_wayland_shared
@@ -1534,6 +1535,7 @@ Optional Features:
--enable-sndio-shared dynamically load sndio audio support [[default=yes]]
--enable-diskaudio support the disk writer audio driver [[default=yes]]
--enable-dummyaudio support the dummy audio driver [[default=yes]]
--enable-video-mir use Mir video driver [[default=yes]]
--enable-video-wayland use Wayland video driver [[default=yes]]
--enable-video-wayland-qt-touch
QtWayland server support for Wayland video driver
fi
}

CheckMir()
{
# Check whether --enable-video-mir was given.
if test "${enable_video_mir+set}" = set; then :
enableval=$enable_video_mir;
else
enable_video_mir=yes
fi


if test x$enable_video = xyes -a x$enable_video_mir = xyes; then
# Extract the first word of "pkg-config", so it can be a program name with args.
set dummy pkg-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_PKG_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $PKG_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS

test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
;;
esac
fi
PKG_CONFIG=$ac_cv_path_PKG_CONFIG
if test -n "$PKG_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
$as_echo "$PKG_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi



if test x$PKG_CONFIG != xno; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mir support" >&5
$as_echo_n "checking for Mir support... " >&6; }
video_mir=no
tmp_CFLAGS="$CFLAGS"
CFLAGS="$EXTRA_CFLAGS `$PKG_CONFIG --cflags egl mirclient xkbcommon`"

cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

#include <EGL/egl.h>
#include <xkbcommon/xkbcommon.h>
#include <mir_toolkit/mir_client_library.h>

int
main ()
{


;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :

video_mir=yes

fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS="$tmp_CFLAGS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_mir" >&5
$as_echo "$video_mir" >&6; }

if test x$video_mir = xyes; then
$as_echo "#define SDL_VIDEO_DRIVER_MIR 1" >>confdefs.h

SOURCES="$SOURCES $srcdir/src/video/mir/*.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS `$PKG_CONFIG --cflags egl mirclient xkbcommon`"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$PKG_CONFIG --libs egl mirclient xkbcommon`"
have_video=yes
fi
fi
fi
}

CheckWarnAll()
{
CheckSNDIO
CheckX11
CheckWayland
CheckMir
CheckDirectFB
CheckFusionSound
CheckOpenGLX11
@@ -1124,6 +1124,42 @@ CheckStackBoundary()
fi
}

CheckMir()
{
AC_ARG_ENABLE(video-mir,
AC_HELP_STRING([--enable-video-mir], [use Mir video driver [[default=yes]]]),
, enable_video_mir=yes)

if test x$enable_video = xyes -a x$enable_video_mir = xyes; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)

if test x$PKG_CONFIG != xno; then
AC_MSG_CHECKING(for Mir support)
video_mir=no
tmp_CFLAGS="$CFLAGS"
CFLAGS="$EXTRA_CFLAGS `$PKG_CONFIG --cflags egl mirclient xkbcommon`"

AC_TRY_COMPILE([
#include <EGL/egl.h>
#include <xkbcommon/xkbcommon.h>
#include <mir_toolkit/mir_client_library.h>
],[
],[
video_mir=yes
])
CFLAGS="$tmp_CFLAGS"
AC_MSG_RESULT($video_mir)

if test x$video_mir = xyes; then
AC_DEFINE(SDL_VIDEO_DRIVER_MIR)
SOURCES="$SOURCES $srcdir/src/video/mir/*.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS `$PKG_CONFIG --cflags egl mirclient xkbcommon`"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$PKG_CONFIG --libs egl mirclient xkbcommon`"
have_video=yes
fi
fi
fi
}

dnl See if GCC's -Wall is supported.
CheckWarnAll()
@@ -2612,6 +2648,7 @@ case "$host" in
CheckSNDIO
CheckX11
CheckWayland
CheckMir
CheckDirectFB
CheckFusionSound
CheckOpenGLX11
@@ -259,6 +259,7 @@
#cmakedefine SDL_VIDEO_DRIVER_DUMMY @SDL_VIDEO_DRIVER_DUMMY@
#cmakedefine SDL_VIDEO_DRIVER_WINDOWS @SDL_VIDEO_DRIVER_WINDOWS@
#cmakedefine SDL_VIDEO_DRIVER_WAYLAND @SDL_VIDEO_DRIVER_WAYLAND@
#cmakedefine SDL_VIDEO_DRIVER_MIR @SDL_VIDEO_DRIVER_MIR@
#cmakedefine SDL_VIDEO_DRIVER_X11 @SDL_VIDEO_DRIVER_X11@
#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC @SDL_VIDEO_DRIVER_X11_DYNAMIC@
#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT @SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT@
@@ -267,6 +267,7 @@
#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL
#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR
#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
#undef SDL_VIDEO_DRIVER_MIR
#undef SDL_VIDEO_DRIVER_X11
#undef SDL_VIDEO_DRIVER_RPI
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC
@@ -105,6 +105,7 @@ typedef enum
SDL_SYSWM_COCOA,
SDL_SYSWM_UIKIT,
SDL_SYSWM_WAYLAND,
SDL_SYSWM_MIR,
} SDL_SYSWM_TYPE;

/**
@@ -345,6 +345,9 @@ extern VideoBootStrap COCOA_bootstrap;
#if SDL_VIDEO_DRIVER_X11
extern VideoBootStrap X11_bootstrap;
#endif
#if SDL_VIDEO_DRIVER_MIR
extern VideoBootStrap MIR_bootstrap;
#endif
#if SDL_VIDEO_DRIVER_DIRECTFB
extern VideoBootStrap DirectFB_bootstrap;
#endif
@@ -59,6 +59,9 @@ static VideoBootStrap *bootstrap[] = {
#if SDL_VIDEO_DRIVER_X11
&X11_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_MIR
&MIR_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_DIRECTFB
&DirectFB_bootstrap,
#endif

0 comments on commit 19f8c62

Please sign in to comment.