Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unblock Wayland integration for Qt5 #212

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions external/qt/package.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,42 @@ if (QT_VERSION_MAJOR GREATER_EQUAL 6)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core5Compat OpenGL OpenGLWidgets REQUIRED)
endif()

# QtWaylandScanner cmake integration from Qt 6 is used
cmake_dependent_option(DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION "Disable all code for Wayland integration." OFF "LINUX; qt_version_6_or_greater" ON)
cmake_dependent_option(DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION "Disable all code for Wayland integration." OFF LINUX ON)

if (LINUX)
if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS WaylandClient REQUIRED)

find_package(ECM QUIET)
if (ECM_FOUND)
list(PREPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
endif()
if (QT_VERSION_MAJOR GREATER_EQUAL 5)
find_package(QtWaylandScanner REQUIRED)

# Imitate QtWayland's generator function by means of extra CMake modules.
function(qt_generate_wayland_protocol_client_sources target)
cmake_parse_arguments(GEN "" "" FILES ${ARGN})
foreach(xmldef ${GEN_FILES})
get_filename_component(base ${xmldef} NAME_WE)
ecm_add_qtwayland_client_protocol(generated PROTOCOL ${xmldef} BASENAME ${base})
endforeach()
target_sources(${target} PRIVATE ${generated})
target_include_directories(${target} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
endfunction()
endif()

find_package(WaylandProtocols QUIET)
if (NOT WaylandProtocols_FOUND)
set(WaylandProtocols_DATADIR ${third_party_loc}/wayland-protocols)
endif()
message(STATUS "Found WaylandProtocols: ${WaylandProtocols_DATADIR}")

find_package(PlasmaWaylandProtocols QUIET)
if (NOT PlasmaWaylandProtocols_FOUND)
set(PLASMA_WAYLAND_PROTOCOLS_DIR ${third_party_loc}/plasma-wayland-protocols/src/protocols)
endif()
message(STATUS "Found PlasmaWaylandProtocols: ${PLASMA_WAYLAND_PROTOCOLS_DIR}")
endif()

if ((NOT DESKTOP_APP_USE_PACKAGED
Expand Down