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.80")
5
set(PROJECT_VERSION_MAJOR 5)
6

Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
7
set(QT_MIN_VERSION "5.14.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
    Notifications
74
    Package
75
    Plasma
76
    Wayland
77
78
79
80
    WidgetsAddons
    WindowSystem
)
# required frameworks by config modules
81
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
82
    Completion
83
    Declarative
84
85
86
    KCMUtils
    KIO
    NewStuff
87
    Service
88
    TextWidgets
89
90
91
    XmlGui
)

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

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

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

113
114
115
116
117
118
119
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
120
find_package(KDecoration2 5.18.0 CONFIG REQUIRED)
121

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

Martin Flöser's avatar
Martin Flöser committed
128
find_package(Breeze 5.9.0 CONFIG)
129
set_package_properties(Breeze PROPERTIES
130
131
132
133
134
    TYPE OPTIONAL
    PURPOSE "For setting the default window decoration plugin"
)
if (${Breeze_FOUND})
    if (${BREEZE_WITH_KDECORATION})
135
136
137
138
139
140
141
142
143
        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")

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

Fredrik Höglund's avatar
Fredrik Höglund committed
150
find_package(epoxy)
151
152
153
154
155
156
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
157

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

283
284
285
286
287
288
289
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})

290
291
292
293
294
295
296
297
find_package(hwdata)
set_package_properties(hwdata PROPERTIES
    TYPE RUNTIME
    PURPOSE "Runtime-only dependency needed for mapping monitor hardware vendor IDs to full names"
    URL "https://github.com/vcrhonek/hwdata"
)
set(HAVE_HWDATA ${hwdata_FOUND})

298
299
300
301
302
303
304
305
306
307
308
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)

309
########### configure tests ###############
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
310
311
312
313
314
315
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)
316
cmake_dependent_option(KWIN_BUILD_ACTIVITIES "Enable building of KWin with kactivities support" ON "KF5Activities_FOUND" OFF)
317

318
319
# Binary name of KWin
set(KWIN_NAME "kwin")
Hrvoje Senjan's avatar
Hrvoje Senjan committed
320
321
set(KWIN_INTERNAL_NAME_X11 "kwin_x11")
set(KWIN_INTERNAL_NAME_WAYLAND "kwin_wayland")
322

323
# KWIN_HAVE_XRENDER_COMPOSITING - whether XRender-based compositing support is available: may be disabled
324
325
if (KWIN_BUILD_XRENDER_COMPOSITING)
    set(KWIN_HAVE_XRENDER_COMPOSITING 1)
Martin Flöser's avatar
Martin Flöser committed
326
endif()
327

328
include_directories(${XKB_INCLUDE_DIR})
329

330
include_directories(${epoxy_INCLUDE_DIR})
331
set(HAVE_EPOXY_GLX ${epoxy_HAS_GLX})
332

333
# for things that are also used by kwin libraries
334
configure_file(libkwineffects/kwinconfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/libkwineffects/kwinconfig.h )
335
# for kwin internal things
336
set(HAVE_X11_XCB ${X11_XCB_FOUND})
337

338
include(CheckIncludeFile)
339
include(CheckIncludeFiles)
340
include(CheckSymbolExists)
341
342
check_include_files(unistd.h HAVE_UNISTD_H)
check_include_files(malloc.h HAVE_MALLOC_H)
343
344
345

check_include_file("sys/prctl.h" HAVE_SYS_PRCTL_H)
check_symbol_exists(PR_SET_DUMPABLE "sys/prctl.h" HAVE_PR_SET_DUMPABLE)
346
check_symbol_exists(PR_SET_PDEATHSIG "sys/prctl.h" HAVE_PR_SET_PDEATHSIG)
347
348
349
350
351
352
353
354
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")
355

356
check_include_file("sys/sysmacros.h" HAVE_SYS_SYSMACROS_H)
357

358
359
360
361
362
363
364
365
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")
366

367
368
369
370
371
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")

372
configure_file(config-kwin.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kwin.h)
373

374
########### global ###############
375
set(kwin_effects_dbus_xml ${CMAKE_CURRENT_SOURCE_DIR}/org.kde.kwin.Effects.xml)
376

377
include_directories(BEFORE
378
    ${CMAKE_CURRENT_BINARY_DIR}/libkwineffects
379
    ${CMAKE_CURRENT_BINARY_DIR}
380
    ${CMAKE_CURRENT_SOURCE_DIR}/libkwineffects
381
    ${CMAKE_CURRENT_SOURCE_DIR}/effects
382
    ${CMAKE_CURRENT_SOURCE_DIR}/tabbox
383
    ${CMAKE_CURRENT_SOURCE_DIR}/platformsupport
384
)
385

