Skip to content

Commit 22503fa

Browse files
committed
refactor: unify DTK5/DTK6 build system
1. Replaced PROJECT_VERSION_MAJOR-based Qt version detection with explicit DTK5/DTK6 build option 2. Added DTK5 CMake option (default ON) to control DTK5 vs DTK6 builds 3. Updated DTK_VERSION calculation to use DTK_VERSION_MAJOR from build option instead of PROJECT_VERSION_MAJOR 4. Modified CMake logic to conditionally build wayland plugin only for DTK5 builds 5. Restructured debian/control to support both DTK5 and DTK6 packages with Build-Profiles 6. Added new dde-qt6xcb-plugin package for DTK6 builds 7. Implemented separate build directories (build-dtk5, build-dtk6) in debian/rules for parallel builds 8. Added build profile support (nodtk5, nodtk6) to control which packages are built 9. Updated package descriptions to clearly indicate DTK5/Qt5 vs DTK6/ Qt6 versions Log: Updated build system to support both DTK5 and DTK6 versions Influence: 1. Test building with default settings (DTK5=ON) to ensure DTK5 builds work 2. Test building with DTK5=OFF to verify DTK6 builds work correctly 3. Verify that wayland plugin is only built for DTK5 builds 4. Test package generation with different build profiles (nodtk5, nodtk6) 5. Verify that both dde-qt5xcb-plugin and dde-qt6xcb-plugin packages are created correctly 6. Test installation of both DTK5 and DTK6 packages on appropriate systems 7. Verify plugin paths are correct (Qt5 vs Qt6 plugin directories) refactor: 统一DTK5/DTK6构建系统 1. 将基于PROJECT_VERSION_MAJOR的Qt版本检测改为显式的DTK5/DTK6构建选项 2. 添加DTK5 CMake选项(默认开启)来控制DTK5与DTK6构建 3. 更新DTK_VERSION计算,使用构建选项中的DTK_VERSION_MAJOR而非 PROJECT_VERSION_MAJOR 4. 修改CMake逻辑,仅对DTK5构建有条件地构建wayland插件 5. 重构debian/control以支持带有Build-Profiles的DTK5和DTK6包 6. 为DTK6构建添加新的dde-qt6xcb-plugin包 7. 在debian/rules中实现独立的构建目录(build-dtk5, build-dtk6)用于并行 构建 8. 添加构建配置文件支持(nodtk5, nodtk6)来控制构建哪些包 9. 更新包描述以清晰标明DTK5/Qt5与DTK6/Qt6版本 Log: 更新构建系统以支持DTK5和DTK6版本 Influence: 1. 使用默认设置(DTK5=ON)测试构建,确保DTK5构建正常工作 2. 使用DTK5=OFF测试构建,验证DTK6构建正确工作 3. 验证wayland插件仅对DTK5构建进行构建 4. 使用不同的构建配置文件(nodtk5, nodtk6)测试包生成 5. 验证dde-qt5xcb-plugin和dde-qt6xcb-plugin包都正确创建 6. 在适当的系统上测试DTK5和DTK6包的安装 7. 验证插件路径正确(Qt5与Qt6插件目录)
1 parent da1e171 commit 22503fa

File tree

5 files changed

+129
-29
lines changed

5 files changed

+129
-29
lines changed

CMakeLists.txt

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44

55
cmake_minimum_required(VERSION 3.13)
66

7-
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" DTK_FILE_VERSION)
8-
string(STRIP "${DTK_FILE_VERSION}" DTK_FILE_VERSION)
9-
set(DTK_VERSION "${DTK_FILE_VERSION}" CACHE STRING "define project version")
7+
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" FILE_VERSION)
8+
string(STRIP "${FILE_VERSION}" FILE_VERSION)
109

1110
project(qt5platform-plugins
12-
VERSION ${DTK_VERSION}
11+
VERSION ${FILE_VERSION}
1312
DESCRIPTION "DTK platform plugin module"
1413
HOMEPAGE_URL "https://github.com/linuxdeepin/qt5platform-plugins"
1514
LANGUAGES CXX C
@@ -22,15 +21,21 @@ endif ()
2221
include(GNUInstallDirs)
2322
include(CMakePackageConfigHelpers)
2423

25-
if("${PROJECT_VERSION_MAJOR}" STREQUAL "5")
26-
set(QT_VERSION_MAJOR "5")
27-
elseif("${PROJECT_VERSION_MAJOR}" STREQUAL "6")
28-
set(QT_VERSION_MAJOR "6")
29-
set(DTK_VERSION_MAJOR "6")
24+
# 引入 DTK5/DTK6 构建选项
25+
option(DTK5 "Build DTK5." ON)
26+
if(DTK5)
27+
set(DTK_VERSION_MAJOR "5")
3028
else()
31-
message(SEND_ERROR "not support Prject Version ${PROJECT_VERSION}.")
29+
set(DTK_VERSION_MAJOR "6")
3230
endif()
33-
message(${PROJECT_VERSION_MAJOR})
31+
32+
set(DTK_VERSION_MINOR ${PROJECT_VERSION_MINOR})
33+
set(DTK_VERSION_PATCH ${PROJECT_VERSION_PATCH})
34+
set(DTK_VERSION "${DTK_VERSION_MAJOR}.${DTK_VERSION_MINOR}.${DTK_VERSION_PATCH}")
35+
# 官方约定:DTK5 使用 Qt5,DTK6 使用 Qt6
36+
set(QT_VERSION_MAJOR ${DTK_VERSION_MAJOR})
37+
38+
message(STATUS "Building DTK${DTK_VERSION_MAJOR} (Qt${QT_VERSION_MAJOR}) version: ${DTK_VERSION}")
3439

3540
set(CMAKE_INCLUDE_CURRENT_DIR ON)
3641
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
@@ -48,11 +53,10 @@ endif ()
4853
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/plugins/platforms)
4954

