|
| 1 | +# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
| 2 | +# |
| 3 | +# SPDX-License-Identifier: LGPL-3.0-or-later |
| 4 | + |
| 5 | +project(kwayland-shell) |
| 6 | + |
| 7 | +find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core Gui Widgets XkbCommonSupport WaylandClient) |
| 8 | + |
| 9 | +include(wayland-shell.cmake) |
| 10 | + |
| 11 | +try_compile(DEEPIN_KWIN_TEST_COMPILE_RESULT ${CMAKE_CURRENT_BINARY_DIR}/deepin-kwin-test |
| 12 | + ${CMAKE_CURRENT_LIST_DIR}/config.tests/deepin-kwin-test deepin-kwin-test) |
| 13 | + |
| 14 | +try_compile(WAYLAND_TEST_COMPILE_RESULT ${CMAKE_CURRENT_BINARY_DIR}/wayland_test |
| 15 | + ${CMAKE_CURRENT_LIST_DIR}/config.tests/wayland_test wayland_test) |
| 16 | + |
| 17 | +if(WAYLAND_TEST_COMPILE_RESULT) |
| 18 | + add_definitions(-DUSE_DEEPIN_WAYLAND) |
| 19 | + set(GLOBAL_HEADERS |
| 20 | + dwaylandshellmanager.h |
| 21 | + dkeyboard.h |
| 22 | + ${CMAKE_SOURCE_DIR}/src/global.h |
| 23 | + ${CMAKE_SOURCE_DIR}/src/vtablehook.h |
| 24 | + ) |
| 25 | + set(GLOBAL_SOURCES |
| 26 | + dwaylandshellmanager.cpp |
| 27 | + dkeyboard.cpp |
| 28 | + ${CMAKE_SOURCE_DIR}/src/global.cpp |
| 29 | + ${CMAKE_SOURCE_DIR}/src/vtablehook.cpp |
| 30 | + ) |
| 31 | +else() |
| 32 | + message(WARNING "QtWayland version incompatible") |
| 33 | +endif() |
| 34 | + |
| 35 | +set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin/plugins/wayland-shell-integration) |
| 36 | + |
| 37 | +add_library(${PROJECT_NAME} MODULE main.cpp ${GLOBAL_SOURCES} ${GLOBAL_HEADERS}) |
| 38 | + |
| 39 | +target_compile_definitions(${PROJECT_NAME} |
| 40 | + PRIVATE |
| 41 | + QT5DWAYLANDPLUGIN_LIBRARY |
| 42 | + QT_DEPRECATED_WARNINGS |
| 43 | +) |
| 44 | + |
| 45 | +if(DEEPIN_KWIN_TEST_COMPILE_RESULT) |
| 46 | + target_compile_definitions(${PROJECT_NAME} PRIVATE D_DEEPIN_KWIN) |
| 47 | +endif() |
| 48 | + |
| 49 | +target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/src) |
| 50 | + |
| 51 | +list(APPEND COMMON_LIBS |
| 52 | + Qt5::Core |
| 53 | + Qt5::Gui |
| 54 | + Qt5::GuiPrivate |
| 55 | + Qt5::Widgets |
| 56 | + Qt5::WidgetsPrivate |
| 57 | + Qt5::WaylandClient |
| 58 | + Qt5::WaylandClientPrivate |
| 59 | + Qt5::XkbCommonSupportPrivate |
| 60 | +) |
| 61 | +target_link_libraries(${PROJECT_NAME} ${COMMON_LIBS}) |
| 62 | + |
| 63 | +if(NOT INSTALL_PATH) |
| 64 | + set(INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}/qt5/plugins/wayland-shell-integration) |
| 65 | +endif() |
| 66 | +install(TARGETS ${PROJECT_NAME} DESTINATION ${INSTALL_PATH}) |
0 commit comments