Clean some wayland dependencies.
This commit is contained in:
parent
339a789b8a
commit
b2917e7e5d
7 changed files with 81 additions and 63 deletions
|
@ -1,11 +1,12 @@
|
|||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
# set the project name
|
||||
project(media-tools)
|
||||
project(NotesTK)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
set_property( GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
set (CMAKE_MODULE_PATH infra/cmake)
|
||||
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
|
|
|
@ -31,7 +31,7 @@ This project is dual-licensed under the copyleft AGPL with a commercial licensin
|
|||
### Minimal
|
||||
|
||||
```bash
|
||||
sudo apt-get install build-essential cmake
|
||||
sudo apt-get install build-essential pkg-config cmake
|
||||
```
|
||||
|
||||
### Optional
|
||||
|
|
12
infra/cmake/FindWayland.cmake
Normal file
12
infra/cmake/FindWayland.cmake
Normal file
|
@ -0,0 +1,12 @@
|
|||
set(WAYLAND_FOUND FALSE)
|
||||
|
||||
find_path(_WAYLAND_CLIENT_INCLUDE_DIR NAMES wayland-client.h)
|
||||
find_path(_WAYLAND_EXTENSIONS_INCLUDE_DIR NAMES xdg-shell-client-protocol.h HINTS ENV WAYLAND_EXTENSION_DIR)
|
||||
find_library(_WAYLAND_CLIENT_LIBRARY NAMES wayland-client libwayland-client)
|
||||
|
||||
if (_WAYLAND_CLIENT_INCLUDE_DIR AND _WAYLAND_EXTENSIONS_INCLUDE_DIR AND _WAYLAND_CLIENT_LIBRARY)
|
||||
set(WAYLAND_FOUND TRUE)
|
||||
set(WAYLAND_INCLUDE_DIRS ${_WAYLAND_EXTENSIONS_INCLUDE_DIR})
|
||||
set(WAYLAND_XDG_SOURCE ${_WAYLAND_EXTENSIONS_INCLUDE_DIR}/xdg-shell-protocol.cpp)
|
||||
set(WAYLAND_LIBRARIES ${WAYLAND_CLIENT_LIBRARY} wayland-egl)
|
||||
endif()
|
|
@ -1,3 +1,5 @@
|
|||
set(MODULE_NAME video)
|
||||
|
||||
list(APPEND video_HEADERS
|
||||
Video.h
|
||||
BasicVideoConverter.h
|
||||
|
@ -11,10 +13,11 @@ list(APPEND video_LIB_INCLUDES
|
|||
|
||||
list(APPEND video_DEFINES "")
|
||||
|
||||
message(STATUS "Checking optional dependencies for module: " ${MODULE_NAME})
|
||||
find_package(PkgConfig QUIET)
|
||||
set(_HAS_FFMPEG Off)
|
||||
if(PkgConfig)
|
||||
pkg_check_modules(LIBAV IMPORTED_TARGET
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(LIBAV IMPORTED_TARGET QUIET
|
||||
libavdevice
|
||||
libavfilter
|
||||
libavformat
|
||||
|
@ -23,22 +26,27 @@ if(PkgConfig)
|
|||
libswscale
|
||||
libavutil
|
||||
)
|
||||
list(APPEND video_LIBS PkgConfig::LIBAV)
|
||||
list(APPEND video_HEADERS
|
||||
FfmpegInterface.h
|
||||
)
|
||||
list(APPEND video_LIB_INCLUDES
|
||||
FfmegInterface.cpp
|
||||
)
|
||||
list(APPEND video_DEFINES "HAS_FFMPEG")
|
||||
set(_HAS_FFMPEG ON)
|
||||
|
||||
if (libavdevice_FOUND)
|
||||
list(APPEND video_LIBS PkgConfig::LIBAV)
|
||||
list(APPEND video_HEADERS
|
||||
FfmpegInterface.h
|
||||
)
|
||||
list(APPEND video_LIB_INCLUDES
|
||||
FfmegInterface.cpp
|
||||
)
|
||||
list(APPEND video_DEFINES "HAS_FFMPEG")
|
||||
set(_HAS_FFMPEG ON)
|
||||
else()
|
||||
message(STATUS "libavdevice not found - disabling ffmpeg support")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "LIBRARY CHECK: PkgConfig not found - disabling ffmpeg based video i/o.")
|
||||
message(STATUS "PkgConfig not found - disabling ffmpeg support")
|
||||
endif()
|
||||
|
||||
set(HAS_FFMPEG ${_HAS_FFMPEG} CACHE BOOL "Can build with FFMPEG")
|
||||
|
||||
add_library(video SHARED ${video_LIB_INCLUDES} ${video_HEADERS})
|
||||
add_library(${MODULE_NAME} SHARED ${video_LIB_INCLUDES} ${video_HEADERS})
|
||||
|
||||
target_include_directories(video PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set_target_properties( video PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON )
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
set(MODULE_NAME windows)
|
||||
|
||||
set (platform_INCLUDES "")
|
||||
set (platform_LIBS "")
|
||||
|
||||
set(_HAS_WAYLAND Off)
|
||||
|
||||
if(UNIX)
|
||||
message(STATUS "Checking optional dependencies for module: window")
|
||||
find_package(X11 QUIET)
|
||||
if(X11_FOUND)
|
||||
list(APPEND platform_INCLUDES
|
||||
|
@ -23,42 +24,31 @@ if(UNIX)
|
|||
else()
|
||||
message(STATUS "x11 development headers not found - skipping support")
|
||||
endif()
|
||||
|
||||
find_path(WAYLAND_CLIENT_INCLUDE_DIR NAMES wayland-client.h)
|
||||
#if (NOT ${WAYLAND_CLIENT_INCLUDE_DIR-NOTFOUND})
|
||||
list(APPEND WAYLAND_INCLUDE_DIRS ${WAYLAND_CLIENT_INCLUDE_DIR})
|
||||
|
||||
find_path(WAYLAND_EXTENSIONS_INCLUDE_DIR NAMES xdg-shell-client-protocol.h HINTS ENV WAYLAND_EXTENSION_DIR)
|
||||
|
||||
#if(NOT ${WAYLAND_EXTENSIONS_INCLUDE_DIR-NOTFOUND})
|
||||
find_library(WAYLAND_CLIENT_LIBRARY NAMES wayland-client libwayland-client)
|
||||
|
||||
list(APPEND WAYLAND_INCLUDE_DIRS ${WAYLAND_EXTENSIONS_INCLUDE_DIR})
|
||||
list(APPEND platform_INCLUDES
|
||||
ui_interfaces/wayland/WaylandInterface.cpp
|
||||
ui_interfaces/wayland/WaylandSurface.cpp
|
||||
ui_interfaces/wayland/WaylandBuffer.cpp
|
||||
ui_interfaces/wayland/WaylandPointerInterface.cpp
|
||||
ui_interfaces/wayland/WaylandSeatInterface.cpp
|
||||
ui_interfaces/wayland/WaylandKeyboard.cpp
|
||||
ui_interfaces/wayland/WaylandEglInterface.cpp
|
||||
ui_interfaces/wayland/WaylandEglWindowInterface.cpp
|
||||
${WAYLAND_EXTENSIONS_INCLUDE_DIR}/xdg-shell-protocol.cpp
|
||||
)
|
||||
set(OpenGL_GL_PREFERENCE "GLVND")
|
||||
find_package(OpenGL QUIET)
|
||||
if (OpenGL_FOUND)
|
||||
list(APPEND platform_LIBS OpenGL::EGL)
|
||||
endif()
|
||||
|
||||
set(_HAS_WAYLAND ON)
|
||||
#else()
|
||||
#message(STATUS "Wayland Extensions Header not found - not building Wayland support")
|
||||
#endif()
|
||||
#else()
|
||||
#message(STATUS "Wayland Client Header not found - not building Wayland support")
|
||||
#endif()
|
||||
|
||||
find_package(Wayland QUIET)
|
||||
if(WAYLAND_FOUND)
|
||||
list(APPEND platform_INCLUDES
|
||||
ui_interfaces/wayland/WaylandInterface.cpp
|
||||
ui_interfaces/wayland/WaylandSurface.cpp
|
||||
ui_interfaces/wayland/WaylandBuffer.cpp
|
||||
ui_interfaces/wayland/WaylandPointerInterface.cpp
|
||||
ui_interfaces/wayland/WaylandSeatInterface.cpp
|
||||
ui_interfaces/wayland/WaylandKeyboard.cpp
|
||||
ui_interfaces/wayland/WaylandEglInterface.cpp
|
||||
ui_interfaces/wayland/WaylandEglWindowInterface.cpp
|
||||
${WAYLAND_XDG_SOURCE}
|
||||
)
|
||||
list(APPEND platform_LIBS OpenGL::EGL)
|
||||
list(APPEND DEFINES "HAS_WAYLAND")
|
||||
|
||||
set(OpenGL_GL_PREFERENCE "GLVND")
|
||||
find_package(OpenGL QUIET)
|
||||
if (OpenGL_FOUND)
|
||||
list(APPEND platform_LIBS ${WAYLAND_LIBRARIES})
|
||||
endif()
|
||||
else()
|
||||
Message(STATUS "Wayland dependencies not found - disabling Wayland support")
|
||||
endif()
|
||||
else()
|
||||
list(APPEND platform_INCLUDES
|
||||
ui_interfaces/win32/Win32UIInterface.h
|
||||
|
@ -70,8 +60,6 @@ else()
|
|||
)
|
||||
endif()
|
||||
|
||||
set(HAS_WAYLAND ${_HAS_WAYLAND} CACHE BOOL "Can build with Wayland")
|
||||
|
||||
list(APPEND windows_LIB_INCLUDES
|
||||
ui_interfaces/UiInterfaceFactory.cpp
|
||||
managers/WindowManager.cpp
|
||||
|
@ -91,9 +79,10 @@ target_include_directories(windows PUBLIC
|
|||
${WAYLAND_INCLUDE_DIRS}
|
||||
${X11_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_compile_definitions(${MODULE_NAME} PRIVATE ${DEFINES})
|
||||
target_compile_options(${MODULE_NAME} PRIVATE -Wno-attributes) # From xdg shell autogen code
|
||||
target_link_libraries(${MODULE_NAME} PUBLIC ${platform_LIBS} core geometry graphics ui_elements)
|
||||
|
||||
target_link_libraries(windows PUBLIC ${platform_LIBS} core geometry graphics ui_elements ${WAYLAND_CLIENT_LIBRARY} wayland-egl)
|
||||
target_compile_options(windows PRIVATE -Wno-attributes) # From xdg shell autogen code
|
||||
|
||||
set_property(TARGET windows PROPERTY FOLDER src)
|
||||
set_target_properties( windows PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON )
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER src)
|
||||
set_target_properties( ${MODULE_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON )
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
#ifdef __linux__
|
||||
#include "XcbInterface.h"
|
||||
#ifdef HAS_WAYLAND
|
||||
#include "WaylandInterface.h"
|
||||
#endif
|
||||
#else
|
||||
#include "Win32UiInterface.h"
|
||||
#endif
|
||||
|
@ -21,8 +23,13 @@ std::unique_ptr<AbstractUIInterface> UiInterfaceFactory::create(DesktopManager*
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef HAS_WAYLAND
|
||||
const bool use_hardware = (backend != Backend::WAYLAND_RASTER);
|
||||
return std::make_unique<WaylandInterface>(desktopManager, std::move(fonts_manager), use_hardware);
|
||||
#else
|
||||
const bool use_hardware = (backend != Backend::X11_RASTER);
|
||||
return std::make_unique<XcbInterface>(desktopManager, std::move(fonts_manager), use_hardware);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
return std::make_unique<Win32UiInterface>();
|
||||
|
|
|
@ -36,9 +36,10 @@ list(APPEND TestFiles
|
|||
)
|
||||
endif()
|
||||
|
||||
if (${HAS_WAYLAND})
|
||||
list(APPEND TestFiles
|
||||
windows/TestWaylandWindow.cpp
|
||||
find_package(Wayland QUIET)
|
||||
if(WAYLAND_FOUND)
|
||||
list(APPEND TestFiles
|
||||
windows/TestWaylandWindow.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@ -52,7 +53,7 @@ endif()
|
|||
|
||||
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(DBUS dbus-1)
|
||||
pkg_check_modules(DBUS dbus-1 QUIET)
|
||||
if (DBUS_FOUND)
|
||||
include_directories(${DBUS_INCLUDE_DIRS})
|
||||
link_directories(${DBUS_LIBRARY_DIRS})
|
||||
|
|
Loading…
Reference in a new issue