CMakeLists.txt 20.9 KB
Newer Older
1
2
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)

3
project(KWIN)
4
set(PROJECT_VERSION "5.17.80")
5
set(PROJECT_VERSION_MAJOR 5)
6

7
set(QT_MIN_VERSION "5.12.0")
8
set(KF5_MIN_VERSION "5.62.0")
9

10
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
11

12
find_package(ECM 5.38 REQUIRED NO_MODULE)
13
14
15

include(FeatureSummary)
include(WriteBasicConfigVersionFile)
16
include(GenerateExportHeader)
17
18
19
20
21
22
23
24
25

# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})

find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
    Concurrent
    Core
    DBus
    Quick
26
    QuickWidgets
27
    Script
28
    Sensors
29
30
31
32
    UiTools
    Widgets
    X11Extras
)
33
34
35

find_package(Qt5Test ${QT_MIN_VERSION} CONFIG QUIET)
set_package_properties(Qt5Test PROPERTIES
36
37
38
    PURPOSE "Required for tests"
    TYPE OPTIONAL
)
39
40
41
42
43
44
45
add_feature_info("Qt5Test" Qt5Test_FOUND "Required for building tests")
if (NOT Qt5Test_FOUND)
    set(BUILD_TESTING OFF CACHE BOOL "Build the testing tree.")
endif()

include(KDEInstallDirs)
include(KDECMakeSettings)
46
include(KDECompilerSettings NO_POLICY_SCOPE)
David Edmundson's avatar
David Edmundson committed
47
include(KDEClangFormat)
48
49

include(ECMInstallIcons)
50
include(ECMOptionalAddSubdirectory)
51

52
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0 -DQT_USE_QSTRINGBUILDER -DQT_NO_URL_CAST_FROM_STRING)
53

Martin Flöser's avatar
Martin Flöser committed
54
set(CMAKE_CXX_STANDARD 14)
Martin Flöser's avatar
Martin Flöser committed
55
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Martin Flöser's avatar
Martin Flöser committed
56

57
58
find_package(Qt5Multimedia QUIET)
set_package_properties(Qt5Multimedia PROPERTIES
59
60
61
    PURPOSE "Runtime-only dependency for effect video playback"
    TYPE RUNTIME
)
62
63

# required frameworks by Core
64
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
65
66
67
68
69
70
    Config
    ConfigWidgets
    CoreAddons
    Crash
    GlobalAccel
    I18n
71
72
    IconThemes
    IdleTime
73
    Init
74
    Notifications
75
    Package
76
    Plasma
77
    Wayland
78
79
80
81
    WidgetsAddons
    WindowSystem
)
# required frameworks by config modules
82
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
83
    Completion
84
    Declarative
85
86
87
    KCMUtils
    KIO
    NewStuff
88
    Service
89
    TextWidgets
90
91
92
    XmlGui
)

93
94
find_package(Threads)
set_package_properties(Threads PROPERTIES
95
96
97
    PURPOSE "Needed for VirtualTerminal support in KWin Wayland"
    TYPE REQUIRED
)
98

99
# optional frameworks
100
find_package(KF5Activities ${KF5_MIN_VERSION} CONFIG)
101
set_package_properties(KF5Activities PROPERTIES
102
103
104
    PURPOSE "Enable building of KWin with kactivities support"
    TYPE OPTIONAL
)
105
106
add_feature_info("KF5Activities" KF5Activities_FOUND "Enable building of KWin with kactivities support")

107
find_package(KF5DocTools ${KF5_MIN_VERSION} CONFIG)
108
set_package_properties(KF5DocTools PROPERTIES
109
110
111
    PURPOSE "Enable building documentation"
    TYPE OPTIONAL
)
112
add_feature_info("KF5DocTools" KF5DocTools_FOUND "Enable building documentation")
113

114
115
116
117
118
119
120
find_package(KF5Kirigami2 ${KF5_MIN_VERSION} CONFIG)
set_package_properties(KF5Kirigami2 PROPERTIES
    DESCRIPTION "A QtQuick based components set"
    PURPOSE "Required at runtime for Virtual desktop KCM and the virtual keyboard"
    TYPE RUNTIME
)

121
find_package(KDecoration2 5.13.0 CONFIG REQUIRED)
122

