代码拉取完成,页面将自动刷新
cmake_minimum_required(VERSION 3.0)
project(kiran-cpanel-group VERSION 1.0)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
include(GNUInstallDirs)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
include(kgm-variables)
set(INSTALL_BINDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR})
set(INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
set(INSTALL_DATADIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR})
find_package(PkgConfig REQUIRED)
find_package(Qt5 COMPONENTS Widgets X11Extras Svg Xml LinguistTools DBus)
find_package(KiranDBusGenerate REQUIRED)#使用xml2cpp
pkg_search_module(GLIB REQUIRED glib-2.0)
pkg_search_module(GSETTINGS_QT REQUIRED gsettings-qt)
pkg_search_module(KLOG_QT5 REQUIRED klog-qt5)
pkg_search_module(KIRANWIDGETS REQUIRED kiranwidgets-qt5)
pkg_search_module(KIRAN_CC_DAEMON REQUIRED kiran-cc-daemon)
#通过kiran control panel的pkgconfig配置文件取出插件Desktop安装位置、插件共享库安装位置
pkg_search_module(KIRAN_CONTROL_PANEL_PKG REQUIRED kiran-control-panel)
pkg_get_variable(CPANEL_PLUGIN_DIR kiran-control-panel plugin_location)
pkg_get_variable(CPANEL_DESKTOP_DIR kiran-control-panel plugin_desktop_location)
file(GLOB_RECURSE SRC "src/*.cpp" "src/*.h" "src/*.ui")
file(GLOB GROUP_TS_FILES "translations/*.ts")
file(GLOB_RECURSE RESOURCES "resources/*.qrc")
file(GLOB_RECURSE TOOLS_SOURCES "tools/*.cpp")
file(GLOB_RECURSE TOOLS_HEADERS "tools/*.h")
qt5_create_translation(GROUP_QM_FILES ${CMAKE_SOURCE_DIR} ${GROUP_TS_FILES})
include_directories(${KIRAN_CONTROL_PANEL_PKG_INCLUDE_DIRS})
#DBus代理代码生成
set(DBUS_SRC_LIST "")
##group admin service
set(KSD_GROUP_ADMIN_XML data/org.group.admin.xml)
set_source_files_properties(${KSD_GROUP_ADMIN_XML}
PROPERTIES
CLASSNAME KSDGroupAdminProxy
NO_NAMESPACE true)
kiran_qt5_add_dbus_interface(KSD_GROUP_ADMIN_SRC ${KSD_GROUP_ADMIN_XML} ksd_group_admin_proxy)
list(APPEND DBUS_SRC_LIST ${KSD_GROUP_ADMIN_SRC})
##group admin list
set(KSD_GROUP_ADMIN_LIST_XML data/org.group.admin.list.xml)
set_source_files_properties(${KSD_GROUP_ADMIN_LIST_XML}
PROPERTIES
CLASSNAME KSDGroupAdminListProxy
NO_NAMESPACE true)
kiran_qt5_add_dbus_interface(KSD_GROUP_ADMIN_LIST_SRC ${KSD_GROUP_ADMIN_LIST_XML} ksd_group_admin_list_proxy)
list(APPEND DBUS_SRC_LIST ${KSD_GROUP_ADMIN_LIST_SRC})
set(KSD_ACCOUNTS_XML data/com.kylinsec.Kiran.SystemDaemon.Accounts.xml)
set_source_files_properties(${KSD_ACCOUNTS_XML}
PROPERTIES
CLASSNAME KSDAccountsProxy
NO_NAMESPACE true)
kiran_qt5_add_dbus_interface(KSD_ACCOUNTS_SRC ${KSD_ACCOUNTS_XML} ksd_accounts_proxy)
list(APPEND DBUS_SRC_LIST ${KSD_ACCOUNTS_SRC})
##kiran accounts user
set(KSD_ACCOUNTS_USER_XML data/com.kylinsec.Kiran.SystemDaemon.Accounts.User.xml)
set_source_files_properties(${KSD_ACCOUNTS_USER_XML}
PROPERTIES
CLASSNAME KSDAccountsUserProxy
NO_NAMESPACE true)
kiran_qt5_add_dbus_interface(KSD_ACCOUNTS_USER_SRC ${KSD_ACCOUNTS_USER_XML} ksd_accounts_user_proxy)
list(APPEND DBUS_SRC_LIST ${KSD_ACCOUNTS_USER_SRC})
add_library(${PROJECT_NAME} SHARED
${SRC}
${GROUP_QM_FILES}
${DBUS_SRC_LIST}
${RESOURCES}
${TOOLS_SOURCES}
${TOOLS_HEADERS}
)
target_include_directories(${PROJECT_NAME} PRIVATE
src/pages
src/widgets
src
tools
${GLIB_INCLUDE_DIRS}
${GSETTINGS_QT_INCLUDE_DIRS}
${KIRAN_CONTROL_PANEL_PKG_INCLUDE_DIRS}
${KIRANWIDGETS_INCLUDE_DIRS}
${KLOG_QT5_INCLUDE_DIRS}
${KIRAN_CC_DAEMON_INCLUDE_DIRS}
)
target_link_libraries(${PROJECT_NAME}
Qt5::Core
Qt5::Gui
Qt5::Svg
Qt5::Widgets
Qt5::X11Extras
Qt5::Xml
Qt5::DBus
X11
${GLIB_LIBRARIES}
${GSETTINGS_QT_LIBRARIES}
${KIRANWIDGETS_LIBRARIES}
${KLOG_QT5_LIBRARIES}
${KIRAN_CC_DAEMON_LIBRARIES})
set(PLUGIN_ICONS_DIR ${INSTALL_DATADIR}/icons/hicolor/scalable/apps )
set(PLUGIN_TRANSLATION_DIR ${INSTALL_DATADIR}/${PROJECT_NAME}/translation/)
configure_file(data/kiran-cpanel-group-config.h.in ${CMAKE_BINARY_DIR}/plugin-group-config.h)
#安装控制中心插件
install(TARGETS ${PROJECT_NAME} DESTINATION ${CPANEL_PLUGIN_DIR}/)
#安装控制中心插件desktop
configure_file(${CMAKE_SOURCE_DIR}/data/kiran-cpanel-group.desktop.in ${CMAKE_BINARY_DIR}/kiran-cpanel-group.desktop @ONLY )
install(FILES ${CMAKE_BINARY_DIR}/kiran-cpanel-group.desktop DESTINATION ${CPANEL_DESKTOP_DIR}/ )
SET(link_source ${CPANEL_DESKTOP_DIR}/${PROJECT_NAME}.desktop)
SET(link_target ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-link.desktop)
add_custom_target(kcp-applications-desktop ALL COMMAND ln -sf ${link_source} ${link_target})
install(FILES ${link_target}
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/applications/
RENAME ${PROJECT_NAME}.desktop)
#安装翻译文件
install(FILES ${GROUP_QM_FILES} DESTINATION ${KGM_TRANSLATION_DIR_PATH} )
# #安装账户管理配置文件
# install(FILES ./config/kiran-group-manager.conf DESTINATION ${KGM_CONF_DIR})
#安装账户管理图标
set(KCP_ICON_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor)
install(FILES "${CMAKE_SOURCE_DIR}/resources/kcp-group-images/kcp-group-16.png" DESTINATION ${KCP_ICON_INSTALL_PATH}/16x16/apps RENAME kcp-group.png)
install(FILES "${CMAKE_SOURCE_DIR}/resources/kcp-group-images/kcp-group-22.png" DESTINATION ${KCP_ICON_INSTALL_PATH}/22x22/apps RENAME kcp-group.png)
install(FILES "${CMAKE_SOURCE_DIR}/resources/kcp-group-images/kcp-group-24.png" DESTINATION ${KCP_ICON_INSTALL_PATH}/24x24/apps RENAME kcp-group.png)
install(FILES "${CMAKE_SOURCE_DIR}/resources/kcp-group-images/kcp-group-32.png" DESTINATION ${KCP_ICON_INSTALL_PATH}/32x32/apps RENAME kcp-group.png)
install(FILES "${CMAKE_SOURCE_DIR}/resources/kcp-group-images/kcp-group-48.png" DESTINATION ${KCP_ICON_INSTALL_PATH}/48x48/apps RENAME kcp-group.png)
install(FILES "${CMAKE_SOURCE_DIR}/resources/kcp-group-images/kcp-group-64.png" DESTINATION ${KCP_ICON_INSTALL_PATH}/64x64/apps RENAME kcp-group.png)
install(FILES "${CMAKE_SOURCE_DIR}/resources/kcp-group-images/kcp-group-96.png" DESTINATION ${KCP_ICON_INSTALL_PATH}/96x96/apps RENAME kcp-group.png)
install(FILES "${CMAKE_SOURCE_DIR}/resources/kcp-group-images/kcp-group-128.png" DESTINATION ${KCP_ICON_INSTALL_PATH}/128x128/apps RENAME kcp-group.png)
install(FILES ${INSTALL_ICONS} DESTINATION ${PLUGIN_ICONS_DIR})
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。