cmake: Use target-based ecm_qt_declare_logging_category()

This makes CMakeLists.txt code depend less on variables.
This commit is contained in:
Vlad Zahorodnii 2022-02-13 12:17:48 +02:00
parent ead073b0cc
commit 3da9e017a0
8 changed files with 48 additions and 39 deletions

View file

@ -1,14 +1,18 @@
set(VIRTUAL_SOURCES
add_library(KWinWaylandVirtualBackend MODULE)
target_sources(KWinWaylandVirtualBackend PRIVATE
egl_gbm_backend.cpp
scene_qpainter_virtual_backend.cpp
virtual_backend.cpp
virtual_output.cpp
)
include(ECMQtDeclareLoggingCategory)
ecm_qt_declare_logging_category(VIRTUAL_SOURCES HEADER logging.h IDENTIFIER KWIN_VIRTUAL CATEGORY_NAME kwin_platform_virtual DEFAULT_SEVERITY Critical)
ecm_qt_declare_logging_category(KWinWaylandVirtualBackend
HEADER logging.h
IDENTIFIER KWIN_VIRTUAL
CATEGORY_NAME kwin_platform_virtual
DEFAULT_SEVERITY Critical
)
add_library(KWinWaylandVirtualBackend MODULE ${VIRTUAL_SOURCES})
set_target_properties(KWinWaylandVirtualBackend PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/org.kde.kwin.waylandbackends/")
target_link_libraries(KWinWaylandVirtualBackend kwin)

View file

@ -9,13 +9,13 @@ set(screenshot_SOURCES
screenshotdbusinterface2.cpp
)
ecm_qt_declare_logging_category(screenshot_SOURCES
qt_add_dbus_adaptor(screenshot_SOURCES org.kde.KWin.ScreenShot2.xml screenshotdbusinterface2.h KWin::ScreenShotDBusInterface2)
kwin4_add_effect_module(kwin4_effect_screenshot ${screenshot_SOURCES})
ecm_qt_declare_logging_category(kwin4_effect_screenshot
HEADER screenshotlogging.h
IDENTIFIER KWIN_SCREENSHOT
CATEGORY_NAME kwin_effect_screenshot
DEFAULT_SEVERITY Warning
)
qt_add_dbus_adaptor(screenshot_SOURCES org.kde.KWin.ScreenShot2.xml screenshotdbusinterface2.h KWin::ScreenShotDBusInterface2)
kwin4_add_effect_module(kwin4_effect_screenshot ${screenshot_SOURCES})

View file

@ -1,9 +1,10 @@
set(kwin_wayland_wrapper_SOURCES
add_executable(kwin_wayland_wrapper)
target_sources(kwin_wayland_wrapper PRIVATE
kwin_wrapper.cpp
wl-socket.c
)
ecm_qt_declare_logging_category(kwin_wayland_wrapper_SOURCES
ecm_qt_declare_logging_category(kwin_wayland_wrapper
HEADER
wrapper_logging.h
IDENTIFIER
@ -14,8 +15,6 @@ ecm_qt_declare_logging_category(kwin_wayland_wrapper_SOURCES
Warning
)
add_executable(kwin_wayland_wrapper ${kwin_wayland_wrapper_SOURCES})
target_link_libraries(kwin_wayland_wrapper Qt5::Core Qt5::DBus KF5::DBusAddons KWinXwaylandCommon)
set_property(TARGET kwin_wayland_wrapper PROPERTY C_STANDARD 11)
install(TARGETS kwin_wayland_wrapper ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})

View file

@ -1,10 +1,11 @@
set(colordintegration_SOURCES
add_library(colordintegration MODULE)
target_sources(colordintegration PRIVATE
colorddevice.cpp
colordintegration.cpp
main.cpp
)
ecm_qt_declare_logging_category(colordintegration_SOURCES
ecm_qt_declare_logging_category(colordintegration
HEADER colordlogging.h
IDENTIFIER KWIN_COLORD
CATEGORY_NAME kwin_colord
@ -12,6 +13,7 @@ ecm_qt_declare_logging_category(colordintegration_SOURCES
DESCRIPTION "KWin colord integration"
)
set(colordintegration_xml_SOURCES)
set(COLORD_DEVICE_XML org.freedesktop.ColorManager.Device.xml)
set(COLORD_PROFILE_XML org.freedesktop.ColorManager.Profile.xml)
set(COLORD_MANAGER_XML org.freedesktop.ColorManager.xml)
@ -19,19 +21,19 @@ set(COLORD_MANAGER_XML org.freedesktop.ColorManager.xml)
set_source_files_properties(${COLORD_MANAGER_XML} PROPERTIES INCLUDE "colordtypes.h")
set_source_files_properties(${COLORD_MANAGER_XML} PROPERTIES NO_NAMESPACE true)
set_source_files_properties(${COLORD_MANAGER_XML} PROPERTIES CLASSNAME CdInterface)
qt_add_dbus_interface(colordintegration_SOURCES ${COLORD_MANAGER_XML} colordinterface)
qt_add_dbus_interface(colordintegration_xml_SOURCES ${COLORD_MANAGER_XML} colordinterface)
set_source_files_properties(${COLORD_DEVICE_XML} PROPERTIES INCLUDE "colordtypes.h")
set_source_files_properties(${COLORD_DEVICE_XML} PROPERTIES NO_NAMESPACE true)
set_source_files_properties(${COLORD_DEVICE_XML} PROPERTIES CLASSNAME CdDeviceInterface)
qt_add_dbus_interface(colordintegration_SOURCES ${COLORD_DEVICE_XML} colorddeviceinterface)
qt_add_dbus_interface(colordintegration_xml_SOURCES ${COLORD_DEVICE_XML} colorddeviceinterface)
set_source_files_properties(${COLORD_PROFILE_XML} PROPERTIES INCLUDE "colordtypes.h")
set_source_files_properties(${COLORD_PROFILE_XML} PROPERTIES NO_NAMESPACE true)
set_source_files_properties(${COLORD_PROFILE_XML} PROPERTIES CLASSNAME CdProfileInterface)
qt_add_dbus_interface(colordintegration_SOURCES ${COLORD_PROFILE_XML} colordprofileinterface)
qt_add_dbus_interface(colordintegration_xml_SOURCES ${COLORD_PROFILE_XML} colordprofileinterface)
add_library(colordintegration MODULE ${colordintegration_SOURCES})
target_sources(colordintegration PRIVATE ${colordintegration_xml_SOURCES})
set_target_properties(colordintegration PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/kwin/plugins/")
target_link_libraries(colordintegration kwin)
install(TARGETS colordintegration DESTINATION ${KDE_INSTALL_PLUGINDIR}/kwin/plugins/)

View file

@ -1,4 +1,5 @@
set(nightcolor_SOURCES
add_library(KWinNightColorPlugin SHARED)
target_sources(KWinNightColorPlugin PRIVATE
clockskewnotifier.cpp
clockskewnotifierengine.cpp
nightcolordbusinterface.cpp
@ -7,18 +8,18 @@ set(nightcolor_SOURCES
suncalc.cpp
)
ecm_qt_declare_logging_category(nightcolor_SOURCES
ecm_qt_declare_logging_category(KWinNightColorPlugin
HEADER nightcolorlogging.h
IDENTIFIER KWIN_NIGHTCOLOR
CATEGORY_NAME kwin_nightcolor
DEFAULT_SEVERITY Critical
)
kconfig_add_kcfg_files(nightcolor_SOURCES nightcolorsettings.kcfgc)
qt_add_dbus_adaptor(nightcolor_SOURCES org.kde.kwin.ColorCorrect.xml
nightcolordbusinterface.h KWin::NightColorDBusInterface)
kconfig_add_kcfg_files(KWinNightColorPlugin nightcolorsettings.kcfgc)
add_library(KWinNightColorPlugin SHARED ${nightcolor_SOURCES})
set(nightcolor_xml_SOURCES)
qt_add_dbus_adaptor(nightcolor_xml_SOURCES org.kde.kwin.ColorCorrect.xml nightcolordbusinterface.h KWin::NightColorDBusInterface)
target_sources(KWinNightColorPlugin PRIVATE ${nightcolor_xml_SOURCES})
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
target_sources(KWinNightColorPlugin PRIVATE clockskewnotifierengine_linux.cpp)

View file

@ -1,4 +1,5 @@
set(QPA_SOURCES
add_library(KWinQpaPlugin OBJECT)
target_sources(KWinQpaPlugin PRIVATE
backingstore.cpp
eglhelpers.cpp
eglplatformcontext.cpp
@ -10,10 +11,13 @@ set(QPA_SOURCES
window.cpp
)
include(ECMQtDeclareLoggingCategory)
ecm_qt_declare_logging_category(QPA_SOURCES HEADER logging.h IDENTIFIER KWIN_QPA CATEGORY_NAME kwin_qpa_plugin DEFAULT_SEVERITY Critical)
ecm_qt_declare_logging_category(KWinQpaPlugin
HEADER logging.h
IDENTIFIER KWIN_QPA
CATEGORY_NAME kwin_qpa_plugin
DEFAULT_SEVERITY Critical
)
add_library(KWinQpaPlugin OBJECT ${QPA_SOURCES})
target_compile_definitions(KWinQpaPlugin PRIVATE QT_STATICPLUGIN)
target_link_libraries(KWinQpaPlugin PRIVATE

View file

@ -1,4 +1,5 @@
set(screencast_SOURCES
add_library(KWinScreencastPlugin OBJECT)
target_sources(KWinScreencastPlugin PRIVATE
eglnativefence.cpp
main.cpp
outputscreencastsource.cpp
@ -9,13 +10,12 @@ set(screencast_SOURCES
windowscreencastsource.cpp
)
ecm_qt_declare_logging_category(screencast_SOURCES
ecm_qt_declare_logging_category(KWinScreencastPlugin
HEADER kwinscreencast_logging.h
IDENTIFIER KWIN_SCREENCAST
CATEGORY_NAME kwin_screencast
DEFAULT_SEVERITY Warning
)
add_library(KWinScreencastPlugin OBJECT ${screencast_SOURCES})
target_compile_definitions(KWinScreencastPlugin PRIVATE QT_STATICPLUGIN)
target_link_libraries(KWinScreencastPlugin kwin PkgConfig::PipeWire)

View file

@ -1,4 +1,9 @@
ecm_qt_declare_logging_category(xwaylandliblogging_SOURCES
add_library(KWinXwaylandCommon STATIC
xwaylandsocket.cpp
xauthority.cpp
)
ecm_qt_declare_logging_category(KWinXwaylandCommon
HEADER
xwayland_logging.h
IDENTIFIER
@ -9,11 +14,5 @@ ecm_qt_declare_logging_category(xwaylandliblogging_SOURCES
Warning
)
add_library(KWinXwaylandCommon STATIC
xwaylandsocket.cpp
xauthority.cpp
${xwaylandliblogging_SOURCES}
)
target_include_directories(KWinXwaylandCommon PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(KWinXwaylandCommon Qt::Core Qt::Network)