123
124
find_package(KScreenLocker CONFIG REQUIRED)
set_package_properties(KScreenLocker PROPERTIES
125
126
127
    TYPE REQUIRED
    PURPOSE "For screenlocker integration in kwin_wayland"
)
128

Martin Flöser's avatar
Martin Flöser committed
129
find_package(Breeze 5.9.0 CONFIG)
130
set_package_properties(Breeze PROPERTIES
131
132
133
134
135
    TYPE OPTIONAL
    PURPOSE "For setting the default window decoration plugin"
)
if (${Breeze_FOUND})
    if (${BREEZE_WITH_KDECORATION})
136
137
138
139
140
141
142
143
144
        set(HAVE_BREEZE_DECO true)
    else()
        set(HAVE_BREEZE_DECO FALSE)
    endif()
else()
    set(HAVE_BREEZE_DECO FALSE)
endif()
add_feature_info("Breeze-Decoration" HAVE_BREEZE_DECO "Default decoration plugin Breeze")

145
146
find_package(EGL)
set_package_properties(EGL PROPERTIES
147
148
149
    TYPE RUNTIME
    PURPOSE "Required to build KWin with EGL support"
)
150

Fredrik Höglund's avatar
Fredrik Höglund committed
151
find_package(epoxy)
152
153
154
155
156
157
set_package_properties(epoxy PROPERTIES
    DESCRIPTION "libepoxy"
    URL "https://github.com/anholt/libepoxy"
    TYPE REQUIRED
    PURPOSE "OpenGL dispatch library"
)
Fredrik Höglund's avatar
Fredrik Höglund committed
158

159
set(HAVE_DL_LIBRARY FALSE)
160
if (epoxy_HAS_GLX)
161
    find_library(DL_LIBRARY dl)
162
    if (DL_LIBRARY)
163
164
165
166
        set(HAVE_DL_LIBRARY TRUE)
    endif()
endif()

167
find_package(Wayland 1.2 REQUIRED COMPONENTS Cursor OPTIONAL_COMPONENTS Egl)
168
set_package_properties(Wayland PROPERTIES
169
170
171
    TYPE REQUIRED
    PURPOSE "Required for building KWin with Wayland support"
)
172
173
add_feature_info("Wayland::EGL" Wayland_Egl_FOUND "Enable building of Wayland backend and QPA with EGL support.")
set(HAVE_WAYLAND_EGL FALSE)
174
if (Wayland_Egl_FOUND)
175
176
    set(HAVE_WAYLAND_EGL TRUE)
endif()
177

178
find_package(XKB 0.7.0)
179
set_package_properties(XKB PROPERTIES
180
181
182
    TYPE REQUIRED
    PURPOSE "Required for building KWin with Wayland support"
)
183

Martin Flöser's avatar
Martin Flöser committed
184
find_package(Libinput 1.9)
Martin Flöser's avatar
Martin Flöser committed
185
set_package_properties(Libinput PROPERTIES TYPE REQUIRED PURPOSE "Required for input handling on Wayland.")
Martin Flöser's avatar
Martin Flöser committed
186
187

find_package(UDev)
188
set_package_properties(UDev PROPERTIES
189
    URL "https://www.freedesktop.org/wiki/Software/systemd/"
190
191
192
193
    DESCRIPTION "Linux device library."
    TYPE REQUIRED
    PURPOSE "Required for input handling on Wayland."
)
Martin Flöser's avatar
Martin Flöser committed
194

195
find_package(Libdrm 2.4.62)
196
197
set_package_properties(Libdrm PROPERTIES TYPE OPTIONAL PURPOSE "Required for drm output on Wayland.")
set(HAVE_DRM FALSE)
198
if (Libdrm_FOUND)
199
200
201
    set(HAVE_DRM TRUE)
endif()

202
find_package(gbm)
Yuri Chornoivan's avatar
Yuri Chornoivan committed
203
set_package_properties(gbm PROPERTIES TYPE OPTIONAL PURPOSE "Required for egl output of drm backend.")
204
set(HAVE_GBM FALSE)
205
if (HAVE_DRM AND gbm_FOUND)
206
207
208
    set(HAVE_GBM TRUE)
endif()

