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

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

7
set(QT_MIN_VERSION "5.12.0")
8
set(KF5_MIN_VERSION "5.66.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
)

Heiko Becker's avatar
Heiko Becker committed
121
find_package(KDecoration2 5.18.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
405
    colorcorrection/clockskewnotifier.cpp
    colorcorrection/clockskewnotifierengine.cpp
406
    colorcorrection/colorcorrectdbusinterface.cpp
407
    colorcorrection/manager.cpp
408
    colorcorrection/suncalc.cpp
409
410
411
412
413
414
415
416
417
418
419
420
421
    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
422
    egl_context_attribute_builder.cpp
423
424
425
426
427
428
    events.cpp
    focuschain.cpp
    geometrytip.cpp
    gestures.cpp
    globalshortcuts.cpp
    group.cpp
429
    idle_inhibition.cpp
430
431
432
433
434
435
436
437
438
439
    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
440
    libinput/connection.cpp
441
    libinput/context.cpp
Martin Flöser's avatar
Martin Flöser committed
442
443
444
    libinput/device.cpp
    libinput/events.cpp
    libinput/libinput_logging.cpp
Roman Gilg's avatar
Roman Gilg committed
445
    linux_dmabuf.cpp
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
481
    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
482
    touch_hide_cursor_spy.cpp
483
    tablet_input.cpp
484
485
486
487
488
489
490
491
492
493
494
495
496
497
    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
498
    x11client.cpp
499
500
    x11eventfilter.cpp
    xcbutils.cpp
501
    xdgshellclient.cpp
502
    xkb.cpp
503
    xwl/xwayland_interface.cpp
504
)
505

506
507
508
509
510
511
512
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
    set(kwin_KDEINIT_SRCS
        ${kwin_KDEINIT_SRCS}
        colorcorrection/clockskewnotifierengine_linux.cpp
    )
endif()

513
514
515
516
517
518
519
520
521
522
523
524
include(ECMQtDeclareLoggingCategory)
ecm_qt_declare_logging_category(kwin_KDEINIT_SRCS
    HEADER
        colorcorrect_logging.h
    IDENTIFIER
        KWIN_COLORCORRECTION
    CATEGORY_NAME
        kwin_colorcorrection
    DEFAULT_SEVERITY
        Critical
)

525
if (KWIN_BUILD_TABBOX)
526
    include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS})
527
    set(kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS}
528
        tabbox/clientmodel.cpp
529
        tabbox/desktopchain.cpp
530
        tabbox/desktopmodel.cpp
531
        tabbox/switcheritem.cpp
532
533
        tabbox/tabbox.cpp
        tabbox/tabbox_logging.cpp
534
535
        tabbox/tabboxconfig.cpp
        tabbox/tabboxhandler.cpp
536
        tabbox/x11_filter.cpp
537
    )
Martin Flöser's avatar
Martin Flöser committed
538
endif()
539

540
541
if (KWIN_BUILD_ACTIVITIES)
    set(kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS}
542
543
544
545
        activities.cpp
    )
endif()

Martin Flöser's avatar
Martin Flöser committed
546
if (HAVE_LINUX_VT_H)
547
548
549
    set(kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS}
        virtual_terminal.cpp
    )
Martin Flöser's avatar
Martin Flöser committed
550
551
endif()

Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
552
kconfig_add_kcfg_files(kwin_KDEINIT_SRCS settings.kcfgc)
553
kconfig_add_kcfg_files(kwin_KDEINIT_SRCS colorcorrection/colorcorrect_settings.kcfgc)
554

555
556
557
558
559
560
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)
561
qt5_add_dbus_adaptor(kwin_KDEINIT_SRCS org.kde.KWin.Session.xml sm.h KWin::SessionManager)
562

563
564
565
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
566

Lukáš Tinkl's avatar
Lukáš Tinkl committed
567
ki18n_wrap_ui(kwin_KDEINIT_SRCS
568
    debug_console.ui
569
570
571
    shortcutdialog.ui
)

572
573
574
########### target link libraries ###############

set(kwin_OWN_LIBS
575
    kwineffects
576
    kwin4_effect_builtins
577
578
579
)

set(kwin_QT_LIBS
Martin Flöser's avatar
Martin Flöser committed
580
    Qt5::Concurrent
Martin Flöser's avatar
Martin Flöser committed
581
    Qt5::DBus
582
    Qt5::Quick
583
    Qt5::Script
584
    Qt5::Sensors
585
586
587
)

set(kwin_KDE_LIBS
Martin Klapetek's avatar
Martin Klapetek committed
588
    KF5::ConfigCore
589
    KF5::ConfigWidgets
590
    KF5::CoreAddons
591
    KF5::GlobalAccel
592
    KF5::GlobalAccelPrivate
Martin Klapetek's avatar
Martin Klapetek committed
593
594
    KF5::I18n
    KF5::Notifications
595
    KF5::Package
596
    KF5::Plasma
David Edmundson's avatar
David Edmundson committed
597
    KF5::QuickAddons
598
    KF5::WindowSystem
599
600
601
602

    KDecoration2::KDecoration
    KDecoration2::KDecoration2Private

603
    PW::KScreenLocker
604
605
606
)

set(kwin_XLIB_LIBS
Martin Flöser's avatar
Martin Flöser committed
607
608
    ${X11_ICE_LIB}
    ${X11_SM_LIB}
609
    ${X11_X11_LIB}
610
611
)

