1 Star 0 Fork 21

kylinsoft-contributor / ukui-sidebar

forked from OpenAtom / ukui-sidebar 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
CMakeLists.txt 5.05 KB
一键复制 编辑 原始数据 按行查看 历史
cmake_minimum_required(VERSION 3.16)
project(ukui-sidebar)
set(VERSION "3.22.0")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# see https://cmake.org/cmake/help/v3.16/manual/cmake-qt.7.html
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
# see: https://cmake.org/cmake/help/v3.16/command/add_subdirectory.html binary_dir
add_subdirectory(3rd-parties/qtsingleapplication)
add_subdirectory(ukui-shortcut)
add_subdirectory(ukui-sidebar-items)
# 查找qt组件
find_package(Qt5 COMPONENTS
Core Gui Quick Widgets LinguistTools DBus X11Extras
REQUIRED)
# find kde framework components
# see: https://api.kde.org/frameworks/index.html > KWindowSystem
find_package(KF5WindowSystem REQUIRED)
# 查找其他组件
# see: https://cmake.org/cmake/help/v3.16/module/FindPkgConfig.html
# see: https://cmake.org/cmake/help/v3.16/command/list.html
find_package(PkgConfig REQUIRED)
set(UKUI_SIDEBAR_EXTERNAL_LIBS "")
set(UKUI_SIDEBAR_PC_PKGS gsettings-qt x11 xcb kysdk-waylandhelper)
foreach(PC_LIB IN ITEMS ${UKUI_SIDEBAR_PC_PKGS})
pkg_check_modules(${PC_LIB} REQUIRED ${PC_LIB})
if(${${PC_LIB}_FOUND})
include_directories(${${PC_LIB}_INCLUDE_DIRS})
link_directories(${${PC_LIB}_LIBRARY_DIRS})
list(APPEND UKUI_SIDEBAR_EXTERNAL_LIBS ${${PC_LIB}_LIBRARIES})
endif()
endforeach()
message(STATUS "External libraries found: ${UKUI_SIDEBAR_EXTERNAL_LIBS}")
# include文件夹
include_directories(3rd-parties/qtsingleapplication/src)
include_directories(src/main)
include_directories(src/items)
include_directories(src/model)
include_directories(src/config)
include_directories(src/utils)
include_directories(src/windows)
include_directories(src/notification)
include_directories(src/notification/notification-helper)
# 插件目录
include_directories(ukui-shortcut)
include_directories(ukui-shortcut/interface)
# 用于Qt Creator识别自定义qml模块的导入路径
list(APPEND QML_MODULE_DIRS "qml")
set(QML_IMPORT_PATH "${QML_MODULE_DIRS}" CACHE STRING "Qt Creator extra qml import paths." FORCE)
message(STATUS "QML_IMPORT_PATH: ${QML_IMPORT_PATH}")
# 基础设置
set(TRANSLATION_FILE_DIR "/usr/share/ukui-sidebar/translations")
# 宏定义
add_compile_definitions(TRANSLATION_FILE_DIR="${TRANSLATION_FILE_DIR}"
VERSION="${VERSION}")
# 源码
set(SOURCE_FILES
src/main.cpp
src/main/app-manager.h src/main/app-manager.cpp
src/main/color-helper.h src/main/color-helper.cpp
src/main/screen-monitor.h src/main/screen-monitor.cpp
src/main/global-settings.h src/main/global-settings.cpp
src/main/hand-gesture-helper.h src/main/hand-gesture-helper.cpp
src/main/account-information.h src/main/account-information.cpp
src/side-bar-application.h src/side-bar-application.cpp
src/items/shadow-item.h src/items/shadow-item.cpp
src/utils/weather-helper.h src/utils/weather-helper.cpp
src/utils/date-time-utils.h src/utils/date-time-utils.cpp
src/config/layout-config.h src/config/layout-config.cpp
src/model/shortcut-model.h src/model/shortcut-model.cpp
src/model/shortcut-model-manager.h src/model/shortcut-model-manager.cpp
src/windows/window-type.h
src/windows/sidebar-window.h src/windows/sidebar-window.cpp
src/windows/window-blur-helper.h src/windows/window-blur-helper.cpp
src/windows/sidebar-view.cpp src/windows/sidebar-view.h
)
set(NOTIFICATION_SOURCE_FILES
src/notification/notification-manager.h
src/notification/notification-manager.cpp
src/notification/notification-helper/action.h
src/notification/notification-helper/action.cpp
src/notification/notification-helper/dbus-slots.h
src/notification/notification-helper/dbus-slots.cpp
src/notification/notification-helper/message.h
src/notification/notification-helper/message.cpp
src/notification/notification-helper/notification-helper.h
src/notification/notification-helper/notification-helper.cpp
)
# qrc文件
set(QRC_FILES qml/qml.qrc res/res.qrc)
# desktop file
set(DESKTOP_FILE data/ukui-sidebar.desktop)
# 翻译文件
file(GLOB TS_FILES "translations/*.ts")
# 更新翻译并创建.qm文件
qt5_create_translation(QM_FILES ${PROJECT_SOURCE_DIR} ${TS_FILES})
add_executable(
${PROJECT_NAME}
${QRC_FILES}
${QM_FILES}
${SOURCE_FILES}
${NOTIFICATION_SOURCE_FILES}
)
target_compile_definitions(${PROJECT_NAME} PRIVATE $<$<CONFIG:Debug>:QT_QML_DEBUG>)
target_link_libraries(${PROJECT_NAME}
PRIVATE
Qt5::Core
Qt5::Gui
Qt5::Quick
Qt5::Widgets
Qt5::DBus
Qt5::X11Extras
KF5::WindowSystem
qtsingleapplication
ukui-shortcut
${UKUI_SIDEBAR_EXTERNAL_LIBS}
)
# 安装ukui-menu
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION "/usr/bin")
# 安装翻译文件
install(FILES ${QM_FILES} DESTINATION "${TRANSLATION_FILE_DIR}")
# 安装desktop文件
install(FILES ${DESKTOP_FILE} DESTINATION "/etc/xdg/autostart")
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/kylinsoft-contributor/ukui-sidebar.git
git@gitee.com:kylinsoft-contributor/ukui-sidebar.git
kylinsoft-contributor
ukui-sidebar
ukui-sidebar
upstream

搜索帮助

344bd9b3 5694891 D2dac590 5694891