209
option(KWIN_BUILD_EGL_STREAM_BACKEND "Enable building of EGLStream based DRM backend" ON)
210
if (HAVE_DRM AND KWIN_BUILD_EGL_STREAM_BACKEND)
211
212
213
    set(HAVE_EGL_STREAMS TRUE)
endif()

214
215
find_package(libhybris)
set_package_properties(libhybris PROPERTIES TYPE OPTIONAL PURPOSE "Required for libhybris backend")
Martin Flöser's avatar
Martin Flöser committed
216
set(HAVE_LIBHYBRIS ${libhybris_FOUND})
217

218
find_package(X11)
219
220
221
222
223
set_package_properties(X11 PROPERTIES
    DESCRIPTION "X11 libraries"
    URL "https://www.x.org"
    TYPE REQUIRED
)
224
225
add_feature_info("XInput" X11_Xinput_FOUND "Required for poll-free mouse cursor updates")
set(HAVE_X11_XINPUT ${X11_Xinput_FOUND})
226
227

# All the required XCB components
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
find_package(XCB 1.10 REQUIRED COMPONENTS
    COMPOSITE
    CURSOR
    DAMAGE
    GLX
    ICCCM
    IMAGE
    KEYSYMS
    RANDR
    RENDER
    SHAPE
    SHM
    SYNC
    XCB
    XFIXES
243
244
245
246
)
set_package_properties(XCB PROPERTIES TYPE REQUIRED)

# and the optional XCB dependencies
247
248
249
if (XCB_ICCCM_VERSION VERSION_LESS "0.4")
    set(XCB_ICCCM_FOUND FALSE)
endif()
250
251
add_feature_info("XCB-ICCCM" XCB_ICCCM_FOUND "Required for building test applications for KWin")

252
253
find_package(X11_XCB)
set_package_properties(X11_XCB PROPERTIES
254
255
256
    PURPOSE "Required for building X11 windowed backend of kwin_wayland"
    TYPE OPTIONAL
)
257

258
# dependencies for QPA plugin
Martin Flöser's avatar
Martin Flöser committed
259
260
261
find_package(Qt5FontDatabaseSupport REQUIRED)
find_package(Qt5ThemeSupport REQUIRED)
find_package(Qt5EventDispatcherSupport REQUIRED)
262

263
find_package(Freetype REQUIRED)
264
265
266
267
268
269
set_package_properties(Freetype PROPERTIES
    DESCRIPTION "A font rendering engine"
    URL "https://www.freetype.org"
    TYPE REQUIRED
    PURPOSE "Needed for KWin's QPA plugin."
)
270
find_package(Fontconfig REQUIRED)
271
set_package_properties(Fontconfig PROPERTIES
272
273
274
    TYPE REQUIRED
    PURPOSE "Needed for KWin's QPA plugin."
)
275

276
277
find_package(Xwayland)
set_package_properties(Xwayland PROPERTIES
Volker Krause's avatar
Volker Krause committed
278
    URL "https://x.org"
279
280
281
    DESCRIPTION "Xwayland X server"
    TYPE RUNTIME
    PURPOSE "Needed for running kwin_wayland"
282
)
283

284
285
286
287
288
289
290
find_package(Libcap)
set_package_properties(Libcap PROPERTIES
    TYPE OPTIONAL
    PURPOSE "Needed for running kwin_wayland with real-time scheduling policy"
)
set(HAVE_LIBCAP ${Libcap_FOUND})

291
292
293
294
295
296
297
298
299
300
301
include(ECMQMLModules)
ecm_find_qmlmodule(QtQuick 2.3)
ecm_find_qmlmodule(QtQuick.Controls 1.2)
ecm_find_qmlmodule(QtQuick.Layouts 1.3)
ecm_find_qmlmodule(QtQuick.VirtualKeyboard 2.1)
ecm_find_qmlmodule(QtQuick.Window 2.1)
ecm_find_qmlmodule(QtMultimedia 5.0)
ecm_find_qmlmodule(org.kde.kquickcontrolsaddons 2.0)
ecm_find_qmlmodule(org.kde.plasma.core 2.0)
ecm_find_qmlmodule(org.kde.plasma.components 2.0)

302
########### configure tests ###############
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
303
304
305
306
307
308
include(CMakeDependentOption)