5055
add_subdirectory(xcb)
51-
if("${PROJECT_VERSION_MAJOR}" STREQUAL "5")
56+
if(DTK5)
5257
add_subdirectory(wayland)
5358
endif()
5459
if(BUILD_TESTING)
5560
enable_testing()
5661
add_subdirectory(tests)
5762
endif()
58-
message(${PROJECT_VERSION_MAJOR})

debian/control

Lines changed: 52 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,47 @@
11
Source: dde-qt5platform-plugins
22
Section: devel
33
Priority: optional
4-
Maintainer: Deepin Packages Builder <[email protected]>
5-
Build-Depends: debhelper (>=9), qtbase5-dev, qtbase5-private-dev,
6-
pkg-config, libqt5x11extras5-dev, libxcb-xkb-dev, libxcb-render-util0-dev,
7-
libxcb-image0-dev, libxcb-icccm4-dev, libxcb-keysyms1-dev, libegl1-mesa-dev,
8-
libmtdev-dev, libxkbcommon-x11-dev, libdbus-1-dev, libqt5opengl5-dev,
9-
libudev-dev, libxrender-dev,libxi-dev, libsm-dev, libxcb-xinerama0-dev,
10-
libfontconfig1-dev, libglib2.0-dev, libxcb-damage0-dev,
11-
libxcb-composite0-dev, libcairo2-dev, libkf5wayland-dev, libdwayland-dev,
12-
qtwayland5-private-dev | libqt5waylandclient5-dev,
13-
libwayland-dev, libxcb-xinput-dev, libxcb-util-dev | libxcb-util0-dev,
14-
libx11-xcb-dev, libxcb-sync-dev, libxcb-randr0-dev, cmake, libgtest-dev, libgmock-dev, libdtkcommon-dev(>=5.6.16)
4+
Maintainer: Shanshan Ye <[email protected]>
5+
Build-Depends: debhelper (>=9),
6+
cmake,
7+
pkg-config,
8+
libgtest-dev,
9+
libgmock-dev,
10+
libdtkcommon-dev(>=5.6.16),
11+
qtbase5-dev <!nodtk5>,
12+
qtbase5-private-dev <!nodtk5>,
13+
libqt5x11extras5-dev <!nodtk5>,
14+
libqt5opengl5-dev <!nodtk5>,
15+
qtwayland5-private-dev | libqt5waylandclient5-dev <!nodtk5>,
16+
qt6-base-dev <!nodtk6>,
17+
qt6-base-private-dev <!nodtk6>,
18+
libxcb-xkb-dev,
19+
libxcb-render-util0-dev,
20+
libxcb-image0-dev,
21+
libxcb-icccm4-dev,
22+
libxcb-keysyms1-dev,
23+
libegl1-mesa-dev,
24+
libmtdev-dev,
25+
libxkbcommon-x11-dev,
26+
libdbus-1-dev,
27+
libudev-dev,
28+
libxrender-dev,
29+
libxi-dev,
30+
libsm-dev,
31+
libxcb-xinerama0-dev,
32+
libfontconfig1-dev,
33+
libglib2.0-dev,
34+
libxcb-damage0-dev,
35+
libxcb-composite0-dev,
36+
libcairo2-dev,
37+
libkf5wayland-dev <!nodtk5>,
38+
libdwayland-dev <!nodtk5>,
39+
libwayland-dev,
40+
libxcb-xinput-dev,
41+
libxcb-util-dev | libxcb-util0-dev,
42+
libx11-xcb-dev,
43+
libxcb-sync-dev,
44+
libxcb-randr0-dev
1545
Standards-Version: 3.9.8
1646

1747
Package: dde-qt5xcb-plugin
@@ -21,11 +51,20 @@ Conflicts: libqt5dxcb-plugin, qt5dxcb-plugin
2151
Breaks:dde-qt5integration (<< 0.2.8.1)
2252
Replaces: qt5dxcb-plugin
2353
Depends: ${shlibs:Depends}, ${misc:Depends}
24-
Description: Qt platform plugins
54+
Build-Profiles: <!nodtk5>
55+
Description: Qt platform plugins (DTK5 with Qt5)
2556
Qt platform plugins for DDE.
2657

