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
25 changes: 15 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
cmake_minimum_required (VERSION 3.13)

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 "DTK version")
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" FILE_VERSION)
string(STRIP "${FILE_VERSION}" FILE_VERSION)

project (DtkCore
VERSION ${DTK_VERSION}
VERSION ${FILE_VERSION}
DESCRIPTION "DTK Core module"
HOMEPAGE_URL "https://github.com/linuxdeepin/dtkcore"
LANGUAGES CXX C
Expand All @@ -18,13 +17,19 @@ endif ()
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)

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")
option(DTK5 "Build DTK5." ON)
if(DTK5)
set(DTK_VERSION_MAJOR "5")
set(DTK_NAME_SUFFIX "") # Empty name suffix for DTK5 products.
else()
message(SEND_ERROR "not support Prject Version ${PROJECT_VERSION}.")
set(DTK_VERSION_MAJOR "6")
set(DTK_NAME_SUFFIX "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}")
# Officially, DTK5 uses QT5, DTK6 uses QT6
set(QT_VERSION_MAJOR ${DTK_VERSION_MAJOR})

include(dtkcore.cmake)
2 changes: 1 addition & 1 deletion archlinux/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ build() {
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DD_DSG_APP_DATA_FALLBACK=/var/dsg/appdata \
-DBUILD_WITH_SYSTEMD=ON
-DDTK5=ON
ninja
}

Expand Down
2 changes: 1 addition & 1 deletion cmake/DtkCMake/DtkCMakeConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ endfunction()
add_definitions(-DQ_HOST_NAME=\"${CMAKE_HOST_SYSTEM_PROCESSOR}\")
addDefinitions(Q_HOST_${CMAKE_HOST_SYSTEM_PROCESSOR})

find_package(Dtk@DTK_VERSION_MAJOR@Core REQUIRED)
find_package(Dtk@DTK_NAME_SUFFIX@Core REQUIRED)

set(DEEPIN_OS_RELEASE_TOOL_PATH ${DtkCore_TOOL_DIRS})
set(DEEPIN_OS_RELEASE_TOOL ${DEEPIN_OS_RELEASE_TOOL_PATH}/deepin-os-release)
Expand Down
10 changes: 5 additions & 5 deletions cmake/DtkTools/DtkToolsConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
include(CMakeFindDependencyMacro)
find_dependency(Dtk@DTK_VERSION_MAJOR@Core REQUIRED)
find_dependency(Dtk@DTK_NAME_SUFFIX@Core REQUIRED)

set (DTK_SETTINGS_TOOLS_EXECUTABLE ${DtkCore_TOOL_DIRS}/dtk-settings)

if (EXISTS ${DTK_SETTINGS_TOOLS_EXECUTABLE})
set(DTK_SETTINGS_TOOLS_FOUND TRUE)
endif ()

include("${CMAKE_CURRENT_LIST_DIR}/Dtk@DTK_VERSION_MAJOR@SettingsToolsMacros.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/Dtk@DTK_VERSION_MAJOR@ToolsTargets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/Dtk@DTK_NAME_SUFFIX@SettingsToolsMacros.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/Dtk@DTK_NAME_SUFFIX@ToolsTargets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/DtkDBusMacros.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/DtkDConfigMacros.cmake")

get_target_property(DTK_XML2CPP Dtk@DTK_VERSION_MAJOR@::Xml2Cpp LOCATION)
get_target_property(DTK_DCONFIG2CPP Dtk@DTK_VERSION_MAJOR@::DConfig2Cpp LOCATION)
get_target_property(DTK_XML2CPP Dtk@DTK_NAME_SUFFIX@::Xml2Cpp LOCATION)
get_target_property(DTK_DCONFIG2CPP Dtk@DTK_NAME_SUFFIX@::DConfig2Cpp LOCATION)
85 changes: 67 additions & 18 deletions debian/control
Original file line number Diff line number Diff line change
@@ -1,43 +1,92 @@
Source: dtkcore
Section: libdevel
Priority: optional
Maintainer: Deepin Packages Builder <[email protected]>
Build-Depends: debhelper-compat ( =12), pkg-config,
qttools5-dev-tools, qttools5-dev, qtbase5-private-dev, doxygen,
libgsettings-qt-dev, libgtest-dev, libdtkcommon-dev, cmake,
libuchardet-dev, libicu-dev, libdtklog-dev, libdbus-1-dev
Maintainer: Shanshan Ye <[email protected]>
Build-Depends: debhelper-compat ( =12),
pkg-config,
libgtest-dev,
libdtkcommon-dev,
libicu-dev,
libuchardet-dev,
libdbus-1-dev,
qttools5-dev-tools,
qttools5-dev,
libgsettings-qt-dev,
libdtklog-dev,
doxygen,
qtbase5-private-dev,
qt6-base-dev-tools,
qt6-base-dev,
qt6-base-private-dev,
libdtk6log-dev,
qt6-tools-dev,
cmake
Standards-Version: 3.9.8

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

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

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

Package: libdtkcore5
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, lshw
Multi-Arch: same
Description: Deepin Tool Kit Core library
DtkCore is base library of Deepin Qt/C++ applications.
Build-Profiles: <!nodtk5>
Description: Development ToolKit Core Library (DTK5 with Qt5)
DTK Core 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: libdtkcore5-bin
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends},
libdtkcore5( =${binary:Version})
Description: Deepin Tool Kit Core Utilities
DtkCore is base devel library of Deepin Qt/C++ applications.
Build-Profiles: <!nodtk5>
Description: Development ToolKit Core Utilities (DTK5 with Qt5)
DTK Core is the base library of deepin Qt/C++ applications.
.
This package contains the utilities of DtkCore
This package contains the utilities of DTK5 Core.

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