option(KWIN_BUILD_DECORATIONS "Enable building of KWin decorations." ON)
option(KWIN_BUILD_KCMS "Enable building of KWin configuration modules." ON)
option(KWIN_BUILD_TABBOX "Enable building of KWin Tabbox functionality" ON)
option(KWIN_BUILD_XRENDER_COMPOSITING "Enable building of KWin with XRender Compositing support" ON)
309
cmake_dependent_option(KWIN_BUILD_ACTIVITIES "Enable building of KWin with kactivities support" ON "KF5Activities_FOUND" OFF)
310

311
312
# Binary name of KWin
set(KWIN_NAME "kwin")
Hrvoje Senjan's avatar
Hrvoje Senjan committed
313
314
set(KWIN_INTERNAL_NAME_X11 "kwin_x11")
set(KWIN_INTERNAL_NAME_WAYLAND "kwin_wayland")
315
set(KWIN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
316

317
# KWIN_HAVE_XRENDER_COMPOSITING - whether XRender-based compositing support is available: may be disabled
318
319
if (KWIN_BUILD_XRENDER_COMPOSITING)
    set(KWIN_HAVE_XRENDER_COMPOSITING 1)
Martin Flöser's avatar
Martin Flöser committed
320
endif()
321

322
include_directories(${XKB_INCLUDE_DIR})
323

324
include_directories(${epoxy_INCLUDE_DIR})
325
set(HAVE_EPOXY_GLX ${epoxy_HAS_GLX})
326

327
# for things that are also used by kwin libraries
328
configure_file(libkwineffects/kwinconfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/libkwineffects/kwinconfig.h )
329
# for kwin internal things
330
set(HAVE_X11_XCB ${X11_XCB_FOUND})
331

332
include(CheckIncludeFile)
333
include(CheckIncludeFiles)
334
include(CheckSymbolExists)
335
336
check_include_files(unistd.h HAVE_UNISTD_H)
check_include_files(malloc.h HAVE_MALLOC_H)
337
338
339

check_include_file("sys/prctl.h" HAVE_SYS_PRCTL_H)
check_symbol_exists(PR_SET_DUMPABLE "sys/prctl.h" HAVE_PR_SET_DUMPABLE)
340
check_symbol_exists(PR_SET_PDEATHSIG "sys/prctl.h" HAVE_PR_SET_PDEATHSIG)
341
342
343
344
345
346
347
348
check_include_file("sys/procctl.h" HAVE_SYS_PROCCTL_H)
check_symbol_exists(PROC_TRACE_CTL "sys/procctl.h" HAVE_PROC_TRACE_CTL)
if (HAVE_PR_SET_DUMPABLE OR HAVE_PROC_TRACE_CTL)
    set(CAN_DISABLE_PTRACE TRUE)
endif()
add_feature_info("prctl/procctl tracing control"
                 CAN_DISABLE_PTRACE
                 "Required for disallowing ptrace on kwin_wayland process")
349

350
check_include_file("sys/sysmacros.h" HAVE_SYS_SYSMACROS_H)
351

352
353
354
355
356
357
358
359
check_include_file("linux/vt.h" HAVE_LINUX_VT_H)
add_feature_info("linux/vt.h"
                 HAVE_LINUX_VT_H
                 "Required for virtual terminal support under wayland")
check_include_file("linux/fb.h"    HAVE_LINUX_FB_H)
add_feature_info("linux/fb.h"
                 HAVE_LINUX_FB_H
                 "Required for the fbdev backend")
360

361
362
363
364
365
check_symbol_exists(SCHED_RESET_ON_FORK "sched.h" HAVE_SCHED_RESET_ON_FORK)
add_feature_info("SCHED_RESET_ON_FORK"
                 HAVE_SCHED_RESET_ON_FORK
                 "Required for running kwin_wayland with real-time scheduling")

366
configure_file(config-kwin.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kwin.h)
367

368
########### global ###############
369
set(kwin_effects_dbus_xml ${CMAKE_CURRENT_SOURCE_DIR}/org.kde.kwin.Effects.xml)
370

371
include_directories(BEFORE
372
    ${CMAKE_CURRENT_BINARY_DIR}/libkwineffects
373
    ${CMAKE_CURRENT_BINARY_DIR}
374
    ${CMAKE_CURRENT_SOURCE_DIR}/libkwineffects
375
    ${CMAKE_CURRENT_SOURCE_DIR}/effects
376
    ${CMAKE_CURRENT_SOURCE_DIR}/tabbox
377
    ${CMAKE_CURRENT_SOURCE_DIR}/platformsupport
378
)
379

380
381
382
add_subdirectory(libkwineffects)
if (KWIN_BUILD_KCMS)
    add_subdirectory(kcmkwin)
Martin Flöser's avatar
Martin Flöser committed
383
endif()
384

385
add_subdirectory(data)
386

387
388
389
add_subdirectory(effects)
add_subdirectory(scripts)
add_subdirectory(tabbox)
390
add_subdirectory(scripting)
391
add_subdirectory(helpers)
392

393
394
395
########### next target ###############

set(kwin_KDEINIT_SRCS
396
397
    abstract_client.cpp
    abstract_opengl_context_attribute_builder.cpp
Roman Gilg's avatar
Roman Gilg committed
398
    abstract_output.cpp
399
    abstract_wayland_output.cpp
400
    activation.cpp
Kai Uwe Broulik's avatar
Kai Uwe Broulik committed
401
    appmenu.cpp
402
403
    atoms.cpp
    client_machine.cpp
404
    colorcorrection/colorcorrectdbusinterface.cpp
405
    colorcorrection/manager.cpp
406
    colorcorrection/suncalc.cpp
407
408
409
410
411
412
413
414
415
416
417
418
419
    composite.cpp
    cursor.cpp
    dbusinterface.cpp
    debug_console.cpp
    decorations/decoratedclient.cpp
    decorations/decorationbridge.cpp
    decorations/decorationpalette.cpp
    decorations/decorationrenderer.cpp
    decorations/decorations_logging.cpp
    decorations/settings.cpp
    deleted.cpp
    effectloader.cpp
    effects.cpp
420
    egl_context_attribute_builder.cpp
421
422
423
424
425
426
427
    events.cpp
    focuschain.cpp
    geometry.cpp
    geometrytip.cpp
    gestures.cpp
    globalshortcuts.cpp
    group.cpp
428
    idle_inhibition.cpp
429
430
431
432
433
434
435
436
437
438
    input.cpp
    input_event.cpp
    input_event_spy.cpp
    internal_client.cpp
    keyboard_input.cpp
    keyboard_layout.cpp
    keyboard_layout_switching.cpp
    keyboard_repeat.cpp
    killwindow.cpp
    layers.cpp
Martin Flöser's avatar
Martin Flöser committed
439
    libinput/connection.cpp
440
    libinput/context.cpp
Martin Flöser's avatar
Martin Flöser committed
441
442
443
    libinput/device.cpp
    libinput/events.cpp
    libinput/libinput_logging.cpp
Roman Gilg's avatar
Roman Gilg committed
444
    linux_dmabuf.cpp
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
    logind.cpp
    main.cpp
    modifier_only_shortcuts.cpp
    moving_client_x11_filter.cpp
    netinfo.cpp
    onscreennotification.cpp
    options.cpp
    orientation_sensor.cpp
    osd.cpp
    outline.cpp
    outputscreens.cpp
    overlaywindow.cpp
    placement.cpp
    platform.cpp
    pointer_input.cpp
    popup_input_filter.cpp
    rootinfo_filter.cpp
    rules.cpp
    scene.cpp
    screenedge.cpp
    screenlockerwatcher.cpp
    screens.cpp
    scripting/dbuscall.cpp
    scripting/meta.cpp
    scripting/screenedgeitem.cpp
    scripting/scriptedeffect.cpp
    scripting/scripting.cpp
    scripting/scripting_logging.cpp
    scripting/scripting_model.cpp
    scripting/scriptingutils.cpp
    scripting/timer.cpp
    scripting/workspace_wrapper.cpp
    shadow.cpp
    sm.cpp
    thumbnailitem.cpp
    toplevel.cpp
481
    touch_hide_cursor_spy.cpp
482
483
484
485
486
487
488
489
490
491
492
493
494
495
    touch_input.cpp
    udev.cpp
    unmanaged.cpp
    useractions.cpp
    utils.cpp
    virtualdesktops.cpp
    virtualdesktopsdbustypes.cpp
    virtualkeyboard.cpp
    virtualkeyboard_dbus.cpp
    was_user_interaction_x11_filter.cpp
    wayland_cursor_theme.cpp
    wayland_server.cpp
    window_property_notify_x11_filter.cpp
    workspace.cpp
Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
496
    x11client.cpp
497
498
    x11eventfilter.cpp
    xcbutils.cpp
499
    xdgshellclient.cpp
500
    xkb.cpp
501
    xwl/xwayland_interface.cpp
502
)
503

504
505
506
507
508
509
510
511
512
513
514
515
include(ECMQtDeclareLoggingCategory)
ecm_qt_declare_logging_category(kwin_KDEINIT_SRCS
    HEADER
        colorcorrect_logging.h
    IDENTIFIER
        KWIN_COLORCORRECTION
    CATEGORY_NAME
        kwin_colorcorrection
    DEFAULT_SEVERITY
        Critical
)

516
if (KWIN_BUILD_TABBOX)
517
    include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS})