2758
Package: dde-qt5wayland-plugin
2859
Architecture: any
2960
Depends: ${shlibs:Depends}, ${misc:Depends}, qtwayland5
30-
Description: Qt platform plugins
61+
Build-Profiles: <!nodtk5>
62+
Description: Qt platform plugins (DTK5 with Qt5)
3163
Qt platform plugins for DDE.
64+
65+
Package: dde-qt6xcb-plugin
66+
Architecture: any
67+
Depends: ${shlibs:Depends}, ${misc:Depends}
68+
Build-Profiles: <!nodtk6>
69+
Description: Qt platform plugins (DTK6 with Qt6)
70+
Qt platform plugins for DDE (Qt6 version).

debian/dde-qt6xcb-plugin.install

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
usr/lib/*/qt6/plugins/platforms/libdxcb.so

debian/rules

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,64 @@
11
#!/usr/bin/make -f
2+
DPKG_EXPORT_BUILDFLAGS = 1
3+
include /usr/share/dpkg/default.mk
24

35
# 安全编译参数
46
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
57
export DEB_CFLAGS_MAINT_APPEND = -Wall
68
export DEB_CXXFLAGS_MAINT_APPEND = -Wall
79
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wl,-E
810

11+
# Build-Profiles 控制
12+
BUILD_DTK5 := $(if $(filter nodtk5,$(DEB_BUILD_PROFILES)),OFF,ON)
13+
BUILD_DTK6 := $(if $(filter nodtk6,$(DEB_BUILD_PROFILES)),OFF,ON)
14+
915
%:
10-
dh $@
16+
dh $@
17+
18+
override_dh_auto_configure:
19+
ifeq ($(BUILD_DTK5),ON)
20+
mkdir -p build5
21+
QT_SELECT=qt5 dh_auto_configure --builddirectory=build5 -- \
22+
$(DEB_CMAKE_EXTRA_FLAGS) \
23+
-DBUILD_TESTING=OFF \
24+
-DDTK5=ON
25+
endif
26+
ifeq ($(BUILD_DTK6),ON)
27+
mkdir -p build6
28+
dh_auto_configure --builddirectory=build6 -- \
29+
$(DEB_CMAKE_EXTRA_FLAGS) \
30+
-DBUILD_TESTING=OFF \
31+
-DDTK5=OFF
32+
endif
33+
34+
override_dh_auto_build:
35+
ifeq ($(BUILD_DTK5),ON)
36+
QT_SELECT=qt5 dh_auto_build --builddirectory=build5
37+
endif
38+
ifeq ($(BUILD_DTK6),ON)
39+
dh_auto_build --builddirectory=build6
40+
endif
41+
42+
override_dh_auto_install:
43+
ifeq ($(BUILD_DTK5),ON)
44+
QT_SELECT=qt5 dh_auto_install --builddirectory=build5
45+
endif
46+
ifeq ($(BUILD_DTK6),ON)
47+
dh_auto_install --builddirectory=build6
48+
endif
49+
50+
override_dh_auto_test:
51+
ifeq ($(BUILD_DTK5),ON)
52+
QT_SELECT=qt5 dh_auto_test --builddirectory=build5
53+
endif
54+
ifeq ($(BUILD_DTK6),ON)
55+
dh_auto_test --builddirectory=build6
56+
endif
1157

1258
override_dh_shlibdeps:
1359
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
60+
61+
override_dh_auto_clean:
62+
dh_auto_clean --builddirectory=build5
63+
dh_auto_clean --builddirectory=build6
64+
rm -rf build5 build6

tests/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ include(${CMAKE_SOURCE_DIR}/xcb/linux.cmake)
2626

2727
add_definitions(-DPLUGIN_OUTPUT_PATH=\"${LIBRARY_OUTPUT_PATH}/..\")
2828

29-
target_compile_options(${PROJECT_NAME} PRIVATE -fno-access-control -fsanitize=address)
30-
target_link_options(${PROJECT_NAME} PRIVATE -fsanitize=address)
29+
target_compile_options(${PROJECT_NAME} PRIVATE -fno-access-control)
30+
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
31+
target_compile_options(${PROJECT_NAME} PRIVATE -fsanitize=address)
32+
target_link_options(${PROJECT_NAME} PRIVATE -fsanitize=address)
33+
endif ()
3134
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
3235
target_compile_options(${PROJECT_NAME} PRIVATE -fprofile-instr-generate -ftest-coverage)
3336
endif()
@@ -68,3 +71,5 @@ if(${QT_VERSION_MAJOR} STREQUAL "5")
6871
else()
6972
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::OpenGL Qt6::OpenGLPrivate Qt6::XcbQpaPrivate)
7073
endif()
74+
75+
add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME})

0 commit comments

Comments
 (0)