Clean some wayland dependencies.

This commit is contained in:
James Grogan 2022-11-30 12:30:20 +00:00
parent 339a789b8a
commit b2917e7e5d
7 changed files with 81 additions and 63 deletions

View file

@ -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 )