518
    set(kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS}
519
        tabbox/clientmodel.cpp
520
        tabbox/desktopchain.cpp
521
        tabbox/desktopmodel.cpp
522
        tabbox/switcheritem.cpp
523
524
        tabbox/tabbox.cpp
        tabbox/tabbox_logging.cpp
525
526
        tabbox/tabboxconfig.cpp
        tabbox/tabboxhandler.cpp
527
        tabbox/x11_filter.cpp
528
    )
Martin Flöser's avatar
Martin Flöser committed
529
endif()
530

531
532
if (KWIN_BUILD_ACTIVITIES)
    set(kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS}
533
534
535
536
        activities.cpp
    )
endif()

Martin Flöser's avatar
Martin Flöser committed
537
if (HAVE_LINUX_VT_H)
538
539
540
    set(kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS}
        virtual_terminal.cpp
    )
Martin Flöser's avatar
Martin Flöser committed
541
542
endif()

Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
543
kconfig_add_kcfg_files(kwin_KDEINIT_SRCS settings.kcfgc)
544
kconfig_add_kcfg_files(kwin_KDEINIT_SRCS colorcorrection/colorcorrect_settings.kcfgc)
545

546
547
548
549
550
551
qt5_add_dbus_adaptor(kwin_KDEINIT_SRCS org.kde.KWin.xml dbusinterface.h KWin::DBusInterface)
qt5_add_dbus_adaptor(kwin_KDEINIT_SRCS org.kde.kwin.Compositing.xml dbusinterface.h KWin::CompositorDBusInterface)
qt5_add_dbus_adaptor(kwin_KDEINIT_SRCS org.kde.kwin.ColorCorrect.xml colorcorrection/colorcorrectdbusinterface.h KWin::ColorCorrect::ColorCorrectDBusInterface)
qt5_add_dbus_adaptor(kwin_KDEINIT_SRCS ${kwin_effects_dbus_xml} effects.h KWin::EffectsHandlerImpl)
qt5_add_dbus_adaptor(kwin_KDEINIT_SRCS org.kde.kwin.OrientationSensor.xml orientation_sensor.h KWin::OrientationSensor)
qt5_add_dbus_adaptor(kwin_KDEINIT_SRCS org.kde.KWin.VirtualDesktopManager.xml dbusinterface.h KWin::VirtualDesktopManagerDBusInterface)
552
qt5_add_dbus_adaptor(kwin_KDEINIT_SRCS org.kde.KWin.Session.xml sm.h KWin::SessionManager)
553

