提交 53b8071e 编写于 作者: S Simon Fels

On systems we run against Mir we also need to build against it

上级 17bdff54
......@@ -67,6 +67,10 @@ pkg_check_modules(SDL2 sdl2 REQUIRED)
pkg_check_modules(DBUS_CPP dbus-cpp REQUIRED)
pkg_check_modules(DBUS dbus-1 REQUIRED)
pkg_check_modules(LXC lxc REQUIRED)
pkg_check_modules(MIRCLIENT mirclient)
if (MIRCLIENT_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMIR_SUPPORT")
endif()
#####################################################################
# Enable code coverage calculation with gcov/gcovr/lcov
......
......@@ -8,9 +8,11 @@ include_directories(
${DBUS_INCLUDE_DIRS}
${SDL2_INCLUDE_DIRS}
${LXC_INCLUDE_DIRS}
${MIRCLIENT_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/external
${CMAKE_SOURCE_DIR}/external/process-cpp-minimal/include
${CMAKE_SOURCE_DIR}/external/android-emugl/shared
${CMAKE_SOURCE_DIR}/external/android-emugl/host/include
......@@ -205,6 +207,8 @@ target_link_libraries(anbox-core
${SDL2_LIBRARIES}
${LXC_LDFLAGS}
${LXC_LIBRARIES}
${MIRCLIENT_LDFLAGS}
${MIRCLIENT_LIBRARIES}
pthread
process-cpp
emugl_common
......
......@@ -23,6 +23,10 @@
#include <boost/throw_exception.hpp>
#if defined(MIR_SUPPORT)
#include <mir_toolkit/mir_client_library.h>
#endif
#include <SDL_syswm.h>
#pragma GCC diagnostic pop
......@@ -58,10 +62,17 @@ Window::Window(const std::shared_ptr<Renderer> &renderer,
SDL_GetWindowWMInfo(window_, &info);
switch (info.subsystem) {
case SDL_SYSWM_X11:
native_display_ =
static_cast<EGLNativeDisplayType>(info.info.x11.display);
native_display_ = static_cast<EGLNativeDisplayType>(info.info.x11.display);
native_window_ = static_cast<EGLNativeWindowType>(info.info.x11.window);
break;
#if defined(MIR_SUPPORT)
case SDL_SYSWM_MIR: {
native_display_ = static_cast<EGLNativeDisplayType>(mir_connection_get_egl_native_display(info.info.mir.connection));
auto buffer_stream = mir_surface_get_buffer_stream(info.info.mir.surface);
native_window_ = reinterpret_cast<EGLNativeWindowType>(mir_buffer_stream_get_egl_native_window(buffer_stream));
break;
}
#endif
default:
ERROR("Unknown subsystem (%d)", info.subsystem);
BOOST_THROW_EXCEPTION(std::runtime_error("SDL subsystem not suported"));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册