Start with the skeleton code for Mir support.

This commit is contained in:
BrandonSchaefer 2014-11-06 00:15:37 -08:00 committed by Camilla Berglund
parent bc219056a6
commit cfb7d2f036
4 changed files with 38 additions and 0 deletions

View File

@ -33,6 +33,7 @@ endif()
if (UNIX AND NOT APPLE) if (UNIX AND NOT APPLE)
option(GLFW_USE_WAYLAND "Use Wayland for context creation (implies EGL as well)" OFF) option(GLFW_USE_WAYLAND "Use Wayland for context creation (implies EGL as well)" OFF)
option(GLFW_USE_MIR "Use Mir for context creation (implies EGL as well)" OFF)
endif() endif()
if (MSVC) if (MSVC)
@ -45,6 +46,8 @@ endif()
if (GLFW_USE_WAYLAND) if (GLFW_USE_WAYLAND)
set(GLFW_USE_EGL ON) set(GLFW_USE_EGL ON)
elseif (GLFW_USE_MIR)
set(GLFW_USE_EGL ON)
endif() endif()
if (GLFW_USE_EGL) if (GLFW_USE_EGL)
@ -174,6 +177,9 @@ elseif (UNIX)
if (GLFW_USE_WAYLAND) if (GLFW_USE_WAYLAND)
set(_GLFW_WAYLAND 1) set(_GLFW_WAYLAND 1)
message(STATUS "Using Wayland for window creation") message(STATUS "Using Wayland for window creation")
elseif (GLFW_USE_MIR)
set(_GLFW_MIR 1)
message(STATUS "Using Mir for window creation")
else() else()
set(_GLFW_X11 1) set(_GLFW_X11 1)
message(STATUS "Using X11 for window creation") message(STATUS "Using X11 for window creation")
@ -343,6 +349,29 @@ if (_GLFW_WAYLAND)
endif() endif()
endif() endif()
#--------------------------------------------------------------------
# Use Mir for window creation
#--------------------------------------------------------------------
if (_GLFW_MIR)
find_package(Mir REQUIRED)
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} mirclient")
list(APPEND glfw_INCLUDE_DIRS "${MIR_INCLUDE_DIR}")
list(APPEND glfw_LIBRARIES "${MIR_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT}")
find_package(XKBCommon REQUIRED)
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} xkbcommon")
list(APPEND glfw_INCLUDE_DIRS "${XKBCOMMON_INCLUDE_DIRS}")
list(APPEND glfw_LIBRARIES "${XKBCOMMON_LIBRARY}")
find_library(MATH_LIBRARY m)
mark_as_advanced(MATH_LIBRARY)
if (MATH_LIBRARY)
list(APPEND glfw_LIBRARIES "${MATH_LIBRARY}")
set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -lm")
endif()
endif()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Use GLX for context creation # Use GLX for context creation
#-------------------------------------------------------------------- #--------------------------------------------------------------------

View File

@ -30,6 +30,11 @@ elseif (_GLFW_WAYLAND)
posix_time.h posix_tls.h xkb_unicode.h) posix_time.h posix_tls.h xkb_unicode.h)
set(glfw_SOURCES ${common_SOURCES} wl_init.c wl_monitor.c wl_window.c set(glfw_SOURCES ${common_SOURCES} wl_init.c wl_monitor.c wl_window.c
linux_joystick.c posix_time.c posix_tls.c xkb_unicode.c) linux_joystick.c posix_time.c posix_tls.c xkb_unicode.c)
elseif (_GLFW_MIR)
set(glfw_HEADERS ${common_HEADERS} mir_platform.h linux_joystick.h
posix_time.h posix_tls.h xkb_unicode.h)
set(glfw_SOURCES ${common_SOURCES} mir_init.c mir_monitor.c mir_window.c
linux_joystick.c posix_time.c posix_tls.c xkb_unicode.c)
endif() endif()
if (_GLFW_EGL) if (_GLFW_EGL)

View File

@ -42,6 +42,8 @@
#cmakedefine _GLFW_COCOA #cmakedefine _GLFW_COCOA
// Define this to 1 if building GLFW for Wayland // Define this to 1 if building GLFW for Wayland
#cmakedefine _GLFW_WAYLAND #cmakedefine _GLFW_WAYLAND
// Define this to 1 if building GLFW for Mir
#cmakedefine _GLFW_MIR
// Define this to 1 if building GLFW for EGL // Define this to 1 if building GLFW for EGL
#cmakedefine _GLFW_EGL #cmakedefine _GLFW_EGL

View File

@ -74,6 +74,8 @@ typedef struct _GLFWcursor _GLFWcursor;
#include "x11_platform.h" #include "x11_platform.h"
#elif defined(_GLFW_WAYLAND) #elif defined(_GLFW_WAYLAND)
#include "wl_platform.h" #include "wl_platform.h"
#elif defined(_GLFW_MIR)
#include "mir_platform.h"
#else #else
#error "No supported window creation API selected" #error "No supported window creation API selected"
#endif #endif