386
387
388
add_subdirectory(libkwineffects)
if (KWIN_BUILD_KCMS)
    add_subdirectory(kcmkwin)
Martin Flöser's avatar
Martin Flöser committed
389
endif()
390

391
add_subdirectory(data)
392

393
394
395
add_subdirectory(effects)
add_subdirectory(scripts)
add_subdirectory(tabbox)
396
add_subdirectory(scripting)
397
add_subdirectory(helpers)
398

399
400
########### next target ###############

David Edmundson's avatar
David Edmundson committed
401
set(kwin_SRCS
402
403
    abstract_client.cpp
    abstract_opengl_context_attribute_builder.cpp
Roman Gilg's avatar
Roman Gilg committed
404
    abstract_output.cpp
405
    abstract_wayland_output.cpp
406
    activation.cpp
Kai Uwe Broulik's avatar
Kai Uwe Broulik committed
407
    appmenu.cpp
408
409
    atoms.cpp
    client_machine.cpp
410
411
    colorcorrection/clockskewnotifier.cpp
    colorcorrection/clockskewnotifierengine.cpp
412
    colorcorrection/colorcorrectdbusinterface.cpp
413
    colorcorrection/manager.cpp
414
    colorcorrection/suncalc.cpp
415
416
417
418
419
420
421
422
423
424
425
426
427
    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
428
    egl_context_attribute_builder.cpp
429
430
431
432
433
434
    events.cpp
    focuschain.cpp
    geometrytip.cpp
    gestures.cpp
    globalshortcuts.cpp
    group.cpp
435
    idle_inhibition.cpp
436
437
438
439
440
441
442
443
444
445
    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
446
    libinput/connection.cpp
447
    libinput/context.cpp
Martin Flöser's avatar
Martin Flöser committed
448
449
450
    libinput/device.cpp
    libinput/events.cpp
    libinput/libinput_logging.cpp
Roman Gilg's avatar
Roman Gilg committed
451
    linux_dmabuf.cpp
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
    logind.cpp
    main.cpp
    modifier_only_shortcuts.cpp
    moving_client_x11_filter.cpp
    netinfo.cpp
    onscreennotification.cpp
    options.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
Henri Chain's avatar
Henri Chain committed
469
    rulebooksettings.cpp
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
    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
488
    touch_hide_cursor_spy.cpp
489
    tablet_input.cpp
490
491
492
493
494
495
496
497
498
499
500
501
502
503
    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
504
    x11client.cpp
505
506
    x11eventfilter.cpp
    xcbutils.cpp
507
    xdgshellclient.cpp
508
    xkb.cpp
509
    xwl/xwayland_interface.cpp
510
)
511

512
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
David Edmundson's avatar
David Edmundson committed
513
514
    set(kwin_SRCS
        ${kwin_SRCS}
515
516
517
518
        colorcorrection/clockskewnotifierengine_linux.cpp
    )
endif()

519
include(ECMQtDeclareLoggingCategory)
David Edmundson's avatar
David Edmundson committed
520
ecm_qt_declare_logging_category(kwin_SRCS
521
522
523
524
525
526
527
528
529
530
    HEADER
        colorcorrect_logging.h
    IDENTIFIER
        KWIN_COLORCORRECTION
    CATEGORY_NAME
        kwin_colorcorrection
    DEFAULT_SEVERITY
        Critical
)

531
if (KWIN_BUILD_TABBOX)
532
    include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS})
David Edmundson's avatar
David Edmundson committed
533
    set(kwin_SRCS ${kwin_SRCS}
534
        tabbox/clientmodel.cpp
535
        tabbox/desktopchain.cpp
536
        tabbox/desktopmodel.cpp
537
        tabbox/switcheritem.cpp
538
539
        tabbox/tabbox.cpp
        tabbox/tabbox_logging.cpp
540
541
        tabbox/tabboxconfig.cpp
        tabbox/tabboxhandler.cpp
542
        tabbox/x11_filter.cpp
543
    )
Martin Flöser's avatar
Martin Flöser committed
544
endif()
545

546
if (KWIN_BUILD_ACTIVITIES)
David Edmundson's avatar
David Edmundson committed
547
    set(kwin_SRCS ${kwin_SRCS}
548
549
550
551
        activities.cpp
    )
endif()

