CMake: add WITH_GHOST_X11 option
- Support building only with Wayland. - In this case, show useful error messages when Wayland fails to load.
This commit is contained in:
parent
9a4844cfdb
commit
d7d140ec7f
@ -138,11 +138,6 @@ get_blender_version()
|
||||
#-----------------------------------------------------------------------------
|
||||
# Options
|
||||
|
||||
# First platform specific non-cached vars
|
||||
if(UNIX AND NOT (APPLE OR HAIKU))
|
||||
set(WITH_GHOST_X11 ON)
|
||||
endif()
|
||||
|
||||
# Blender internal features
|
||||
option(WITH_BLENDER "Build blender (disable to build only the blender player)" ON)
|
||||
mark_as_advanced(WITH_BLENDER)
|
||||
@ -207,8 +202,12 @@ mark_as_advanced(WITH_GHOST_DEBUG)
|
||||
option(WITH_GHOST_SDL "Enable building Blender against SDL for windowing rather than the native APIs" OFF)
|
||||
mark_as_advanced(WITH_GHOST_SDL)
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
option(WITH_GHOST_WAYLAND "Enable building Blender against Wayland for windowing" OFF)
|
||||
if(UNIX AND NOT (APPLE OR HAIKU))
|
||||
option(WITH_GHOST_X11 "Enable building Blender against X11 for windowing" ON)
|
||||
mark_as_advanced(WITH_GHOST_X11)
|
||||
|
||||
option(WITH_GHOST_WAYLAND "Enable building Blender against Wayland for windowing (under development)" OFF)
|
||||
mark_as_advanced(WITH_GHOST_WAYLAND)
|
||||
endif()
|
||||
|
||||
if(WITH_GHOST_X11)
|
||||
@ -693,6 +692,7 @@ if(WITH_INSTALL_PORTABLE)
|
||||
endif()
|
||||
|
||||
if(WITH_GHOST_SDL OR WITH_HEADLESS)
|
||||
set(WITH_GHOST_WAYLAND OFF)
|
||||
set(WITH_GHOST_X11 OFF)
|
||||
set(WITH_X11_XINPUT OFF)
|
||||
set(WITH_X11_XF86VMODE OFF)
|
||||
|
@ -54,30 +54,30 @@ GHOST_TSuccess GHOST_ISystem::createSystem()
|
||||
{
|
||||
GHOST_TSuccess success;
|
||||
if (!m_system) {
|
||||
#if defined(WITH_GHOST_X11) || defined(WITH_GHOST_WAYLAND)
|
||||
# ifdef WITH_GHOST_WAYLAND
|
||||
#if defined(WITH_GHOST_X11) && defined(WITH_GHOST_WAYLAND)
|
||||
/* Special case, try Wayland, fall back to X11. */
|
||||
try {
|
||||
m_system = new GHOST_SystemWayland();
|
||||
}
|
||||
catch (const std::exception &) {
|
||||
catch (const std::runtime_error &) {
|
||||
/* fallback to X11. */
|
||||
}
|
||||
# endif
|
||||
# ifdef WITH_GHOST_X11
|
||||
if (!m_system) {
|
||||
m_system = new GHOST_SystemX11();
|
||||
}
|
||||
# endif
|
||||
#else
|
||||
# ifdef WITH_HEADLESS
|
||||
#elif defined(WITH_GHOST_X11)
|
||||
m_system = new GHOST_SystemX11();
|
||||
#elif defined(WITH_GHOST_WAYLAND)
|
||||
m_system = new GHOST_SystemWayland();
|
||||
#elif defined(WITH_HEADLESS)
|
||||
m_system = new GHOST_SystemNULL();
|
||||
# elif defined(WITH_GHOST_SDL)
|
||||
#elif defined(WITH_GHOST_SDL)
|
||||
m_system = new GHOST_SystemSDL();
|
||||
# elif defined(WIN32)
|
||||
#elif defined(WIN32)
|
||||
m_system = new GHOST_SystemWin32();
|
||||
# else
|
||||
# ifdef __APPLE__
|
||||
#else
|
||||
# ifdef __APPLE__
|
||||
m_system = new GHOST_SystemCocoa();
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
success = m_system != NULL ? GHOST_kSuccess : GHOST_kFailure;
|
||||
|
@ -1197,7 +1197,7 @@ GHOST_SystemWayland::GHOST_SystemWayland() : GHOST_System(), d(new display_t)
|
||||
d->display = wl_display_connect(nullptr);
|
||||
if (!d->display) {
|
||||
display_destroy(d);
|
||||
throw std::exception();
|
||||
throw std::runtime_error("Wayland: unable to connect to display!");
|
||||
}
|
||||
|
||||
/* Register interfaces. */
|
||||
@ -1211,7 +1211,7 @@ GHOST_SystemWayland::GHOST_SystemWayland() : GHOST_System(), d(new display_t)
|
||||
|
||||
if (!d->xdg_shell) {
|
||||
display_destroy(d);
|
||||
throw std::exception();
|
||||
throw std::runtime_error("Wayland: unable to access xdg_shell!");
|
||||
}
|
||||
|
||||
/* Register data device per seat for IPC between Wayland clients. */
|
||||
@ -1230,7 +1230,7 @@ GHOST_SystemWayland::GHOST_SystemWayland() : GHOST_System(), d(new display_t)
|
||||
d->cursor_theme = wl_cursor_theme_load(theme, sizei, d->shm);
|
||||
if (!d->cursor_theme) {
|
||||
display_destroy(d);
|
||||
throw std::exception();
|
||||
throw std::runtime_error("Wayland: unable to access cursor themes!");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user