554
555
556
qt5_add_dbus_interface(kwin_KDEINIT_SRCS ${KSCREENLOCKER_DBUS_INTERFACES_DIR}/kf5_org.freedesktop.ScreenSaver.xml screenlocker_interface)
qt5_add_dbus_interface(kwin_KDEINIT_SRCS ${KSCREENLOCKER_DBUS_INTERFACES_DIR}/org.kde.screensaver.xml kscreenlocker_interface)
qt5_add_dbus_interface(kwin_KDEINIT_SRCS org.kde.kappmenu.xml appmenu_interface)
Kai Uwe Broulik's avatar
Kai Uwe Broulik committed
557

Lukáš Tinkl's avatar
Lukáš Tinkl committed
558
ki18n_wrap_ui(kwin_KDEINIT_SRCS
559
    debug_console.ui
560
561
562
    shortcutdialog.ui
)

563
564
565
########### target link libraries ###############

set(kwin_OWN_LIBS
566
    kwineffects
567
    kwin4_effect_builtins
568
569
570
)

set(kwin_QT_LIBS
Martin Flöser's avatar
Martin Flöser committed
571
    Qt5::Concurrent
Martin Flöser's avatar
Martin Flöser committed
572
    Qt5::DBus
573
    Qt5::Quick
574
    Qt5::Script
575
    Qt5::Sensors
576
577
578
)

