Skip to content

Commit

Permalink
chore: adapt to qt6xdg
Browse files Browse the repository at this point in the history
  • Loading branch information
kegechen committed Jul 8, 2024
1 parent 91f71f8 commit 5e4520c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
21 changes: 16 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,23 @@ function(dtk_add_plugin)
endfunction()

find_package(Dtk${VERSION_SUFFIX} REQUIRED COMPONENTS Widget)
cmake_dependent_option(ENABLE_QT_XDG_ICON_LOADER "Enable QtXdgIconLoader" ON "QT_VERSION_MAJOR EQUAL 5" OFF)

option(ENABLE_QT_XDG_ICON_LOADER "Enable QtXdgIconLoader" ON)
find_package(Qt${QT_VERSION_MAJOR}XdgIconLoader)
find_package(Qt${QT_VERSION_MAJOR}Xdg REQUIRED)
if (NOT Qt${QT_VERSION_MAJOR}XdgIconLoader_FOUND)
message(WARNING " Qt${QT_VERSION_MAJOR}XdgIconLoader Not Found, DISABLE QtXdgIconLoader !")
set (ENABLE_QT_XDG_ICON_LOADER OFF)
endif()

if(ENABLE_QT_XDG_ICON_LOADER)
find_package(Qt5XdgIconLoader REQUIRED)
find_package(Qt5Xdg REQUIRED)
set(QT_XDG_ICON_DEPS Qt5XdgIconLoader Qt5Xdg)
set(XDG_ICON_VERSION_MAJOR ${Qt5XdgIconLoader_VERSION_MAJOR})
set(QT_XDG_ICON_DEPS Qt${QT_VERSION_MAJOR}XdgIconLoader Qt${QT_VERSION_MAJOR}Xdg)

if("${QT_VERSION_MAJOR}" STREQUAL "5")
set(XDG_ICON_VERSION_MAJOR ${Qt5XdgIconLoader_VERSION_MAJOR})
elseif("${QT_VERSION_MAJOR}" STREQUAL "6")
set(XDG_ICON_VERSION_MAJOR ${Qt6XdgIconLoader_VERSION_MAJOR})
endif()
endif()

set(PLUGIN_OUTPUT_BASE_DIR ${CMAKE_BINARY_DIR}/plugins CACHE STRING "Plugin output base path")
Expand Down
2 changes: 1 addition & 1 deletion archlinux/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pkgdesc='Qt platform theme integration plugins for DDE'
arch=('x86_64' 'aarch64')
url="https://github.com/linuxdeepin/qt5integration"
license=('GPL3')
depends=('dtkwidget-git' 'libqtxdg' 'deepin-qt5platform-plugins-git')
depends=('dtkwidget-git' 'libqt5xdg' 'deepin-qt5platform-plugins-git')
makedepends=('git' 'qt5-tools' 'xcb-util-renderutil' 'gtest' 'gmock' 'cmake' 'ninja')
conflicts=('deepin-qt5integration')
provides=('deepin-qt5integration')
Expand Down
4 changes: 3 additions & 1 deletion platformthemeplugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS DBus Widgets)
set(QT_LIBS Qt${QT_VERSION_MAJOR}::DBus Qt${QT_VERSION_MAJOR}::Widgets)
if(QT_VERSION_MAJOR EQUAL 5)
find_package(Qt5X11Extras REQUIRED)
list(APPEND QT_LIBS Qt5::X11Extras ${QT_XDG_ICON_DEPS})
list(APPEND QT_LIBS Qt5::X11Extras)
if(QT_VERSION_MINOR GREATER_EQUAL 8) # Qt5.8
find_package(Qt5ThemeSupport REQUIRED)
list(APPEND QT_LIBS Qt5::ThemeSupportPrivate)
Expand All @@ -26,10 +26,12 @@ if(QT_VERSION_MAJOR EQUAL 5)
else()
list(APPEND QT_LIBS Qt6::GuiPrivate)
endif()

find_package(PkgConfig REQUIRED)
pkg_check_modules(Deps REQUIRED IMPORTED_TARGET mtdev x11)
if(ENABLE_QT_XDG_ICON_LOADER)
set(DEFS -DXDG_ICON_VERSION_MAR=${XDG_ICON_VERSION_MAJOR})
list(APPEND QT_LIBS ${QT_XDG_ICON_DEPS})
endif()
if(QT_VERSION_MAJOR EQUAL 5)
qt5_add_dbus_interface(DBUS_INTERFACES ${CMAKE_CURRENT_LIST_DIR}/xmls/com.deepin.filemanager.filedialog.xml filedialog_interface)
Expand Down

0 comments on commit 5e4520c

Please sign in to comment.