Skip to content
Merged
Show file tree
Hide file tree
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
26 changes: 16 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
cmake_minimum_required(VERSION 3.25)

file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" DTK_FILE_VERSION)
string(STRIP "${DTK_FILE_VERSION}" DTK_FILE_VERSION)
set(DTK_VERSION "${DTK_FILE_VERSION}" CACHE STRING "define project version")
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" FILE_VERSION)
string(STRIP "${FILE_VERSION}" FILE_VERSION)

project(DtkGui
VERSION ${DTK_VERSION}
VERSION ${FILE_VERSION}
DESCRIPTION "DTK Gui module"
HOMEPAGE_URL "https://github.com/linuxdeepin/dtkgui"
LANGUAGES CXX C
)

if("${PROJECT_VERSION_MAJOR}" STREQUAL "5")
set(QT_VERSION_MAJOR "5")
elseif("${PROJECT_VERSION_MAJOR}" STREQUAL "6")
set(QT_VERSION_MAJOR "6")
set(DTK_VERSION_MAJOR "6")
# 引入 DTK5/DTK6 构建选项
option(DTK5 "Build DTK5." ON)
if(DTK5)
set(DTK_VERSION_MAJOR "5")
set(DTK_NAME_SUFFIX "") # DTK5 产品名称后缀为空
else()
message(SEND_ERROR "not support Prject Version ${PROJECT_VERSION}.")
set(DTK_VERSION_MAJOR "6")
set(DTK_NAME_SUFFIX "6") # DTK6 产品名称后缀为 "6"
endif()