Package: libdtkcore-doc
Architecture: any
Description: Deepin Tool Kit Core (document)
DtkCore is base devel library of Deepin Qt/C++ applications.
Build-Profiles: <!nodtk5 !nodoc>
Description: Development ToolKit Core Documentation
DTK Core is the base library of deepin Qt/C++ applications.
.
This package contains the doc files of DtkCore
This package contains the doc files of DtkCore.
1 change: 1 addition & 0 deletions debian/libdtk6core-bin.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/libexec/dtk6/DCore/bin/*
5 changes: 5 additions & 0 deletions debian/libdtk6core-dev.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
usr/lib/*/libdtk6core.so
usr/include/dtk6/*
usr/lib/*/pkgconfig/dtk6core.pc
usr/lib/*/cmake/Dtk6*/*
usr/lib/*/qt6/*
1 change: 1 addition & 0 deletions debian/libdtk6core.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/lib/*/libdtk6core.so.*
11 changes: 7 additions & 4 deletions debian/libdtkcore-dev.install
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
usr/lib/*/lib*.so
usr/include
usr/lib/*/pkgconfig/*.pc
usr/lib/*/cmake/*/*.cmake
usr/lib/*/libdtkcore.so
usr/include/dtk5/*
usr/lib/*/pkgconfig/dtkcore.pc
usr/lib/*/cmake/DtkCMake/*
usr/lib/*/cmake/DtkTools/*
usr/lib/*/cmake/DtkDConfig/*
usr/lib/*/cmake/DtkCore/*
usr/lib/*/qt5/*
2 changes: 1 addition & 1 deletion debian/libdtkcore5-bin.install
Original file line number Diff line number Diff line change
@@ -1 +1 @@
usr/*/*/DCore/bin/*
usr/libexec/dtk5/DCore/bin/*
2 changes: 1 addition & 1 deletion debian/libdtkcore5.install
Original file line number Diff line number Diff line change
@@ -1 +1 @@
usr/lib/*/lib*.so.*
usr/lib/*/libdtkcore.so.*
66 changes: 57 additions & 9 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_CXXFLAGS_MAINT_APPEND = -Ofast

# 安全编译参数
Expand All @@ -15,25 +14,74 @@ DEB_CMAKE_EXTRA_FLAGS += -DCMAKE_SKIP_BUILD_RPATH=ON

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

VERSION = $(DEB_VERSION_UPSTREAM)
# 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/')

# Calculate build version:
# 5.6.8 -> 0; 5.6.8.7 -> 7; 5.6.8+u001 -> 1; 5.6.8.7+u001 -> 7; 5.6.8.0+u001 -> 0
BUILD_VER = $(shell echo $(VERSION) | awk -F'[+_~-]' '{print $$1}' | awk -F'.' '{print $$4}' | sed 's/[^0-9]//g' | awk '{print int($$1)}')
BUILD_VER := $(shell echo $(DEB_VERSION_UPSTREAM) | awk -F'[+_~-]' '{print $$1}' | awk -F'.' '{print $$4}' | sed 's/[^0-9]//g' | awk '{print int($$1)}')
ifeq ($(BUILD_VER), 0)
ifeq ($(shell expr $(shell echo "$(VERSION)" | awk -F. '{print NF-1}') '<' 3), 1)
BUILD_VER=$(shell echo $(VERSION) | awk -F'[+_~-]' '{print $$2}' | sed 's/[^0-9]//g' | awk '{print int($$1)}')
ifeq ($(shell expr $(shell echo "$(DEB_VERSION_UPSTREAM)" | awk -F. '{print NF-1}') '<' 3), 1)
BUILD_VER=$(shell echo $(DEB_VERSION_UPSTREAM) | awk -F'[+_~-]' '{print $$2}' | sed 's/[^0-9]//g' | awk '{print int($$1)}')
endif
endif

DTK5_MAJOR_MINOR := $(shell echo $(DTK5_VERSION) | cut -d '.' -f 1,2)
DTK6_MAJOR_MINOR := $(shell echo $(DTK6_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_WITH_SYSTEMD=ON -DBUILD_EXAMPLES=OFF -DBUILD_DOCS=ON -DBUILD_VERSION=$(BUILD_VER) -DD_DSG_APP_DATA_FALLBACK=/var/dsg/appdata
ifeq ($(BUILD_DTK5),ON)
mkdir -p build-dtk5
QT_SELECT=qt5 dh_auto_configure --builddirectory=build-dtk5 -- $(DEB_CMAKE_EXTRA_FLAGS) -DBUILD_WITH_SYSTEMD=ON -DBUILD_EXAMPLES=OFF -DBUILD_DOCS=$(BUILD_DOCS) -DBUILD_VERSION=$(BUILD_VER) -DD_DSG_APP_DATA_FALLBACK=/var/dsg/appdata -DDTK5=ON
endif
ifeq ($(BUILD_DTK6),ON)
mkdir -p build-dtk6
dh_auto_configure --builddirectory=build-dtk6 -- $(DEB_CMAKE_EXTRA_FLAGS) -DBUILD_WITH_SYSTEMD=ON -DBUILD_EXAMPLES=OFF -DBUILD_DOCS=OFF -DBUILD_VERSION=$(BUILD_VER) -DD_DSG_APP_DATA_FALLBACK=/var/dsg/appdata -DDTK5=OFF
endif

override_dh_auto_build:
ifeq ($(BUILD_DTK5),ON)
QT_SELECT=qt5 dh_auto_build --builddirectory=build-dtk5
endif
ifeq ($(BUILD_DTK6),ON)
dh_auto_build --builddirectory=build-dtk6
endif

#override_dh_auto_test:
# echo "skip auto test"
override_dh_auto_install:
ifeq ($(BUILD_DTK5),ON)
QT_SELECT=qt5 dh_auto_install --builddirectory=build-dtk5
endif
ifeq ($(BUILD_DTK6),ON)
dh_auto_install --builddirectory=build-dtk6
endif

override_dh_makeshlibs:
dh_makeshlibs -V "libdtkcore5 (>= $(shell echo $(VERSION) | cut -d '.' -f 1,2))"
ifeq ($(BUILD_DTK5),ON)
dh_makeshlibs -V "libdtkcore5 (>= $(DTK5_MAJOR_MINOR))" -plibdtkcore5
endif
ifeq ($(BUILD_DTK6),ON)
dh_makeshlibs -V "libdtk6core (>= $(DTK6_MAJOR_MINOR))" -plibdtk6core
endif

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

override_dh_auto_test:
ifeq ($(BUILD_DTK5),ON)
QT_SELECT=qt5 dh_auto_test --builddirectory=build-dtk5
endif
ifeq ($(BUILD_DTK6),ON)
dh_auto_test --builddirectory=build-dtk6
endif
2 changes: 1 addition & 1 deletion docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,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")

Expand Down
Loading