set(kwin_KDE_LIBS
Martin Klapetek's avatar
Martin Klapetek committed
579
    KF5::ConfigCore
580
    KF5::ConfigWidgets
581
    KF5::CoreAddons
582
    KF5::GlobalAccel
583
    KF5::GlobalAccelPrivate
Martin Klapetek's avatar
Martin Klapetek committed
584
585
    KF5::I18n
    KF5::Notifications
586
    KF5::Package
587
    KF5::Plasma
David Edmundson's avatar
David Edmundson committed
588
    KF5::QuickAddons
589
    KF5::WindowSystem
590
591
592
593

    KDecoration2::KDecoration
    KDecoration2::KDecoration2Private

594
    PW::KScreenLocker
595
596
597
)

set(kwin_XLIB_LIBS
Martin Flöser's avatar
Martin Flöser committed
598
599
    ${X11_ICE_LIB}
    ${X11_SM_LIB}
600
    ${X11_X11_LIB}
601
602
)

603
set(kwin_XCB_LIBS
604
    XCB::COMPOSITE
605
    XCB::DAMAGE
606
    XCB::GLX
607
    XCB::ICCCM
608
609
610
611
612
613
614
615
    XCB::KEYSYMS
    XCB::RANDR
    XCB::RENDER
    XCB::SHAPE
    XCB::SHM
    XCB::SYNC
    XCB::XCB
    XCB::XFIXES
616
617
)

618
set(kwin_WAYLAND_LIBS
619
    KF5::WaylandClient
620
    KF5::WaylandServer
621
    Wayland::Cursor
622
    XKB::XKB
623
    ${CMAKE_THREAD_LIBS_INIT}
624
625
)

626
if (KWIN_BUILD_ACTIVITIES)
627
    set(kwin_KDE_LIBS ${kwin_KDE_LIBS} KF5::Activities)
Martin Flöser's avatar
Martin Flöser committed
628
endif()
629

630
631
632
633
634
635
set(kwinLibs
    ${kwin_OWN_LIBS}
    ${kwin_QT_LIBS}
    ${kwin_KDE_LIBS}
    ${kwin_XLIB_LIBS}
    ${kwin_XCB_LIBS}
636
    ${kwin_WAYLAND_LIBS}
Martin Flöser's avatar
Martin Flöser committed
637
638
    ${UDEV_LIBS}
    Libinput::Libinput
639
640
)

641
add_library(kwin SHARED ${kwin_KDEINIT_SRCS})
642

643
set_target_properties(kwin PROPERTIES
644
645
   VERSION ${PROJECT_VERSION}
   SOVERSION ${PROJECT_VERSION_MAJOR}
646
)
647
648
649

target_link_libraries(kwin ${kwinLibs})
generate_export_header(kwin EXPORT_FILE_NAME kwin_export.h)
650

651
target_link_libraries(kwin kwinglutils ${epoxy_LIBRARY})
652

653
kf5_add_kdeinit_executable(kwin_x11 main_x11.cpp)
654
target_link_libraries(kdeinit_kwin_x11 kwin KF5::Crash Qt5::X11Extras)
655