set(DTK_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(DTK_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(DTK_VERSION "${DTK_VERSION_MAJOR}.${DTK_VERSION_MINOR}.${DTK_VERSION_PATCH}")
set(QT_VERSION_MAJOR ${DTK_VERSION_MAJOR})

include(dtkgui.cmake)
2 changes: 1 addition & 1 deletion archlinux/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ build() {
-DQCH_INSTALL_DESTINATION=share/doc/qt \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release
-DDTK5=ON
ninja
# INFO: Another cmake option is DTK_DISABLE_EX_IMAGE_FORMAT
# If you not want to support RAW images, set it to off
Expand Down
109 changes: 90 additions & 19 deletions debian/control
Original file line number Diff line number Diff line change
@@ -1,46 +1,117 @@
Source: dtkgui
Section: libdevel
Priority: optional
Maintainer: Deepin Packages Builder <packages@deepin.com>
Build-Depends: debhelper-compat (= 12), pkg-config,
qtbase5-private-dev, qtbase5-dev-tools, doxygen, graphviz, qttools5-dev,
libdtkcore-dev, librsvg2-dev, libfreeimage-dev, libraw-dev, libgtest-dev, libgmock-dev,
libqt5xdg-dev, libqt5xdgiconloader-dev, cmake, qt5-image-formats-plugins, libqt5waylandclient5-dev,
extra-cmake-modules, qtwayland5-dev-tools, qtwayland5-private-dev, libkf5wayland-dev, treeland-protocols
Maintainer: Shanshan Ye <yeshanshan@uniontech.com>
Build-Depends: debhelper-compat (= 12),
cmake,
pkg-config,
libgtest-dev,
libgmock-dev,
libdtkcommon-dev,
librsvg2-dev,
libfreeimage-dev,
libraw-dev,
treeland-protocols,
extra-cmake-modules,
libdtkcore-dev <!nodtk5>,
qtbase5-dev-tools <!nodtk5>,
qtbase5-private-dev <!nodtk5>,
qttools5-dev <!nodtk5>,
libqt5xdg-dev <!nodtk5>,
libqt5xdgiconloader-dev <!nodtk5>,
libqt5waylandclient5-dev <!nodtk5>,
qtwayland5-dev-tools <!nodtk5>,
qtwayland5-private-dev <!nodtk5>,
libkf5wayland-dev <!nodtk5>,
qt5-image-formats-plugins <!nodtk5>,
libdtk6core-dev <!nodtk6>,
qt6-base-dev-tools <!nodtk6>,
qt6-base-dev <!nodtk6>,
qt6-base-private-dev <!nodtk6>,
qt6-tools-dev <!nodtk6>,
qt6-wayland-dev-tools <!nodtk6>,
qt6-wayland-dev <!nodtk6>,
qt6-wayland-private-dev <!nodtk6>,
doxygen <!nodoc>,
graphviz <!nodoc>
Standards-Version: 3.9.8

Package: libdtk6gui
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libdtkdata,
qt6-image-formats-plugins
Multi-Arch: same
Build-Profiles: <!nodtk6>
Description: Development ToolKit Gui Library (DTK6 with Qt6)
DTK Gui is the base library of deepin Qt/C++ applications.
.
This package contains the shared libraries for DTK6 applications.

Package: libdtk6gui-bin
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends},
libdtk6gui( =${binary:Version})
Build-Profiles: <!nodtk6>
Description: Development ToolKit Gui Utilities (DTK6 with Qt6)
DTK Gui is the base library of deepin Qt/C++ applications.
.
This package contains the utilities of DTK6 Gui.

Package: libdtk6gui-dev
Architecture: any
Depends: libdtk6gui( =${binary:Version}),
libdtkcommon-dev(>=5.6.16), libdtk6core-dev
Build-Profiles: <!nodtk6>
Description: Development ToolKit Gui Devel Library (DTK6 with Qt6)
DTK Gui is the base library of deepin Qt/C++ applications.
.
This package contains the header files and development library symbolic links of DTK6 Gui.

Package: libdtk6gui-doc
Build-Profiles: <!nodtk6 !nodoc>
Architecture: any
Depends: ${misc:Depends}
Description: Development ToolKit Gui (Document)
DTK Gui is the base library of deepin Qt/C++ applications.
.
This package contains the qt Document of DTK6 Gui.

Package: libdtkgui5
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libdtkdata,
qt5-image-formats-plugins
Multi-Arch: same
Description: Deepin Tool Kit Gui library
DtkGui is base library of Deepin Qt/C++ applications.
Build-Profiles: <!nodtk5>
Description: Development ToolKit Gui Library (DTK5 with Qt5)
DTK Gui is the base library of deepin Qt/C++ applications.
.
This package contains the shared libraries.
This package contains the shared libraries for DTK5 applications.

Package: libdtkgui5-bin
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends},
libdtkgui5( =${binary:Version})
Description: Deepin Tool Kit Gui Utilities
DtkGui is base devel library of Deepin Qt/C++ applications.
Build-Profiles: <!nodtk5>
Description: Development ToolKit Gui Utilities (DTK5 with Qt5)
DTK Gui is the base library of deepin Qt/C++ applications.
.
This package contains the utilities of DtkGui
This package contains the utilities of DTK5 Gui.

Package: libdtkgui-dev
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libdtkgui5( =${binary:Version}), libdtkcommon-dev(>=5.6.16)
Description: Deepin Tool Kit Gui Devel library
DtkGui is base devel library of Deepin Qt/C++ applications.
Depends: libdtkgui5( =${binary:Version}),
libdtkcommon-dev(>=5.6.16), libdtkcore-dev
Build-Profiles: <!nodtk5>
Description: Development ToolKit Gui Devel Library (DTK5 with Qt5)
DTK Gui is the base library of deepin Qt/C++ applications.
.
This package contains the header files and static libraries of DtkGui
This package contains the header files and development library symbolic links of DTK5 Gui.

Package: libdtkgui-doc
Build-Profiles: <!nodoc>
Build-Profiles: <!nodtk5 !nodoc>
Architecture: any
Depends: ${misc:Depends}
Description: Deepin Tool Kit Gui (Document)
DtkGui is base devel library of Deepin Qt/C++ applications.
Description: Development ToolKit Gui (Document)
DTK Gui is the base library of deepin Qt/C++ applications.
.
This package contains the qt Document of DtkGui
1 change: 1 addition & 0 deletions debian/libdtk6gui-bin.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/libexec/dtk6/DGui/bin/*
5 changes: 5 additions & 0 deletions debian/libdtk6gui-dev.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
usr/lib/*/libdtk6gui.so
usr/include/dtk6/*
usr/lib/*/pkgconfig/dtk6gui.pc
usr/lib/*/cmake/Dtk6Gui/*
usr/lib/*/qt6/*
1 change: 1 addition & 0 deletions debian/libdtk6gui-doc.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/share/qt6/doc/dtkgui.qch
1 change: 1 addition & 0 deletions debian/libdtk6gui.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/lib/*/libdtk6gui.so.6*
8 changes: 4 additions & 4 deletions debian/libdtkgui-dev.install
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
usr/lib/*/lib*.so
usr/include
usr/lib/*/pkgconfig/*.pc
usr/lib/*/cmake/*/*.cmake
usr/lib/*/libdtkgui.so
usr/include/dtk5/*
usr/lib/*/pkgconfig/dtkgui.pc
usr/lib/*/cmake/DtkGui/*
usr/lib/*/qt5/*
2 changes: 1 addition & 1 deletion debian/libdtkgui5-bin.install
Original file line number Diff line number Diff line change
@@ -1 +1 @@
usr/*/*/DGui/bin/*
usr/libexec/dtk5/DGui/bin/*
3 changes: 1 addition & 2 deletions debian/libdtkgui5.install
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
usr/lib/*/lib*.so.*
#usr/share/dsg/*/*
usr/lib/*/libdtkgui.so.5*
80 changes: 67 additions & 13 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/make -f
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk
export QT_SELECT = qt5

# 安全编译参数
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
Expand All @@ -14,22 +13,77 @@ DEB_CMAKE_EXTRA_FLAGS += -DCMAKE_SKIP_BUILD_RPATH=ON

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

VERSION = $(DEB_VERSION_UPSTREAM)
_PACK_VER = $(shell echo $(VERSION) | awk -F'[+_~-]' '{print $$1}')
_BUILD_VER = $(shell echo $(VERSION) | awk -F'[+_~-]' '{print $$2}' | sed 's/[^0-9]//g' | awk '{print int($$1)}')
ifeq ($(_BUILD_VER),)
CONFIG_VERSION = $(_PACK_VER)
else
CONFIG_VERSION = $(_PACK_VER).$(_BUILD_VER)
endif
# x.y.z -> DTK5_VERSION=5.y.z, DTK6_VERSION=6.y.z
DTK5_VERSION := $(shell echo $(DEB_VERSION_UPSTREAM) | sed -E 's/^[0-9]+(\.|[^0-9]|$$)/5\1/')
DTK6_VERSION := $(shell echo $(DEB_VERSION_UPSTREAM) | sed -E 's/^[0-9]+(\.|[^0-9]|$$)/6\1/')

DTK5_MAJOR_MINOR := $(shell echo $(DTK5_VERSION) | cut -d '.' -f 1,2)
BUILD_DOCS := $(if $(filter nodoc,$(DEB_BUILD_PROFILES)),OFF,ON)
BUILD_DTK5 := $(if $(filter nodtk5,$(DEB_BUILD_PROFILES)),OFF,ON)
BUILD_DTK6 := $(if $(filter nodtk6,$(DEB_BUILD_PROFILES)),OFF,ON)

%:
dh $@

override_dh_auto_configure:
dh_auto_configure -- $(DEB_CMAKE_EXTRA_FLAGS) -DBUILD_TESTING=OFF -DBUILD_DOCS=ON -DDTK_VERSION=$(_PACK_VER)
#override_dh_auto_test:
# echo "skip auto test"
ifeq ($(BUILD_DTK5),ON)
mkdir -p build5
QT_SELECT=qt5 dh_auto_configure --builddirectory=build5 -- \
$(DEB_CMAKE_EXTRA_FLAGS) \
-DBUILD_TESTING=OFF \
-DBUILD_DOCS=$(BUILD_DOCS) \
-DDTK5=ON
endif
ifeq ($(BUILD_DTK6),ON)
mkdir -p build6
dh_auto_configure --builddirectory=build6 -- \
$(DEB_CMAKE_EXTRA_FLAGS) \
-DBUILD_TESTING=OFF \
-DBUILD_DOCS=$(BUILD_DOCS) \
-DDTK5=OFF
endif

override_dh_auto_build:
ifeq ($(BUILD_DTK5),ON)
QT_SELECT=qt5 dh_auto_build --builddirectory=build5
endif
ifeq ($(BUILD_DTK6),ON)
dh_auto_build --builddirectory=build6
endif

override_dh_auto_install:
ifeq ($(BUILD_DTK5),ON)
QT_SELECT=qt5 dh_auto_install --builddirectory=build5
endif
ifeq ($(BUILD_DTK6),ON)
dh_auto_install --builddirectory=build6
endif

override_dh_makeshlibs:
dh_makeshlibs -V "libdtkgui5 (>= $(shell echo $(VERSION) | cut -d '.' -f 1,2))"
ifeq ($(BUILD_DTK5),ON)
dh_makeshlibs -V "libdtkgui5 (>= $(DTK5_MAJOR_MINOR))" -plibdtkgui5
endif
ifeq ($(BUILD_DTK6),ON)
dh_makeshlibs -V "libdtk6gui (>= $(DTK6_VERSION))" -plibdtk6gui
endif

override_dh_link:
ifeq ($(BUILD_DTK5),ON)
dh_link usr/lib/$(DEB_HOST_MULTIARCH)/libdtkgui.so.5 usr/lib/$(DEB_HOST_MULTIARCH)/libdtkgui.so -p libdtkgui-dev
endif
ifeq ($(BUILD_DTK6),ON)
dh_link usr/lib/$(DEB_HOST_MULTIARCH)/libdtk6gui.so.6 usr/lib/$(DEB_HOST_MULTIARCH)/libdtk6gui.so -p libdtk6gui-dev
endif

override_dh_auto_test:
ifeq ($(BUILD_DTK5),ON)
QT_SELECT=qt5 dh_auto_test --builddirectory=build5
endif
ifeq ($(BUILD_DTK6),ON)
dh_auto_test --builddirectory=build6
endif

override_dh_auto_clean:
dh_auto_clean --builddirectory=build5
dh_auto_clean --builddirectory=build6
rm -rf build5 build6
2 changes: 1 addition & 1 deletion docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set (DOXYGEN_GENERATE_HTML "YES" CACHE STRING "Doxygen HTML output")
set (DOXYGEN_GENERATE_XML "YES" CACHE STRING "Doxygen XML output")
set (DOXYGEN_GENERATE_QHP "YES" CACHE STRING "Doxygen QHP output")
set (DOXYGEN_FILE_PATTERNS *.cpp *.h *.zh_CN.md *.zh_CN.dox CACHE STRING "Doxygen File Patterns")
set (DOXYGEN_PROJECT_NUMBER ${CMAKE_PROJECT_VERSION} CACHE STRING "") # Should be the same as this project is using.
set (DOXYGEN_PROJECT_NUMBER ${DTK_VERSION} CACHE STRING "") # Should be the same as this project is using.
set (DOXYGEN_EXTRACT_STATIC YES)
set (DOXYGEN_OUTPUT_LANGUAGE "Chinese" CACHE STRING "Doxygen Output Language")
set (DOXYGEN_IMAGE_PATH ${CMAKE_CURRENT_LIST_DIR}/images/)
Expand Down
24 changes: 12 additions & 12 deletions dtkgui.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
message(STATUS "Current Qt Version: ${QT_VERSION_MAJOR}")
message(STATUS "Compiling with DTK major version: ${DTK_VERSION_MAJOR}, Qt major version: ${QT_VERSION_MAJOR}")

set(LIB_NAME dtk${DTK_VERSION_MAJOR}gui)
set(LIB_NAME dtk${DTK_NAME_SUFFIX}gui)

# Set install path
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
Expand Down Expand Up @@ -30,11 +30,11 @@ else()
set (BUILD_DOCS OFF CACHE BOOL "Generate doxygen-based documentation")
endif()

set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/dtk${PROJECT_VERSION_MAJOR}/DGui")
set(TOOL_INSTALL_DIR "${CMAKE_INSTALL_LIBEXECDIR}/dtk${PROJECT_VERSION_MAJOR}/DGui/bin")
set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/dtk${DTK_VERSION_MAJOR}/DGui")
set(TOOL_INSTALL_DIR "${CMAKE_INSTALL_LIBEXECDIR}/dtk${DTK_VERSION_MAJOR}/DGui/bin")
set(LIBRARY_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}")
set(MKSPECS_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/qt${QT_VERSION_MAJOR}/mkspecs/modules" CACHE STRING "Install dir for qt pri module files")
set(CONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/Dtk${DTK_VERSION_MAJOR}Gui")
set(CONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/Dtk${DTK_NAME_SUFFIX}Gui")
set(PKGCONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -Wextra -fopenmp")
Expand All @@ -59,25 +59,25 @@ endforeach()

# Generate cmake config file
configure_package_config_file(misc/DtkGuiConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/Dtk${DTK_VERSION_MAJOR}GuiConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/Dtk${DTK_NAME_SUFFIX}GuiConfig.cmake
INSTALL_DESTINATION "${CONFIG_INSTALL_DIR}"
PATH_VARS TOOL_INSTALL_DIR
)
# Generate cmake version file
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/Dtk${DTK_VERSION_MAJOR}GuiConfigVersion.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/Dtk${DTK_NAME_SUFFIX}GuiConfigVersion.cmake"
VERSION ${DTK_VERSION}
COMPATIBILITY SameMajorVersion
)
# Install cmake config file and version file to CONFIG_INSTALL_DIR
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/Dtk${DTK_VERSION_MAJOR}GuiConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/Dtk${DTK_VERSION_MAJOR}GuiConfigVersion.cmake
${CMAKE_CURRENT_BINARY_DIR}/Dtk${DTK_NAME_SUFFIX}GuiConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/Dtk${DTK_NAME_SUFFIX}GuiConfigVersion.cmake
DESTINATION "${CONFIG_INSTALL_DIR}"
)
# Install pkgconfig file
configure_file(misc/dtkgui.pc.in dtk${DTK_VERSION_MAJOR}gui.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dtk${DTK_VERSION_MAJOR}gui.pc DESTINATION "${PKGCONFIG_INSTALL_DIR}")
configure_file(misc/dtkgui.pc.in dtk${DTK_NAME_SUFFIX}gui.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dtk${DTK_NAME_SUFFIX}gui.pc DESTINATION "${PKGCONFIG_INSTALL_DIR}")
# Install pri module
configure_file(misc/qt_lib_dtkgui.pri.in qt_lib_dtkgui.pri @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qt_lib_dtkgui.pri DESTINATION "${MKSPECS_INSTALL_DIR}")
Expand Down Expand Up @@ -111,7 +111,7 @@ install(FILES DtkGuis DESTINATION "${INCLUDE_INSTALL_DIR}")
# Find common dependencies
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Gui DBus Network)
find_package(PkgConfig REQUIRED)
find_package(Dtk${DTK_VERSION_MAJOR} REQUIRED Core)
find_package(Dtk${DTK_NAME_SUFFIX} REQUIRED Core)
find_package(DtkBuildHelper REQUIRED)
pkg_check_modules(librsvg REQUIRED IMPORTED_TARGET librsvg-2.0)

Expand Down
Loading
Loading