Skip to content

Commit 6acff43

Browse files
FeiWang1119wangfei
andauthored
chore: change qmake to cmake (linuxdeepin#185)
* 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]>
1 parent fd191f4 commit 6acff43

23 files changed

+404
-443
lines changed

CMakeLists.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2+
#
3+
# SPDX-License-Identifier: LGPL-3.0-or-later
4+
5+
cmake_minimum_required(VERSION 3.10)
6+
7+
set(VERSION
8+
"5.6.8"
9+
CACHE STRING "define project version"
10+
)
11+
12+
project(qt5platform-plugins
13+
VERSION ${VERSION}
14+
DESCRIPTION "DTK platform plugin module"
15+
HOMEPAGE_URL "https://github.com/linuxdeepin/qt5platform-plugins"
16+
LANGUAGES CXX C
17+
)
18+
19+
include(GNUInstallDirs)
20+
include(CMakePackageConfigHelpers)
21+
22+
set(CMAKE_INCLUDE_CURRENT_DIR ON)
23+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
24+
set(CMAKE_AUTOMOC ON)
25+
set(CMAKE_AUTORCC ON)
26+
set(CMAKE_CXX_STANDARD 11)
27+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
28+
set(REQUIRED_QT_VERSION 5.15.0)
29+
30+
add_subdirectory(xcb)
31+
add_subdirectory(wayland)

archlinux/PKGBUILD

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,14 @@ groups=('deepin-git')
1717
source=("${sourcetars[@]}")
1818
sha512sums=('SKIP')
1919

20-
prepare() {
21-
cd $sourcedir
22-
23-
rm -r xcb/libqt5xcbqpa-dev wayland/qtwayland-dev
24-
# Disable wayland for now: https://github.com/linuxdeepin/qt5platform-plugins/issues/47
25-
sed -i '/wayland/d' qt5platform-plugins.pro
26-
sed -i 's|error(Not support Qt Version: .*)|INCLUDEPATH += /usr/include/qtxcb-private|' xcb/linux.pri
27-
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
28-
# https://github.com/linuxdeepin/qt5platform-plugins/pull/48
29-
sed -i 's/xcbWindow-/window-/' xcb/windoweventhook.cpp
30-
}
31-
3220
build() {
3321
cd $sourcedir
34-
qmake-qt5 PREFIX=/usr QT_XCB_PRIVATE_INCLUDE=/usr/include/qtxcb-private
35-
make
22+
cmake . -GNinja \
23+
-DMKSPECS_INSTALL_DIR=lib/qt/mkspecs/modules/\
24+
-DCMAKE_INSTALL_LIBDIR=lib \
25+
-DCMAKE_INSTALL_PREFIX=/usr \
26+
-DCMAKE_BUILD_TYPE=Release
27+
ninja
3628
}
3729