Martin Flöser's avatar
Martin Flöser committed
552
if (HAVE_LINUX_VT_H)
David Edmundson's avatar
David Edmundson committed
553
    set(kwin_SRCS ${kwin_SRCS}
554
555
        virtual_terminal.cpp
    )
Martin Flöser's avatar
Martin Flöser committed
556
557
endif()

David Edmundson's avatar
David Edmundson committed
558
559
kconfig_add_kcfg_files(kwin_SRCS settings.kcfgc)
kconfig_add_kcfg_files(kwin_SRCS colorcorrection/colorcorrect_settings.kcfgc)
Henri Chain's avatar
Henri Chain committed
560
561
kconfig_add_kcfg_files(kwin_SRCS rulesettings.kcfgc)
kconfig_add_kcfg_files(kwin_SRCS rulebooksettingsbase.kcfgc)
562

David Edmundson's avatar
David Edmundson committed
563
564
565
566
567
568
qt5_add_dbus_adaptor(kwin_SRCS org.kde.KWin.xml dbusinterface.h KWin::DBusInterface)
qt5_add_dbus_adaptor(kwin_SRCS org.kde.kwin.Compositing.xml dbusinterface.h KWin::CompositorDBusInterface)
qt5_add_dbus_adaptor(kwin_SRCS org.kde.kwin.ColorCorrect.xml colorcorrection/colorcorrectdbusinterface.h KWin::ColorCorrect::ColorCorrectDBusInterface)
qt5_add_dbus_adaptor(kwin_SRCS ${kwin_effects_dbus_xml} effects.h KWin::EffectsHandlerImpl)
qt5_add_dbus_adaptor(kwin_SRCS org.kde.KWin.VirtualDesktopManager.xml dbusinterface.h KWin::VirtualDesktopManagerDBusInterface)
qt5_add_dbus_adaptor(kwin_SRCS org.kde.KWin.Session.xml sm.h KWin::SessionManager)
569

David Edmundson's avatar
David Edmundson committed
570
571
572
qt5_add_dbus_interface(kwin_SRCS ${KSCREENLOCKER_DBUS_INTERFACES_DIR}/kf5_org.freedesktop.ScreenSaver.xml screenlocker_interface)
qt5_add_dbus_interface(kwin_SRCS ${KSCREENLOCKER_DBUS_INTERFACES_DIR}/org.kde.screensaver.xml kscreenlocker_interface)
qt5_add_dbus_interface(kwin_SRCS org.kde.kappmenu.xml appmenu_interface)
Kai Uwe Broulik's avatar
Kai Uwe Broulik committed
573

David Edmundson's avatar
David Edmundson committed
574
ki18n_wrap_ui(kwin_SRCS
575
    debug_console.ui
576
577
578
    shortcutdialog.ui
)

579
580
581
########### target link libraries ###############

set(kwin_OWN_LIBS
582
    kwineffects
583
    kwin4_effect_builtins
584
585
586
)

set(kwin_QT_LIBS
Martin Flöser's avatar
Martin Flöser committed
587
    Qt5::Concurrent
Martin Flöser's avatar
Martin Flöser committed
588
    Qt5::DBus
589
    Qt5::Quick
590
    Qt5::Script
591
    Qt5::Sensors
592
593
594
)

set(kwin_KDE_LIBS
Martin Klapetek's avatar
Martin Klapetek committed
595
    KF5::ConfigCore
596
    KF5::ConfigWidgets
597
    KF5::CoreAddons
598
    KF5::GlobalAccel
599
    KF5::GlobalAccelPrivate
Martin Klapetek's avatar
Martin Klapetek committed
600
601
    KF5::I18n
    KF5::Notifications
602
    KF5::Package
603
    KF5::Plasma
David Edmundson's avatar
David Edmundson committed
604
    KF5::QuickAddons
605
    KF5::WindowSystem
606
607
608
609

    KDecoration2::KDecoration
    KDecoration2::KDecoration2Private

610
    PW::KScreenLocker
611
612
613
)

set(kwin_XLIB_LIBS
Martin Flöser's avatar
Martin Flöser committed
614
615
    ${X11_ICE_LIB}
    ${X11_SM_LIB}
616
    ${X11_X11_LIB}
617
618
)

619
set(kwin_XCB_LIBS
620
    XCB::COMPOSITE
621
    XCB::DAMAGE
622
    XCB::GLX
623
    XCB::ICCCM
624
625
626
627
628
629
630
631
    XCB::KEYSYMS
    XCB::RANDR
    XCB::RENDER
    XCB::SHAPE
    XCB::SHM
    XCB::SYNC
    XCB::XCB
    XCB::XFIXES
632
633
)