612
set(kwin_XCB_LIBS
613
    XCB::COMPOSITE
614
    XCB::DAMAGE
615
    XCB::GLX
616
    XCB::ICCCM
617
618
619
620
621
622
623
624
    XCB::KEYSYMS
    XCB::RANDR
    XCB::RENDER
    XCB::SHAPE
    XCB::SHM
    XCB::SYNC
    XCB::XCB
    XCB::XFIXES
625
626
)

627
set(kwin_WAYLAND_LIBS
628
    KF5::WaylandClient
629
    KF5::WaylandServer
630
    Wayland::Cursor
631
    XKB::XKB
632
    ${CMAKE_THREAD_LIBS_INIT}
633
634
)

635
if (KWIN_BUILD_ACTIVITIES)
636
    set(kwin_KDE_LIBS ${kwin_KDE_LIBS} KF5::Activities)
Martin Flöser's avatar
Martin Flöser committed
637
endif()
638

639
640
641
642
643
644
set(kwinLibs
    ${kwin_OWN_LIBS}
    ${kwin_QT_LIBS}
    ${kwin_KDE_LIBS}
    ${kwin_XLIB_LIBS}
    ${kwin_XCB_LIBS}
645
    ${kwin_WAYLAND_LIBS}
Martin Flöser's avatar
Martin Flöser committed
646
647
    ${UDEV_LIBS}
    Libinput::Libinput
648
649
)

650
add_library(kwin SHARED ${kwin_KDEINIT_SRCS})
651

652
set_target_properties(kwin PROPERTIES
653
654
   VERSION ${PROJECT_VERSION}
   SOVERSION ${PROJECT_VERSION_MAJOR}
655
)
656
657
658

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

660
target_link_libraries(kwin kwinglutils ${epoxy_LIBRARY})
661

662
kf5_add_kdeinit_executable(kwin_x11 main_x11.cpp)
663
target_link_libraries(kdeinit_kwin_x11 kwin KF5::Crash Qt5::X11Extras)
664

665
666
667
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})
668

669
670
set(kwin_XWAYLAND_SRCS
   ${CMAKE_CURRENT_SOURCE_DIR}/xwl/clipboard.cpp
671
   ${CMAKE_CURRENT_SOURCE_DIR}/xwl/databridge.cpp
672
673
674
675
   ${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
676
677
678
679
   ${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
680
)
681
682
683
684
685
686
687
688
689
690
691
692
include(ECMQtDeclareLoggingCategory)
ecm_qt_declare_logging_category(kwin_XWAYLAND_SRCS
    HEADER
        xwayland_logging.h
    IDENTIFIER
        KWIN_XWL
    CATEGORY_NAME
        kwin_xwl
    DEFAULT_SEVERITY
        Critical
)

693
694
set(kwin_WAYLAND_SRCS
   main_wayland.cpp
695
   tabletmodemanager.cpp
696
)
697

698
add_executable(kwin_wayland ${kwin_WAYLAND_SRCS} ${kwin_XWAYLAND_SRCS})
699
target_link_libraries(kwin_wayland kwin KF5::Crash)
700
701
702
if (HAVE_LIBCAP)
    target_link_libraries(kwin_wayland ${Libcap_LIBRARIES})
endif()
703

704
install(TARGETS kwin_wayland ${INSTALL_TARGETS_DEFAULT_ARGS})
705
706
707
708
709
710
if (HAVE_LIBCAP)
    install(
    CODE "execute_process(
            COMMAND
                ${SETCAP_EXECUTABLE}
                CAP_SYS_NICE=+ep
711
                \$ENV{DESTDIR}${CMAKE_INSTALL_FULL_BINDIR}/kwin_wayland)"
712
713
    )
endif()
714

715
add_subdirectory(platformsupport)
716
add_subdirectory(plugins)
717
718
719

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

720
721
722
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)
723
724
install(
    FILES
725
        org.kde.KWin.VirtualDesktopManager.xml
726
        org.kde.KWin.xml
727
        org.kde.kwin.ColorCorrect.xml
728
        org.kde.kwin.Compositing.xml
729
730
        org.kde.kwin.Effects.xml
    DESTINATION
731
        ${KDE_INSTALL_DBUSINTERFACEDIR}
732
)
733
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kwin_export.h DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)
734

735
# Install the KWin/Script service type
736
install(FILES scripting/kwinscript.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
737

738
add_subdirectory(qml)
739

Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
740
741
742
743
744
if (BUILD_TESTING)
    add_subdirectory(autotests)
    add_subdirectory(tests)
endif()

745
746
747
if (KF5DocTools_FOUND)
    add_subdirectory(doc)
endif()
748

749
750
add_subdirectory(kconf_update)

751
752
753
754
# 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})

755
756
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)

757
include(CMakePackageConfigHelpers)
758
set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KWinDBusInterface")
759
configure_package_config_file(KWinDBusInterfaceConfig.cmake.in
760
    "${CMAKE_CURRENT_BINARY_DIR}/KWinDBusInterfaceConfig.cmake"
761
    PATH_VARS KDE_INSTALL_DBUSINTERFACEDIR
762
    INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR})
763
764
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/KWinDBusInterfaceConfig.cmake
    DESTINATION ${CMAKECONFIG_INSTALL_DIR})