Skip to content

Commit

Permalink
chore: change qmake to cmake (linuxdeepin#185)
Browse files Browse the repository at this point in the history
* chore: change qmake to cmake

change qmake project to cmake project

Log: change qmake to cmake

* chore(debian): add the kf5wayland-dev depend in control file

To resolve the issue that Imported target "Deepin::WaylandClient"
includes non-existent path /usr/include/KF5 in its INTERFACE_INCLUDE_DIRECTORIES.

Log: add the kf5wayland-dev depend in control file

---------

Co-authored-by: wangfei <[email protected]>
  • Loading branch information
FeiWang1119 and wangfei authored Jun 13, 2023
1 parent fd191f4 commit 6acff43
Show file tree
Hide file tree
Showing 23 changed files with 404 additions and 443 deletions.
31 changes: 31 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
#
# SPDX-License-Identifier: LGPL-3.0-or-later

cmake_minimum_required(VERSION 3.10)

set(VERSION
"5.6.8"
CACHE STRING "define project version"
)

project(qt5platform-plugins
VERSION ${VERSION}
DESCRIPTION "DTK platform plugin module"
HOMEPAGE_URL "https://github.com/linuxdeepin/qt5platform-plugins"
LANGUAGES CXX C
)

include(GNUInstallDirs)
include(CMakePackageConfigHelpers)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(REQUIRED_QT_VERSION 5.15.0)

add_subdirectory(xcb)
add_subdirectory(wayland)
20 changes: 6 additions & 14 deletions archlinux/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,14 @@ groups=('deepin-git')
source=("${sourcetars[@]}")
sha512sums=('SKIP')

prepare() {
cd $sourcedir

rm -r xcb/libqt5xcbqpa-dev wayland/qtwayland-dev
# Disable wayland for now: https://github.com/linuxdeepin/qt5platform-plugins/issues/47
sed -i '/wayland/d' qt5platform-plugins.pro
sed -i 's|error(Not support Qt Version: .*)|INCLUDEPATH += /usr/include/qtxcb-private|' xcb/linux.pri
sed -i "/qtwayland-dev/a /usr/include/qt/QtWaylandClient/$(expac %v qt5-wayland | cut -d - -f 1) /usr/include/qt/QtXkbCommonSupport/$(expac %v qt5-base | cut -d - -f 1) \\\\" wayland/wayland.pro
# https://github.com/linuxdeepin/qt5platform-plugins/pull/48
sed -i 's/xcbWindow-/window-/' xcb/windoweventhook.cpp
}

build() {
cd $sourcedir
qmake-qt5 PREFIX=/usr QT_XCB_PRIVATE_INCLUDE=/usr/include/qtxcb-private
make
cmake . -GNinja \
-DMKSPECS_INSTALL_DIR=lib/qt/mkspecs/modules/\
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release
ninja
}

package() {
Expand Down
4 changes: 2 additions & 2 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ Build-Depends: debhelper (>=9), qtbase5-dev, qtbase5-private-dev,
libmtdev-dev, libxkbcommon-x11-dev, libdbus-1-dev, libqt5opengl5-dev,
libudev-dev, libxrender-dev,libxi-dev, libsm-dev, libxcb-xinerama0-dev,
libfontconfig1-dev, libfreetype6-dev, libglib2.0-dev, libxcb-damage0-dev,
libxcb-composite0-dev, libcairo2-dev, libdwayland-dev | libkf5wayland-dev,
libxcb-composite0-dev, libcairo2-dev, libkf5wayland-dev, libdwayland-dev,
qtwayland5-private-dev | libqt5waylandclient5-dev,
libwayland-dev, libxcb-xinput-dev, libxcb-util-dev | libxcb-util0-dev,
libx11-xcb-dev, libxcb-sync-dev, libxcb-randr0-dev
libx11-xcb-dev, libxcb-sync-dev, libxcb-randr0-dev, cmake
Standards-Version: 3.9.8

Package: dde-qt5xcb-plugin
Expand Down
9 changes: 0 additions & 9 deletions qt5platform-plugins.pro

This file was deleted.

32 changes: 32 additions & 0 deletions src/src.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
#
# SPDX-License-Identifier: LGPL-3.0-or-later

list(APPEND GLOBAL_HEADERS
${CMAKE_CURRENT_LIST_DIR}/dbackingstoreproxy.h
${CMAKE_CURRENT_LIST_DIR}/dnativesettings.h
${CMAKE_CURRENT_LIST_DIR}/dopenglpaintdevice.h
${CMAKE_CURRENT_LIST_DIR}/dxcbxsettings.h
${CMAKE_CURRENT_LIST_DIR}/global.h
${CMAKE_CURRENT_LIST_DIR}/vtablehook.h
${CMAKE_CURRENT_LIST_DIR}/dplatformsettings.h
${CMAKE_CURRENT_LIST_DIR}/ddesktopinputselectioncontrol.h
${CMAKE_CURRENT_LIST_DIR}/dinputselectionhandle.h
${CMAKE_CURRENT_LIST_DIR}/dapplicationeventmonitor.h
${CMAKE_CURRENT_LIST_DIR}/dselectedtexttooltip.h
)
list(APPEND GLOBAL_SOURCES
${CMAKE_CURRENT_LIST_DIR}/dbackingstoreproxy.cpp
${CMAKE_CURRENT_LIST_DIR}/dnativesettings.cpp
${CMAKE_CURRENT_LIST_DIR}/dopenglpaintdevice.cpp
${CMAKE_CURRENT_LIST_DIR}/dxcbxsettings.cpp
${CMAKE_CURRENT_LIST_DIR}/global.cpp
${CMAKE_CURRENT_LIST_DIR}/vtablehook.cpp
${CMAKE_CURRENT_LIST_DIR}/dplatformsettings.cpp
${CMAKE_CURRENT_LIST_DIR}/ddesktopinputselectioncontrol.cpp
${CMAKE_CURRENT_LIST_DIR}/dinputselectionhandle.cpp
${CMAKE_CURRENT_LIST_DIR}/dapplicationeventmonitor.cpp
${CMAKE_CURRENT_LIST_DIR}/dselectedtexttooltip.cpp
)

include_directories(${CMAKE_CURRENT_LIST_DIR})
6 changes: 6 additions & 0 deletions wayland/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
#
# SPDX-License-Identifier: LGPL-3.0-or-later

add_subdirectory(dwayland)
add_subdirectory(wayland-shell)
54 changes: 54 additions & 0 deletions wayland/dwayland/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
#
# SPDX-License-Identifier: LGPL-3.0-or-later

project(dwayland)

find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core Gui WaylandClient XkbCommonSupport)

add_definitions(-DQT5DWAYLANDPLUGIN_LIBRARY -DQT_DEPRECATED_WARNINGS)

file(GLOB GLOBAL_HEADERS
${CMAKE_CURRENT_LIST_DIR}/*.h
${CMAKE_SOURCE_DIR}/src/global.h
${CMAKE_SOURCE_DIR}/src/vtablehook.h
${CMAKE_SOURCE_DIR}/src/dxcbxsettings.h
${CMAKE_SOURCE_DIR}/src/dplatformsettings.h
${CMAKE_SOURCE_DIR}/src/dnativesettings.h
)
file(GLOB GLOBAL_SOURCES
${CMAKE_CURRENT_LIST_DIR}/*.cpp
${CMAKE_SOURCE_DIR}/src/global.cpp
${CMAKE_SOURCE_DIR}/src/vtablehook.cpp
${CMAKE_SOURCE_DIR}/src/dxcbxsettings.cpp
${CMAKE_SOURCE_DIR}/src/dplatformsettings.cpp
${CMAKE_SOURCE_DIR}/src/dnativesettings.cpp
)

set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin/plugins/platforms)

add_library(${PROJECT_NAME} MODULE main.cpp ${GLOBAL_SOURCES} ${GLOBAL_HEADERS})

target_compile_definitions(${PROJECT_NAME}
PRIVATE
QT5DWAYLANDPLUGIN_LIBRARY
QT_DEPRECATED_WARNINGS
)

target_include_directories(${PROJECT_NAME}
PRIVATE
${CMAKE_SOURCE_DIR}/src
)

target_link_libraries(${PROJECT_NAME}
PRIVATE
Qt5::Core
Qt5::GuiPrivate
Qt5::XkbCommonSupportPrivate
Qt5::WaylandClientPrivate
)

if(NOT INSTALL_PATH)
set(INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}/qt5/plugins/platforms)
endif()
install(TARGETS ${PROJECT_NAME} DESTINATION ${INSTALL_PATH})
78 changes: 0 additions & 78 deletions wayland/dwayland/dwayland.pro

This file was deleted.

66 changes: 66 additions & 0 deletions wayland/wayland-shell/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
#
# SPDX-License-Identifier: LGPL-3.0-or-later

project(kwayland-shell)

find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core Gui Widgets XkbCommonSupport WaylandClient)

include(wayland-shell.cmake)

try_compile(DEEPIN_KWIN_TEST_COMPILE_RESULT ${CMAKE_CURRENT_BINARY_DIR}/deepin-kwin-test
${CMAKE_CURRENT_LIST_DIR}/config.tests/deepin-kwin-test deepin-kwin-test)

try_compile(WAYLAND_TEST_COMPILE_RESULT ${CMAKE_CURRENT_BINARY_DIR}/wayland_test
${CMAKE_CURRENT_LIST_DIR}/config.tests/wayland_test wayland_test)

if(WAYLAND_TEST_COMPILE_RESULT)
add_definitions(-DUSE_DEEPIN_WAYLAND)
set(GLOBAL_HEADERS
dwaylandshellmanager.h
dkeyboard.h
${CMAKE_SOURCE_DIR}/src/global.h
${CMAKE_SOURCE_DIR}/src/vtablehook.h
)
set(GLOBAL_SOURCES
dwaylandshellmanager.cpp
dkeyboard.cpp
${CMAKE_SOURCE_DIR}/src/global.cpp
${CMAKE_SOURCE_DIR}/src/vtablehook.cpp
)
else()
message(WARNING "QtWayland version incompatible")
endif()

set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin/plugins/wayland-shell-integration)

add_library(${PROJECT_NAME} MODULE main.cpp ${GLOBAL_SOURCES} ${GLOBAL_HEADERS})

target_compile_definitions(${PROJECT_NAME}
PRIVATE
QT5DWAYLANDPLUGIN_LIBRARY
QT_DEPRECATED_WARNINGS
)

if(DEEPIN_KWIN_TEST_COMPILE_RESULT)
target_compile_definitions(${PROJECT_NAME} PRIVATE D_DEEPIN_KWIN)
endif()

target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/src)

list(APPEND COMMON_LIBS
Qt5::Core
Qt5::Gui
Qt5::GuiPrivate
Qt5::Widgets
Qt5::WidgetsPrivate
Qt5::WaylandClient
Qt5::WaylandClientPrivate
Qt5::XkbCommonSupportPrivate
)
target_link_libraries(${PROJECT_NAME} ${COMMON_LIBS})

if(NOT INSTALL_PATH)
set(INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}/qt5/plugins/wayland-shell-integration)
endif()
install(TARGETS ${PROJECT_NAME} DESTINATION ${INSTALL_PATH})
29 changes: 29 additions & 0 deletions wayland/wayland-shell/config.tests/deepin-kwin-test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
#
# SPDX-License-Identifier: LGPL-3.0-or-later

cmake_minimum_required(VERSION 3.10)

project(deepin-kwin-test)

set(REQUIRED_QT_VERSION 5.15.0)
find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS WaylandClient)

include(../../wayland-shell.cmake)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(AUTOMOC_COMPILER_PREDEFINES ON)

add_executable(${PROJECT_NAME} main.cpp)

list(APPEND COMMON_LIBS
Qt5::WaylandClientPrivate
)
target_link_libraries(${PROJECT_NAME} PUBLIC ${COMMON_LIBS})

target_include_directories(${PROJECT_NAME} PUBLIC
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_SOURCE_DIR}
)

This file was deleted.

33 changes: 33 additions & 0 deletions wayland/wayland-shell/config.tests/wayland_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
#
# SPDX-License-Identifier: LGPL-3.0-or-later

cmake_minimum_required(VERSION 3.10)

project(wayland_test)

set(REQUIRED_QT_VERSION 5.15.0)
find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core Gui WaylandClient XkbCommonSupport)

include(../../wayland-shell.cmake)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(AUTOMOC_COMPILER_PREDEFINES ON)

add_executable(${PROJECT_NAME} main.cpp)

list(APPEND COMMON_LIBS
Qt5::Core
Qt5::CorePrivate
Qt5::GuiPrivate
Qt5::WaylandClientPrivate
Qt5::XkbCommonSupportPrivate
)
target_link_libraries(${PROJECT_NAME} PUBLIC ${COMMON_LIBS})

target_include_directories(${PROJECT_NAME} PUBLIC
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_SOURCE_DIR}
)
Loading

0 comments on commit 6acff43

Please sign in to comment.