634
set(kwin_WAYLAND_LIBS
635
    KF5::WaylandClient
636
    KF5::WaylandServer
637
    Wayland::Cursor
638
    XKB::XKB
639
    ${CMAKE_THREAD_LIBS_INIT}
640
641
)

642
if (KWIN_BUILD_ACTIVITIES)
643
    set(kwin_KDE_LIBS ${kwin_KDE_LIBS} KF5::Activities)
Martin Flöser's avatar
Martin Flöser committed
644
endif()
645

646
647
648
649
650
651
set(kwinLibs
    ${kwin_OWN_LIBS}
    ${kwin_QT_LIBS}
    ${kwin_KDE_LIBS}
    ${kwin_XLIB_LIBS}
    ${kwin_XCB_LIBS}
652
    ${kwin_WAYLAND_LIBS}
Martin Flöser's avatar
Martin Flöser committed
653
654
    ${UDEV_LIBS}
    Libinput::Libinput
655
656
)

David Edmundson's avatar
David Edmundson committed
657
add_library(kwin SHARED ${kwin_SRCS})
658

659
set_target_properties(kwin PROPERTIES
660
661
   VERSION ${PROJECT_VERSION}
   SOVERSION ${PROJECT_VERSION_MAJOR}
662
)
663
664
665

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

667
target_link_libraries(kwin kwinglutils ${epoxy_LIBRARY})
668

David Edmundson's avatar
David Edmundson committed
669
670
add_executable(kwin_x11 main_x11.cpp)
target_link_libraries(kwin_x11 kwin KF5::Crash Qt5::X11Extras)
671

672
673
install(TARGETS kwin ${INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP)
install(TARGETS kwin_x11 ${INSTALL_TARGETS_DEFAULT_ARGS})
674

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

699
700
set(kwin_WAYLAND_SRCS
   main_wayland.cpp
701
   tabletmodemanager.cpp
702
)
703

704
add_executable(kwin_wayland ${kwin_WAYLAND_SRCS} ${kwin_XWAYLAND_SRCS})
705
target_link_libraries(kwin_wayland kwin KF5::Crash)
706
707
708
if (HAVE_LIBCAP)
    target_link_libraries(kwin_wayland ${Libcap_LIBRARIES})
endif()
709

710
install(TARGETS kwin_wayland ${INSTALL_TARGETS_DEFAULT_ARGS})
711
712
713
714
715
716
if (HAVE_LIBCAP)
    install(
    CODE "execute_process(
            COMMAND
                ${SETCAP_EXECUTABLE}
                CAP_SYS_NICE=+ep
717
                \$ENV{DESTDIR}${CMAKE_INSTALL_FULL_BINDIR}/kwin_wayland)"
718
719
    )
endif()
720

721
add_subdirectory(platformsupport)
722
add_subdirectory(plugins)
723
724
725

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

726
727
728
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)
729
730
install(
    FILES
731
        org.kde.KWin.VirtualDesktopManager.xml
732
        org.kde.KWin.xml
733
        org.kde.kwin.ColorCorrect.xml
734
        org.kde.kwin.Compositing.xml
735
736
        org.kde.kwin.Effects.xml
    DESTINATION
737
        ${KDE_INSTALL_DBUSINTERFACEDIR}
738
)
739
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kwin_export.h DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)
740

741
# Install the KWin/Script service type
742
install(FILES scripting/kwinscript.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
743

744
add_subdirectory(qml)
745

Vlad Zahorodnii's avatar
Vlad Zahorodnii committed
746
747
748
749
750
if (BUILD_TESTING)
    add_subdirectory(autotests)
    add_subdirectory(tests)
endif()

751
752
753
if (KF5DocTools_FOUND)
    add_subdirectory(doc)
endif()
754

755
756
add_subdirectory(kconf_update)

757
758
759
760
# 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})

761
762
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)

763
include(CMakePackageConfigHelpers)
764
set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KWinDBusInterface")
765
configure_package_config_file(KWinDBusInterfaceConfig.cmake.in
766
    "${CMAKE_CURRENT_BINARY_DIR}/KWinDBusInterfaceConfig.cmake"
767
    PATH_VARS KDE_INSTALL_DBUSINTERFACEDIR
768
    INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR})
769
770
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/KWinDBusInterfaceConfig.cmake
    DESTINATION ${CMAKECONFIG_INSTALL_DIR})