3830
package() {

debian/control

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ Build-Depends: debhelper (>=9), qtbase5-dev, qtbase5-private-dev,
88
libmtdev-dev, libxkbcommon-x11-dev, libdbus-1-dev, libqt5opengl5-dev,
99
libudev-dev, libxrender-dev,libxi-dev, libsm-dev, libxcb-xinerama0-dev,
1010
libfontconfig1-dev, libfreetype6-dev, libglib2.0-dev, libxcb-damage0-dev,
11-
libxcb-composite0-dev, libcairo2-dev, libdwayland-dev | libkf5wayland-dev,
11+
libxcb-composite0-dev, libcairo2-dev, libkf5wayland-dev, libdwayland-dev,
1212
qtwayland5-private-dev | libqt5waylandclient5-dev,
1313
libwayland-dev, libxcb-xinput-dev, libxcb-util-dev | libxcb-util0-dev,
14-
libx11-xcb-dev, libxcb-sync-dev, libxcb-randr0-dev
14+
libx11-xcb-dev, libxcb-sync-dev, libxcb-randr0-dev, cmake
1515
Standards-Version: 3.9.8
1616

1717
Package: dde-qt5xcb-plugin

qt5platform-plugins.pro

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/src.cmake

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2+
#
3+
# SPDX-License-Identifier: LGPL-3.0-or-later
4+
5+
list(APPEND GLOBAL_HEADERS
6+
${CMAKE_CURRENT_LIST_DIR}/dbackingstoreproxy.h
7+
${CMAKE_CURRENT_LIST_DIR}/dnativesettings.h
8+
${CMAKE_CURRENT_LIST_DIR}/dopenglpaintdevice.h
9+
${CMAKE_CURRENT_LIST_DIR}/dxcbxsettings.h
10+
${CMAKE_CURRENT_LIST_DIR}/global.h
11+
${CMAKE_CURRENT_LIST_DIR}/vtablehook.h
12+
${CMAKE_CURRENT_LIST_DIR}/dplatformsettings.h
13+
${CMAKE_CURRENT_LIST_DIR}/ddesktopinputselectioncontrol.h
14+
${CMAKE_CURRENT_LIST_DIR}/dinputselectionhandle.h
15+
${CMAKE_CURRENT_LIST_DIR}/dapplicationeventmonitor.h
16+
${CMAKE_CURRENT_LIST_DIR}/dselectedtexttooltip.h
17+
)
18+
list(APPEND GLOBAL_SOURCES
19+
${CMAKE_CURRENT_LIST_DIR}/dbackingstoreproxy.cpp
20+
${CMAKE_CURRENT_LIST_DIR}/dnativesettings.cpp
21+
${CMAKE_CURRENT_LIST_DIR}/dopenglpaintdevice.cpp
22+
${CMAKE_CURRENT_LIST_DIR}/dxcbxsettings.cpp
23+
${CMAKE_CURRENT_LIST_DIR}/global.cpp
24+
${CMAKE_CURRENT_LIST_DIR}/vtablehook.cpp
25+
${CMAKE_CURRENT_LIST_DIR}/dplatformsettings.cpp
26+
${CMAKE_CURRENT_LIST_DIR}/ddesktopinputselectioncontrol.cpp
27+
${CMAKE_CURRENT_LIST_DIR}/dinputselectionhandle.cpp
28+
${CMAKE_CURRENT_LIST_DIR}/dapplicationeventmonitor.cpp
29+
${CMAKE_CURRENT_LIST_DIR}/dselectedtexttooltip.cpp
30+
)
31+
32+
include_directories(${CMAKE_CURRENT_LIST_DIR})

wayland/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2+
#
3+
# SPDX-License-Identifier: LGPL-3.0-or-later
4+
5+
add_subdirectory(dwayland)
6+
add_subdirectory(wayland-shell)

wayland/dwayland/CMakeLists.txt

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2+
#
3+
# SPDX-License-Identifier: LGPL-3.0-or-later
4+
5+
project(dwayland)
6+
7+
find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core Gui WaylandClient XkbCommonSupport)
8+
9+
add_definitions(-DQT5DWAYLANDPLUGIN_LIBRARY -DQT_DEPRECATED_WARNINGS)
10+
11+
file(GLOB GLOBAL_HEADERS
12+
${CMAKE_CURRENT_LIST_DIR}/*.h
13+
${CMAKE_SOURCE_DIR}/src/global.h
14+
${CMAKE_SOURCE_DIR}/src/vtablehook.h
15+
${CMAKE_SOURCE_DIR}/src/dxcbxsettings.h
16+
${CMAKE_SOURCE_DIR}/src/dplatformsettings.h
17+
${CMAKE_SOURCE_DIR}/src/dnativesettings.h
18+
)
19+
file(GLOB GLOBAL_SOURCES
20+
${CMAKE_CURRENT_LIST_DIR}/*.cpp
21+
${CMAKE_SOURCE_DIR}/src/global.cpp
22+
${CMAKE_SOURCE_DIR}/src/vtablehook.cpp
23+
${CMAKE_SOURCE_DIR}/src/dxcbxsettings.cpp
24+
${CMAKE_SOURCE_DIR}/src/dplatformsettings.cpp
25+
${CMAKE_SOURCE_DIR}/src/dnativesettings.cpp
26+
)
27+
28+
set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin/plugins/platforms)
29+
30+
add_library(${PROJECT_NAME} MODULE main.cpp ${GLOBAL_SOURCES} ${GLOBAL_HEADERS})
31+
32+
target_compile_definitions(${PROJECT_NAME}
33+
PRIVATE
34+
QT5DWAYLANDPLUGIN_LIBRARY
35+
QT_DEPRECATED_WARNINGS
36+
)
37+
38+
target_include_directories(${PROJECT_NAME}
39+
PRIVATE
40+
${CMAKE_SOURCE_DIR}/src
41+
)
42+
43+
target_link_libraries(${PROJECT_NAME}
44+
PRIVATE
45+
Qt5::Core
46+
Qt5::GuiPrivate
47+
Qt5::XkbCommonSupportPrivate
48+
Qt5::WaylandClientPrivate
49+
)
50+
51+
if(NOT INSTALL_PATH)
52+
set(INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}/qt5/plugins/platforms)
53+
endif()
54+
install(TARGETS ${PROJECT_NAME} DESTINATION ${INSTALL_PATH})

wayland/dwayland/dwayland.pro

Lines changed: 0 additions & 78 deletions
This file was deleted.

wayland/wayland-shell/CMakeLists.txt

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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})
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2+
#
3+
# SPDX-License-Identifier: LGPL-3.0-or-later
4+
5+
cmake_minimum_required(VERSION 3.10)
6+
7+
project(deepin-kwin-test)
8+
9+
set(REQUIRED_QT_VERSION 5.15.0)
10+
find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS WaylandClient)
11+
12+
include(../../wayland-shell.cmake)
13+
14+
set(CMAKE_AUTOMOC ON)
15+
set(CMAKE_AUTORCC ON)
16+
set(CMAKE_INCLUDE_CURRENT_DIR ON)
17+
set(AUTOMOC_COMPILER_PREDEFINES ON)
18+
19+
add_executable(${PROJECT_NAME} main.cpp)
20+
21+
list(APPEND COMMON_LIBS
22+
Qt5::WaylandClientPrivate
23+
)
24+
target_link_libraries(${PROJECT_NAME} PUBLIC ${COMMON_LIBS})
25+
26+
target_include_directories(${PROJECT_NAME} PUBLIC
27+
${CMAKE_CURRENT_BINARY_DIR}
28+
${CMAKE_SOURCE_DIR}
29+
)

0 commit comments

Comments
 (0)