656
657
658
install(TARGETS kwin ${INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP)
install(TARGETS kdeinit_kwin_x11 ${INSTALL_TARGETS_DEFAULT_ARGS})
install(TARGETS kwin_x11 ${INSTALL_TARGETS_DEFAULT_ARGS})
659

660
661
set(kwin_XWAYLAND_SRCS
   ${CMAKE_CURRENT_SOURCE_DIR}/xwl/clipboard.cpp
662
   ${CMAKE_CURRENT_SOURCE_DIR}/xwl/databridge.cpp
663
664
665
666
   ${CMAKE_CURRENT_SOURCE_DIR}/xwl/dnd.cpp
   ${CMAKE_CURRENT_SOURCE_DIR}/xwl/drag.cpp
   ${CMAKE_CURRENT_SOURCE_DIR}/xwl/drag_wl.cpp
   ${CMAKE_CURRENT_SOURCE_DIR}/xwl/drag_x.cpp
667
668
669
670
   ${CMAKE_CURRENT_SOURCE_DIR}/xwl/selection.cpp
   ${CMAKE_CURRENT_SOURCE_DIR}/xwl/selection_source.cpp
   ${CMAKE_CURRENT_SOURCE_DIR}/xwl/transfer.cpp
   ${CMAKE_CURRENT_SOURCE_DIR}/xwl/xwayland.cpp
671
)
672
673
674
675
676
677
678
679
680
681
682
683
include(ECMQtDeclareLoggingCategory)
ecm_qt_declare_logging_category(kwin_XWAYLAND_SRCS
    HEADER
        xwayland_logging.h
    IDENTIFIER
        KWIN_XWL
    CATEGORY_NAME
        kwin_xwl
    DEFAULT_SEVERITY
        Critical
)

684
685
set(kwin_WAYLAND_SRCS
   main_wayland.cpp
686
   tabletmodemanager.cpp
687
)
688

689
add_executable(kwin_wayland ${kwin_WAYLAND_SRCS} ${kwin_XWAYLAND_SRCS})
690
target_link_libraries(kwin_wayland kwin KF5::Crash)
691
692
693
if (HAVE_LIBCAP)
    target_link_libraries(kwin_wayland ${Libcap_LIBRARIES})
endif()
694

695
install(TARGETS kwin_wayland ${INSTALL_TARGETS_DEFAULT_ARGS})
696
697
698
699
700
701
if (HAVE_LIBCAP)
    install(
    CODE "execute_process(
            COMMAND
                ${SETCAP_EXECUTABLE}
                CAP_SYS_NICE=+ep
702
                \$ENV{DESTDIR}${CMAKE_INSTALL_FULL_BINDIR}/kwin_wayland)"
703
704
    )
endif()
705

706
add_subdirectory(platformsupport)
707
add_subdirectory(plugins)
708
709
710

########### install files ###############

711
712
713
install(FILES kwin.kcfg DESTINATION ${KCFG_INSTALL_DIR} RENAME ${KWIN_NAME}.kcfg)
install(FILES colorcorrection/colorcorrect_settings.kcfg DESTINATION ${KCFG_INSTALL_DIR} RENAME ${KWIN_NAME}_colorcorrect.kcfg)
install(FILES kwin.notifyrc DESTINATION ${KNOTIFYRC_INSTALL_DIR} RENAME ${KWIN_NAME}.notifyrc)
714
715
install(
    FILES
716
        org.kde.KWin.VirtualDesktopManager.xml
717
        org.kde.KWin.xml
718
        org.kde.kwin.ColorCorrect.xml
719
        org.kde.kwin.Compositing.xml
720
721
        org.kde.kwin.Effects.xml
    DESTINATION
722
        ${KDE_INSTALL_DBUSINTERFACEDIR}
723
)
724
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kwin_export.h DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)
725

726
# Install the KWin/Script service type
727
install(FILES scripting/kwinscript.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
728

729
add_subdirectory(qml)
730

Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
731
732
733
734
735
if (BUILD_TESTING)
    add_subdirectory(autotests)
    add_subdirectory(tests)
endif()

736
737
738
if (KF5DocTools_FOUND)
    add_subdirectory(doc)
endif()
739

740
741
add_subdirectory(kconf_update)

742
743
744
745
# add clang-format target for all our real source files
file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h)
kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})

746
747
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)

748
include(CMakePackageConfigHelpers)
749
set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KWinDBusInterface")
750
configure_package_config_file(KWinDBusInterfaceConfig.cmake.in
751
    "${CMAKE_CURRENT_BINARY_DIR}/KWinDBusInterfaceConfig.cmake"
752
    PATH_VARS KDE_INSTALL_DBUSINTERFACEDIR
753
    INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR})
754
755
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/KWinDBusInterfaceConfig.cmake
    DESTINATION ${CMAKECONFIG_INSTALL_DIR})