1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-23 01:33:50 +03:00

Improving readability of CMakeLists

This commit is contained in:
Johan Smith Agudelo Rodriguez 2017-02-15 22:14:37 -05:00
parent 0d325f827f
commit 1677e2a041
14 changed files with 136 additions and 233 deletions

View File

@ -13,14 +13,10 @@ set(KF5_MIN_VERSION "5.26.0")
set(KF5_LOCALE_PREFIX "")
include(Definitions.cmake)
find_package(ECM 1.8.0 REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED NO_MODULE COMPONENTS Quick Qml)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Plasma PlasmaQuick WindowSystem Declarative Activities
I18n CoreAddons XmlGui DBusAddons IconThemes Wayland)
@ -38,107 +34,21 @@ if(X11_FOUND)
endif()
if(X11_FOUND AND XCB_XCB_FOUND)
set(HAVE_X11 true)
set(HAVE_X11 ON)
endif()
FIND_PROGRAM(GETTEXT_MSGFMT_EXECUTABLE msgfmt)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(CMakePackageConfigHelpers)
include(WriteBasicConfigVersionFile)
include(CheckIncludeFiles)
include(ECMOptionalAddSubdirectory)
include(ECMQtDeclareLoggingCategory)
include(KDEPackageAppTemplates)
IF(NOT GETTEXT_MSGFMT_EXECUTABLE)
MESSAGE(
"------
NOTE: msgfmt not found. Translations will *not* be installed
------")
ELSE(NOT GETTEXT_MSGFMT_EXECUTABLE)
#containment translations
SET(catalogname plasma_applet_org.kde.latte.containment)
ADD_CUSTOM_TARGET(translations-containment ALL)
FILE(GLOB PO_FILES po/containment/*.po)
FOREACH(_poFile ${PO_FILES})
GET_FILENAME_COMPONENT(_poFileName ${_poFile} NAME)
STRING(REGEX REPLACE "^${catalogname}_?" "" _langCode ${_poFileName} )
STRING(REGEX REPLACE "\\.po$" "" _langCode ${_langCode} )
IF( _langCode )
GET_FILENAME_COMPONENT(_lang ${_poFile} NAME_WE)
SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/containment/${_lang}.gmo)
ADD_CUSTOM_COMMAND(TARGET translations-containment
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_poFile}
DEPENDS ${_poFile})
INSTALL(FILES ${_gmoFile} DESTINATION ${LOCALE_INSTALL_DIR}/${KF5_LOCALE_PREFIX}${_langCode}/LC_MESSAGES/ RENAME ${catalogname}.mo)
ENDIF( _langCode )
ENDFOREACH(_poFile ${PO_FILES})
#plasmoid translations
SET(catalogname-plasmoid plasma_applet_org.kde.latte.plasmoid)
ADD_CUSTOM_TARGET(translations-plasmoid ALL)
FILE(GLOB PO_FILES_PLASMOID po/plasmoid/*.po)
FOREACH(_poFile ${PO_FILES_PLASMOID})
GET_FILENAME_COMPONENT(_poFileName ${_poFile} NAME)
STRING(REGEX REPLACE "^${catalogname-plasmoid}_?" "" _langCode ${_poFileName} )
STRING(REGEX REPLACE "\\.po$" "" _langCode ${_langCode} )
IF( _langCode )
GET_FILENAME_COMPONENT(_lang ${_poFile} NAME_WE)
SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/plasmoid/${_lang}.gmo)
ADD_CUSTOM_COMMAND(TARGET translations-plasmoid
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_poFile}
DEPENDS ${_poFile})
INSTALL(FILES ${_gmoFile} DESTINATION ${LOCALE_INSTALL_DIR}/${KF5_LOCALE_PREFIX}${_langCode}/LC_MESSAGES/ RENAME ${catalogname-plasmoid}.mo)
ENDIF( _langCode )
ENDFOREACH(_poFile ${PO_FILES})
#shell translations
#SET(catalogname-shell plasma_shell_org.kde.latte.shell)
#ADD_CUSTOM_TARGET(translations-shell ALL)
#FILE(GLOB PO_FILES_SHELL po/shell/*.po)
#FOREACH(_poFile ${PO_FILES_SHELL})
# GET_FILENAME_COMPONENT(_poFileName ${_poFile} NAME)
# STRING(REGEX REPLACE "^${catalogname-shell}_?" "" _langCode ${_poFileName} )
# STRING(REGEX REPLACE "\\.po$" "" _langCode ${_langCode} )
# IF( _langCode )
# GET_FILENAME_COMPONENT(_lang ${_poFile} NAME_WE)
# SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/shell/${_lang}.gmo)
# ADD_CUSTOM_COMMAND(TARGET translations-shell
# COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_poFile}
# DEPENDS ${_poFile})
# INSTALL(FILES ${_gmoFile} DESTINATION ${LOCALE_INSTALL_DIR}/${KF5_LOCALE_PREFIX}${_langCode}/LC_MESSAGES/ RENAME ${catalogname-shell}.mo)
# ENDIF( _langCode )
#ENDFOREACH(_poFile ${PO_FILES})
#app translations
SET(catalogname-app latte-dock)
ADD_CUSTOM_TARGET(translations-app ALL)
FILE(GLOB PO_FILES_CORONA po/app/*.po)
FOREACH(_poFile ${PO_FILES_CORONA})
GET_FILENAME_COMPONENT(_poFileName ${_poFile} NAME)
STRING(REGEX REPLACE "^${catalogname-app}_?" "" _langCode ${_poFileName} )
STRING(REGEX REPLACE "\\.po$" "" _langCode ${_langCode} )
IF( _langCode )
GET_FILENAME_COMPONENT(_lang ${_poFile} NAME_WE)
SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/app/${_lang}.gmo)
ADD_CUSTOM_COMMAND(TARGET translations-app
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_poFile}
DEPENDS ${_poFile})
INSTALL(FILES ${_gmoFile} DESTINATION ${LOCALE_INSTALL_DIR}/${KF5_LOCALE_PREFIX}${_langCode}/LC_MESSAGES/ RENAME ${catalogname-app}.mo)
ENDIF( _langCode )
ENDFOREACH(_poFile ${PO_FILES})
ENDIF(NOT GETTEXT_MSGFMT_EXECUTABLE)
include(Definitions.cmake)
include(Locale.cmake)
add_subdirectory(app)
add_subdirectory(liblattedock)

View File

@ -2,15 +2,8 @@ file(READ TRANSLATORS translators_str)
string(REGEX REPLACE "\n" ";" translators_list "${translators_str}")
list(GET translators_list 0 translators)
list(GET translators_list 1 translators_email)
add_definitions(
-DLATTE_VERSION="${VERSION}"
-DWEBSITE="${WEBSITE}"
-DBUG_ADDRESS="${BUG_ADDRESS}"
-DTRANSLATORS="${translators}"
-DTRANSLATORS_EMAIL="${translators_email}"
)
list(GET translators_list 0 TRANSLATORS)
list(GET translators_list 1 TRANSLATORS_EMAIL)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/app/config-latte.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/app/config-latte.h)

81
Locale.cmake Normal file
View File

@ -0,0 +1,81 @@
find_program(GETTEXT_MSGFMT_EXECUTABLE msgfmt)
if(NOT GETTEXT_MSGFMT_EXECUTABLE)
message(WARNING "-- msgfmt: not found. Translations will *not* be installed")
else()
#containment translations
set(catalogname plasma_applet_org.kde.latte.containment)
add_custom_target(translations-containment ALL)
file(GLOB PO_FILES po/containment/*.po)
foreach(_poFile ${PO_FILES})
get_filename_component(_poFileName ${_poFile} NAME)
string(REGEX REPLACE "^${catalogname}_?" "" _langCode ${_poFileName})
string(REGEX REPLACE "\\.po$" "" _langCode ${_langCode})
if(_langCode)
get_filename_component(_lang ${_poFile} NAME_WE)
set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/containment/${_lang}.gmo)
add_custom_command(TARGET translations-containment
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_poFile}
DEPENDS ${_poFile})
install(FILES ${_gmoFile}
DESTINATION ${LOCALE_INSTALL_DIR}/${KF5_LOCALE_PREFIX}${_langCode}/LC_MESSAGES/
RENAME ${catalogname}.mo)
endif()
endforeach()
#plasmoid translations
set(catalogname-plasmoid plasma_applet_org.kde.latte.plasmoid)
add_custom_target(translations-plasmoid ALL)
file(GLOB PO_FILES_PLASMOID po/plasmoid/*.po)
foreach(_poFile ${PO_FILES_PLASMOID})
get_filename_component(_poFileName ${_poFile} NAME)
string(REGEX REPLACE "^${catalogname-plasmoid}_?" "" _langCode ${_poFileName})
string(REGEX REPLACE "\\.po$" "" _langCode ${_langCode})
if(_langCode)
get_filename_component(_lang ${_poFile} NAME_WE)
set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/plasmoid/${_lang}.gmo)
add_custom_command(TARGET translations-plasmoid
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_poFile}
DEPENDS ${_poFile})
install(FILES ${_gmoFile}
DESTINATION ${LOCALE_INSTALL_DIR}/${KF5_LOCALE_PREFIX}${_langCode}/LC_MESSAGES/
RENAME ${catalogname-plasmoid}.mo)
endif()
endforeach()
#app translations
set(catalogname-app latte-dock)
add_custom_target(translations-app ALL)
file(GLOB PO_FILES_CORONA po/app/*.po)
foreach(_poFile ${PO_FILES_CORONA})
get_filename_component(_poFileName ${_poFile} NAME)
string(REGEX REPLACE "^${catalogname-app}_?" "" _langCode ${_poFileName} )
string(REGEX REPLACE "\\.po$" "" _langCode ${_langCode} )
if(_langCode)
get_filename_component(_lang ${_poFile} NAME_WE)
set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/app/${_lang}.gmo)
add_custom_command(TARGET translations-app
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_poFile}
DEPENDS ${_poFile})
install(FILES ${_gmoFile}
DESTINATION ${LOCALE_INSTALL_DIR}/${KF5_LOCALE_PREFIX}${_langCode}/LC_MESSAGES/
RENAME ${catalogname-app}.mo)
endif()
endforeach()
endif()

View File

@ -1,16 +1,3 @@
include(KDEInstallDirs)
include(KDECMakeSettings)
#include(KDECompilerSettings NO_POLICY_SCOPE)
#include(ECMPackageConfigHelpers)
include(CMakePackageConfigHelpers)
include(WriteBasicConfigVersionFile)
include(CheckIncludeFiles)
include(ECMOptionalAddSubdirectory)
include(ECMQtDeclareLoggingCategory)
include(KDEPackageAppTemplates)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-latte.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-latte.h)
set(lattedock-app_SRCS
../liblattedock/dock.cpp
../liblattedock/windowsystem.cpp
@ -32,11 +19,9 @@ add_executable(latte-dock ${lattedock-app_SRCS})
include(FakeTarget.cmake)
target_link_libraries(
latte-dock
target_link_libraries(latte-dock
Qt5::Quick
Qt5::Qml
Qt5::X11Extras
KF5::I18n
KF5::Declarative
KF5::CoreAddons
@ -45,14 +30,17 @@ target_link_libraries(
KF5::PlasmaQuick
KF5::Activities
KF5::QuickAddons
KF5::WindowSystem
KF5::WaylandClient
)
if(HAVE_X11)
target_link_libraries(latte-dock ${X11_LIBRARIES} ${XCB_LIBRARIES})
target_link_libraries(latte-dock
Qt5::X11Extras
KF5::WindowSystem
${X11_LIBRARIES}
${XCB_LIBRARIES}
)
endif()
install(TARGETS latte-dock ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
#even if hidden, the desktop file is needed anyways for kdbusservice::unique
install(FILES latte-dock.desktop DESTINATION ${KDE_INSTALL_APPDIR})

View File

@ -1 +1,11 @@
#cmakedefine01 HAVE_X11
#cmakedefine VERSION "@VERSION@"
#cmakedefine WEBSITE "@WEBSITE@"
#cmakedefine BUG_ADDRESS "@BUG_ADDRESS@"
#cmakedefine TRANSLATORS "@TRANSLATORS@"
#cmakedefine TRANSLATORS_EMAIL "@TRANSLATORS_EMAIL@"

View File

@ -19,6 +19,7 @@
*/
#include "dockcorona.h"
#include "config-latte.h"
#include <memory>
@ -96,7 +97,7 @@ inline void configureAboutData()
{
KAboutData about(QStringLiteral("lattedock")
, QStringLiteral("Latte Dock")
, QStringLiteral(LATTE_VERSION)
, QStringLiteral(VERSION)
, i18n("Latte is a dock based on plasma frameworks that provides an elegant and "
"intuitive experience for your tasks and plasmoids. It animates its contents "
"by using parabolic zoom effect and trys to be there only when it is needed."

View File

@ -1,22 +0,0 @@
[Desktop Entry]
Encoding=UTF-8
_Name=Latte
_Comment=Containment provided for the Latte Dock
Type=Service
Keywords=
NoDisplay=true
X-KDE-PluginInfo-Author=@AUTHOR@
X-KDE-PluginInfo-Email=@EMAIL@
X-KDE-PluginInfo-Name=org.kde.latte.containment
X-KDE-PluginInfo-Version=@VERSION@
X-KDE-PluginInfo-Website=@WEBSITE@
X-KDE-PluginInfo-Category=
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
X-KDE-ServiceTypes=Plasma/Applet,Plasma/Containment
X-Plasma-API=declarativeappletscript
X-Plasma-MainScript=ui/main.qml
X-Plasma-ContainmentType=Panel

View File

@ -1,3 +1,2 @@
file(COPY "contents" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/release)
#update the version number in the configuration window
configure_file(metadata.desktop.cmake release/metadata.desktop)

View File

@ -11,4 +11,3 @@ THEME hicolor
DESTINATION ${ICON_INSTALL_DIR})
install(FILES org.kde.latte.plasmoid.svg DESTINATION ${ICON_INSTALL_DIR}/breeze/applets/256)

View File

@ -1,18 +1,3 @@
set (REQUIRED_QT_VERSION "5.6.0")
find_package(ECM 1.8.0 REQUIRED NO_MODULE)
find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE COMPONENTS Quick Qml)
find_package(KF5 REQUIRED COMPONENTS
WindowSystem
CoreAddons
Plasma
PlasmaQuick
IconThemes
)
set(CMAKE_AUTOMOC ON)
set(lattedock_SRCS
lattedockplugin.cpp
windowsystem.cpp
@ -25,7 +10,6 @@ add_library(lattedockplugin SHARED ${lattedock_SRCS})
target_link_libraries(lattedockplugin
Qt5::Quick
Qt5::Qml
KF5::WindowSystem
KF5::CoreAddons
KF5::Plasma
KF5::PlasmaQuick
@ -33,6 +17,9 @@ target_link_libraries(lattedockplugin
KF5::IconThemes
)
install(TARGETS lattedockplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/latte)
if(HAVE_X11)
target_link_libraries(lattedockplugin KF5::WindowSystem)
endif()
install(TARGETS lattedockplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/latte)
install(FILES qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/latte)

View File

@ -1,23 +0,0 @@
[Desktop Entry]
_Name=Latte Plasmoid
_Comment=Plasmoid from the Latte Dock
Type=Service
Icon=latte-dock
X-KDE-ServiceTypes=Plasma/Applet
X-Plasma-API=declarativeappletscript
X-Plasma-MainScript=ui/main.qml
X-Plasma-Provides=org.kde.plasma.multitasking
X-KDE-PluginInfo-Author=@AUTHOR@
X-KDE-PluginInfo-Email=@EMAIL@
X-KDE-PluginInfo-Name=org.kde.latte.plasmoid
X-KDE-PluginInfo-Version=@VERSION@
X-KDE-PluginInfo-Website=@WEBSITE@
X-KDE-PluginInfo-Category=Windows and Tasks
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL v2+
X-KDE-PluginInfo-EnabledByDefault=true

View File

@ -1,6 +1,2 @@
file(COPY "contents" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/release)
#update the version number in the configuration window
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/release/contents/ui/ConfigAppearance.qml.cmake)
configure_file(metadata.desktop.cmake release/metadata.desktop)
configure_file(contents/ui/ConfigAppearance.qml.cmake release/contents/ui/ConfigAppearance.qml)

View File

@ -1,16 +0,0 @@
[Desktop Entry]
Encoding=UTF-8
_Name=Latte Shell
_Comment=Shell provided for the Latte Dock
Keywords=shell
Type=Service
X-KDE-ServiceTypes=Plasma/Shell
X-KDE-ParentApp=latte-dock
X-KDE-PluginInfo-Author=@AUTHOR@
X-KDE-PluginInfo-Email=@EMAIL@
X-KDE-PluginInfo-License=GPLv3+
X-KDE-PluginInfo-Name=org.kde.latte.shell
X-KDE-PluginInfo-Version=@VERSION@
X-KDE-PluginInfo-Website=@WEBSITE@

View File

@ -1,3 +1,3 @@
file(COPY "contents" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/release)
file(COPY "defaults" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/release)
configure_file(metadata.desktop.cmake release/metadata.desktop)