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

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

7
set(QT_MIN_VERSION "5.7.0")
David Edmundson's avatar
David Edmundson committed
8
set(KF5_MIN_VERSION "5.34.0")
9

10
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH} )
11 12 13 14 15

find_package(ECM 0.0.11 REQUIRED NO_MODULE)

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 28 29 30 31
    Script
    UiTools
    Widgets
    X11Extras
)
32 33 34 35 36 37 38 39 40 41 42 43 44

find_package(Qt5Test ${QT_MIN_VERSION} CONFIG QUIET)
set_package_properties(Qt5Test PROPERTIES
         PURPOSE "Required for tests"
         TYPE OPTIONAL
         )
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)
45
include(KDECompilerSettings NO_POLICY_SCOPE)
46 47

include(ECMInstallIcons)
48
include(ECMOptionalAddSubdirectory)
49

Nick Shaforostoff's avatar
Nick Shaforostoff committed
50
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0 -DQT_USE_QSTRINGBUILDER)
51

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

55 56 57 58
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override")
endif()

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

65 66

# required frameworks by Core
67
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
68 69 70 71 72 73
    Config
    ConfigWidgets
    CoreAddons
    Crash
    GlobalAccel
    I18n
74
    Init
75
    Notifications
76
    Package
77 78 79
    Plasma
    WidgetsAddons
    WindowSystem
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
80
    IconThemes
Martin Flöser's avatar
Martin Flöser committed
81
    IdleTime
82
    Wayland
83 84
)
# required frameworks by config modules
85
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
86
    Completion
87
    Declarative
88 89
    KCMUtils
    KIO
90
    TextWidgets
91
    NewStuff
92
    Service
93 94 95
    XmlGui
)

96 97 98 99 100 101
find_package(Threads)
set_package_properties(Threads PROPERTIES
         PURPOSE "Needed for VirtualTerminal support in KWin Wayland"
         TYPE REQUIRED
         )

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

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

117
find_package(KDecoration2 CONFIG REQUIRED)
118

119 120 121 122 123
find_package(KScreenLocker CONFIG REQUIRED)
set_package_properties(KScreenLocker PROPERTIES
                       TYPE REQUIRED
                       PURPOSE "For screenlocker integration in kwin_wayland")

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

139 140
find_package(EGL)
set_package_properties(EGL PROPERTIES
Fredrik Höglund's avatar
Fredrik Höglund committed
141
                       TYPE RUNTIME
142 143 144
                       PURPOSE "Required to build KWin with EGL support"
                      )

Fredrik Höglund's avatar
Fredrik Höglund committed
145 146 147 148 149 150 151
find_package(epoxy)
set_package_properties(epoxy PROPERTIES DESCRIPTION "libepoxy"
                       URL "http://github.com/anholt/libepoxy"
                       TYPE REQUIRED
                       PURPOSE "OpenGL dispatch library"
                      )

152 153 154 155 156 157 158 159
set(HAVE_DL_LIBRARY FALSE)
if(epoxy_HAS_GLX)
    find_library(DL_LIBRARY dl)
    if(DL_LIBRARY)
        set(HAVE_DL_LIBRARY TRUE)
    endif()
endif()

160
find_package(Wayland 1.2 REQUIRED COMPONENTS Cursor OPTIONAL_COMPONENTS Egl)
161
set_package_properties(Wayland PROPERTIES
162
                       TYPE REQUIRED
163 164
                       PURPOSE "Required for building KWin with Wayland support"
                      )
165 166 167 168 169
add_feature_info("Wayland::EGL" Wayland_Egl_FOUND "Enable building of Wayland backend and QPA with EGL support.")
set(HAVE_WAYLAND_EGL FALSE)
if(Wayland_Egl_FOUND)
    set(HAVE_WAYLAND_EGL TRUE)
endif()
170

171
find_package(XKB 0.7.0)
172
set_package_properties(XKB PROPERTIES
173
                       TYPE REQUIRED
174 175 176
                       PURPOSE "Required for building KWin with Wayland support"
                      )

177
find_package(Libinput 1.5)
Martin Flöser's avatar
Martin Flöser committed
178 179 180 181 182 183 184 185 186
set_package_properties(Libinput PROPERTIES TYPE OPTIONAL PURPOSE "Required for input handling on Wayland.")

find_package(UDev)
set_package_properties(UDev PROPERTIES  URL "http://www.freedesktop.org/software/systemd/libudev/"
                                        DESCRIPTION "Linux device library."
                                        TYPE OPTIONAL
                                        PURPOSE "Required for input handling on Wayland."
                        )
set(HAVE_INPUT FALSE)
187
if (Libinput_FOUND AND UDEV_FOUND)
Martin Flöser's avatar
Martin Flöser committed
188 189
    set(HAVE_INPUT TRUE)
endif()
190 191 192 193
set(HAVE_UDEV FALSE)
if (UDEV_FOUND)
    set(HAVE_UDEV TRUE)
endif()
Martin Flöser's avatar
Martin Flöser committed
194

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

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

209 210
find_package(libhybris)
set_package_properties(libhybris PROPERTIES TYPE OPTIONAL PURPOSE "Required for libhybris backend")
Martin Flöser's avatar
Martin Flöser committed
211
set(HAVE_LIBHYBRIS ${libhybris_FOUND})
212

213 214 215 216 217
find_package(X11)
set_package_properties(X11 PROPERTIES DESCRIPTION "X11 libraries"
                        URL "http://www.x.org"
                        TYPE REQUIRED
                    )
218 219
add_feature_info("XInput" X11_Xinput_FOUND "Required for poll-free mouse cursor updates")
set(HAVE_X11_XINPUT ${X11_Xinput_FOUND})
220 221

# All the required XCB components
Martin Flöser's avatar
Martin Flöser committed
222
find_package(XCB 1.10
223 224 225 226 227 228 229 230 231 232 233 234
    REQUIRED COMPONENTS
        XCB
        XFIXES
        DAMAGE
        COMPOSITE
        SHAPE
        SYNC
        RENDER
        RANDR
        KEYSYMS
        IMAGE
        SHM
235
        GLX
236
        CURSOR
237
        ICCCM
238 239 240 241
)
set_package_properties(XCB PROPERTIES TYPE REQUIRED)

# and the optional XCB dependencies
242 243 244
if (XCB_ICCCM_VERSION VERSION_LESS "0.4")
    set(XCB_ICCCM_FOUND FALSE)
endif()
245 246
add_feature_info("XCB-ICCCM" XCB_ICCCM_FOUND "Required for building test applications for KWin")

247 248
find_package(X11_XCB)
set_package_properties(X11_XCB PROPERTIES
249
                       PURPOSE "Required for building X11 windowed backend of kwin_wayland"
250 251
                       TYPE OPTIONAL)

252
# dependencies for QPA plugin
253 254 255 256 257 258 259 260
if(Qt5Core_VERSION VERSION_LESS "5.8.0")
    find_package(Qt5PlatformSupport REQUIRED)
else()
    find_package(Qt5FontDatabaseSupport REQUIRED)
    find_package(Qt5ThemeSupport REQUIRED)
    find_package(Qt5EventDispatcherSupport REQUIRED)
endif()

261 262 263 264 265 266 267 268 269 270 271 272 273
find_package(Freetype REQUIRED)
set_package_properties(Freetype PROPERTIES DESCRIPTION "A font rendering engine"
                       URL "http://www.freetype.org"
                       TYPE REQUIRED
                       PURPOSE "Needed for KWin's QPA plugin."
                      )
find_package(Fontconfig REQUIRED)
set_package_properties(Fontconfig PROPERTIES DESCRIPTION "Font access configuration library"
                       URL "http://www.freedesktop.org/wiki/Software/fontconfig"
                       TYPE REQUIRED
                       PURPOSE "Needed for KWin's QPA plugin."
                      )

274 275 276 277 278 279 280 281
find_package(Xwayland)
set_package_properties(Xwayland PROPERTIES
    URL "http://x.org"
    DESCRIPTION "Xwayland X server"
    TYPE RUNTIME
    PURPOSE "Needed for running kwin_wayland"
    )

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

289
########### configure tests ###############
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
290 291 292 293 294 295
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)
296
cmake_dependent_option(KWIN_BUILD_ACTIVITIES "Enable building of KWin with kactivities support" ON "KF5Activities_FOUND" OFF)
297

298 299
# Binary name of KWin
set(KWIN_NAME "kwin")
Hrvoje Senjan's avatar
Hrvoje Senjan committed
300 301
set(KWIN_INTERNAL_NAME_X11 "kwin_x11")
set(KWIN_INTERNAL_NAME_WAYLAND "kwin_wayland")
302
set(KWIN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
303

304 305
# KWIN_HAVE_XRENDER_COMPOSITING - whether XRender-based compositing support is available: may be disabled
if( KWIN_BUILD_XRENDER_COMPOSITING )
306
    set( KWIN_HAVE_XRENDER_COMPOSITING 1 )
Martin Flöser's avatar
Martin Flöser committed
307
endif()
308

309
include_directories(${XKB_INCLUDE_DIR})
310

311
include_directories(${epoxy_INCLUDE_DIR})
312
set(HAVE_EPOXY_GLX ${epoxy_HAS_GLX})
313

314
# for things that are also used by kwin libraries
315
configure_file(libkwineffects/kwinconfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/libkwineffects/kwinconfig.h )
316
# for kwin internal things
317
set(HAVE_X11_XCB ${X11_XCB_FOUND})
318

319
include(CheckIncludeFile)
320
include(CheckIncludeFiles)
321
include(CheckSymbolExists)
322 323
check_include_files(unistd.h HAVE_UNISTD_H)
check_include_files(malloc.h HAVE_MALLOC_H)
324 325 326

check_include_file("sys/prctl.h" HAVE_SYS_PRCTL_H)
check_symbol_exists(PR_SET_DUMPABLE "sys/prctl.h" HAVE_PR_SET_DUMPABLE)
327
check_symbol_exists(PR_SET_PDEATHSIG "sys/prctl.h" HAVE_PR_SET_PDEATHSIG)
328 329 330 331 332 333 334 335
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")
336

337
check_include_file("sys/sysmacros.h" HAVE_SYS_SYSMACROS_H)
338 339
configure_file(config-kwin.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kwin.h )

340 341 342 343 344 345 346 347
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")
348

349 350 351 352 353
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")

354
########### global ###############
355
set(kwin_effects_dbus_xml ${CMAKE_CURRENT_SOURCE_DIR}/org.kde.kwin.Effects.xml)
356

357
include_directories(BEFORE
358
    ${CMAKE_CURRENT_BINARY_DIR}/libkwineffects
359
    ${CMAKE_CURRENT_BINARY_DIR}
360
    ${CMAKE_CURRENT_SOURCE_DIR}/libkwineffects
361
    ${CMAKE_CURRENT_SOURCE_DIR}/effects
362
    ${CMAKE_CURRENT_SOURCE_DIR}/tabbox
363
    ${CMAKE_CURRENT_SOURCE_DIR}/platformsupport
364 365
    )

366
add_subdirectory( libkwineffects )
367 368
if(KWIN_BUILD_KCMS)
    add_subdirectory( kcmkwin )
Martin Flöser's avatar
Martin Flöser committed
369
endif()
370

371
add_subdirectory( data )
372

373
add_subdirectory( effects )
Martin Flöser's avatar
Martin Flöser committed
374
add_subdirectory( scripts )
375
add_subdirectory( tabbox )
376
add_subdirectory(scripting)
377
add_subdirectory(helpers)
378

379 380 381
########### next target ###############

set(kwin_KDEINIT_SRCS
382
   workspace.cpp
383
   dbusinterface.cpp
384
   abstract_client.cpp
385
   client.cpp
386
   client_machine.cpp
Martin Flöser's avatar
Martin Flöser committed
387
   cursor.cpp
388
   debug_console.cpp
Thomas Lübking's avatar
Thomas Lübking committed
389
   tabgroup.cpp
390
   focuschain.cpp
391
   globalshortcuts.cpp
392
   input.cpp
393
   input_event.cpp
394
   input_event_spy.cpp
395
   keyboard_input.cpp
396
   keyboard_layout.cpp
397
   keyboard_layout_switching.cpp
398
   keyboard_repeat.cpp
399
   pointer_input.cpp
400
   touch_input.cpp
401
   netinfo.cpp
402 403 404 405 406 407
   placement.cpp
   atoms.cpp
   utils.cpp
   layers.cpp
   main.cpp
   options.cpp
408
   outline.cpp
409 410 411
   events.cpp
   killwindow.cpp
   geometrytip.cpp
412
   screens.cpp
413
   shadow.cpp
414 415 416
   sm.cpp
   group.cpp
   manage.cpp
417
   overlaywindow.cpp
418 419 420
   activation.cpp
   useractions.cpp
   geometry.cpp
421 422 423 424 425 426
   rules.cpp
   composite.cpp
   toplevel.cpp
   unmanaged.cpp
   scene.cpp
   scene_opengl.cpp
427
   screenlockerwatcher.cpp
428
   thumbnailitem.cpp
429
   lanczosfilter.cpp
430 431
   deleted.cpp
   effects.cpp
432
   effectloader.cpp
433
   virtualdesktops.cpp
434
   xcbutils.cpp
Fredrik Höglund's avatar
Fredrik Höglund committed
435
   x11eventfilter.cpp
436
   logind.cpp
437 438
   onscreennotification.cpp
   osd.cpp
439
    screenedge.cpp
440 441 442 443 444 445 446 447 448
    scripting/scripting.cpp
    scripting/workspace_wrapper.cpp
    scripting/meta.cpp
    scripting/scriptedeffect.cpp
    scripting/scriptingutils.cpp
    scripting/timer.cpp
    scripting/scripting_model.cpp
    scripting/dbuscall.cpp
    scripting/screenedgeitem.cpp
449
    scripting/scripting_logging.cpp
450 451
    decorations/decoratedclient.cpp
    decorations/decorationbridge.cpp
452
    decorations/decorationpalette.cpp
453 454
    decorations/settings.cpp
    decorations/decorationrenderer.cpp
455
    decorations/decorations_logging.cpp
456
    abstract_egl_backend.cpp
457
    platform.cpp
458 459 460
    shell_client.cpp
    wayland_server.cpp
    wayland_cursor_theme.cpp
461
    virtualkeyboard.cpp
Kai Uwe Broulik's avatar
Kai Uwe Broulik committed
462
    appmenu.cpp
463
    modifier_only_shortcuts.cpp
464
    xkb.cpp
465
    gestures.cpp
466
    popup_input_filter.cpp
467 468
    abstract_opengl_context_attribute_builder.cpp
    egl_context_attribute_builder.cpp
469
    was_user_interaction_x11_filter.cpp
470
    moving_client_x11_filter.cpp
471
    effects_mouse_interception_x11_filter.cpp
472
    window_property_notify_x11_filter.cpp
473
    rootinfo_filter.cpp
474 475
   )

476 477 478
if(KWIN_BUILD_TABBOX)
    set(
        kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS}
479
        tabbox/tabbox.cpp
480
        tabbox/clientmodel.cpp
481
        tabbox/desktopchain.cpp
482
        tabbox/desktopmodel.cpp
483
        tabbox/switcheritem.cpp
484 485
        tabbox/tabboxconfig.cpp
        tabbox/tabboxhandler.cpp
486
        tabbox/tabbox_logging.cpp
487
        tabbox/x11_filter.cpp
488
  )
Martin Flöser's avatar
Martin Flöser committed
489
endif()
490

491 492 493 494 495 496 497
if(KWIN_BUILD_ACTIVITIES)
    set(
        kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS}
        activities.cpp
    )
endif()

498 499 500 501 502 503 504
if(UDEV_FOUND)
    set(kwin_KDEINIT_SRCS
        ${kwin_KDEINIT_SRCS}
        udev.cpp
    )
endif()

Martin Flöser's avatar
Martin Flöser committed
505 506 507 508 509
if(HAVE_INPUT)
    set(kwin_KDEINIT_SRCS
        ${kwin_KDEINIT_SRCS}
        libinput/context.cpp
        libinput/connection.cpp
510
        libinput/device.cpp
Martin Flöser's avatar
Martin Flöser committed
511
        libinput/events.cpp
512
        libinput/libinput_logging.cpp
Martin Flöser's avatar
Martin Flöser committed
513
    )
514 515 516 517 518 519
    if (HAVE_LINUX_VT_H)
         set(kwin_KDEINIT_SRCS
             ${kwin_KDEINIT_SRCS}
             virtual_terminal.cpp
         )
    endif()
Martin Flöser's avatar
Martin Flöser committed
520 521
endif()

Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
522
kconfig_add_kcfg_files(kwin_KDEINIT_SRCS settings.kcfgc)
523

Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
524
qt5_add_dbus_adaptor( kwin_KDEINIT_SRCS org.kde.KWin.xml dbusinterface.h KWin::DBusInterface )
525
qt5_add_dbus_adaptor( kwin_KDEINIT_SRCS org.kde.kwin.Compositing.xml dbusinterface.h KWin::CompositorDBusInterface )
526
qt5_add_dbus_adaptor( kwin_KDEINIT_SRCS ${kwin_effects_dbus_xml} effects.h KWin::EffectsHandlerImpl )
527

528
qt5_add_dbus_interface( kwin_KDEINIT_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/org.freedesktop.ScreenSaver.xml screenlocker_interface)
529

Kai Uwe Broulik's avatar
Kai Uwe Broulik committed
530 531
qt5_add_dbus_interface( kwin_KDEINIT_SRCS org.kde.kappmenu.xml appmenu_interface )

Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
532
qt5_add_resources( kwin_KDEINIT_SRCS resources.qrc )
533

Lukáš Tinkl's avatar
Lukáš Tinkl committed
534
ki18n_wrap_ui(kwin_KDEINIT_SRCS
535
    debug_console.ui
536 537 538
    shortcutdialog.ui
)

539 540 541 542
########### target link libraries ###############

set(kwin_OWN_LIBS
    kwineffects
543
    kwin4_effect_builtins
544 545 546
)

set(kwin_QT_LIBS
Martin Flöser's avatar
Martin Flöser committed
547
    Qt5::Concurrent
Martin Flöser's avatar
Martin Flöser committed
548
    Qt5::DBus
549
    Qt5::Quick
550
    Qt5::Script
551 552 553
)

set(kwin_KDE_LIBS
Martin Klapetek's avatar
Martin Klapetek committed
554 555
    KF5::ConfigCore
    KF5::CoreAddons
556
    KF5::ConfigWidgets
557
    KF5::GlobalAccel
558
    KF5::GlobalAccelPrivate
Martin Klapetek's avatar
Martin Klapetek committed
559 560
    KF5::I18n
    KF5::Notifications
561
    KF5::Package
562
    KF5::Plasma
Martin Klapetek's avatar
Martin Klapetek committed
563
    KF5::WindowSystem
564 565
    KDecoration2::KDecoration
    KDecoration2::KDecoration2Private
566
    PW::KScreenLocker
567 568 569
)

set(kwin_XLIB_LIBS
570
    ${X11_X11_LIB}
Martin Flöser's avatar
Martin Flöser committed
571 572
    ${X11_ICE_LIB}
    ${X11_SM_LIB}
573 574
)

575
set(kwin_XCB_LIBS
576 577 578 579 580 581 582 583 584 585
    XCB::XCB
    XCB::XFIXES
    XCB::DAMAGE
    XCB::COMPOSITE
    XCB::SHAPE
    XCB::SYNC
    XCB::RENDER
    XCB::RANDR
    XCB::KEYSYMS
    XCB::SHM
586
    XCB::GLX
587
    XCB::ICCCM
588 589
)

590
set(kwin_WAYLAND_LIBS
591
    XKB::XKB
592
    KF5::WaylandClient
593
    KF5::WaylandServer
594
    Wayland::Cursor
595
    ${CMAKE_THREAD_LIBS_INIT}
596 597
)

598
if(KWIN_BUILD_ACTIVITIES)
599
    set(kwin_KDE_LIBS ${kwin_KDE_LIBS} KF5::Activities)
Martin Flöser's avatar
Martin Flöser committed
600
endif()
601

602 603 604 605 606 607
set(kwinLibs
    ${kwin_OWN_LIBS}
    ${kwin_QT_LIBS}
    ${kwin_KDE_LIBS}
    ${kwin_XLIB_LIBS}
    ${kwin_XCB_LIBS}
608
    ${kwin_WAYLAND_LIBS}
609 610
)

611 612 613 614
if(UDEV_FOUND)
    set(kwinLibs ${kwinLibs} ${UDEV_LIBS})
endif()

Martin Flöser's avatar
Martin Flöser committed
615
if(HAVE_INPUT)
616
    set(kwinLibs ${kwinLibs} Libinput::Libinput)
Martin Flöser's avatar
Martin Flöser committed
617 618
endif()

619
add_library(kwin SHARED ${kwin_KDEINIT_SRCS})
620

621
set_target_properties(kwin PROPERTIES
622 623
   VERSION ${PROJECT_VERSION}
   SOVERSION ${PROJECT_VERSION_MAJOR}
624 625 626 627
   )

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

629
target_link_libraries(kwin kwinglutils ${epoxy_LIBRARY})
630

631
kf5_add_kdeinit_executable(kwin_x11 main_x11.cpp)
632
target_link_libraries(kdeinit_kwin_x11 kwin KF5::Crash Qt5::X11Extras)
633

634
install(TARGETS kwin             ${INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP )
635 636 637
install(TARGETS kdeinit_kwin_x11 ${INSTALL_TARGETS_DEFAULT_ARGS} )
install(TARGETS kwin_x11         ${INSTALL_TARGETS_DEFAULT_ARGS} )

638 639
add_executable(kwin_wayland main_wayland.cpp)
target_link_libraries(kwin_wayland kwin)
640 641 642
if (HAVE_LIBCAP)
    target_link_libraries(kwin_wayland ${Libcap_LIBRARIES})
endif()
643

644
install(TARGETS kwin_wayland         ${INSTALL_TARGETS_DEFAULT_ARGS} )
645 646 647 648 649 650 651 652 653
if (HAVE_LIBCAP)
    install(
    CODE "execute_process(
            COMMAND
                ${SETCAP_EXECUTABLE}
                CAP_SYS_NICE=+ep
                ${CMAKE_INSTALL_FULL_BINDIR}/kwin_wayland)"
    )
endif()
654

655
add_subdirectory(platformsupport)
656
add_subdirectory(plugins)
657 658 659

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

660
install( FILES kwin.kcfg  DESTINATION  ${KCFG_INSTALL_DIR} RENAME ${KWIN_NAME}.kcfg )
661
install( FILES kwin.notifyrc  DESTINATION  ${KNOTIFYRC_INSTALL_DIR} RENAME ${KWIN_NAME}.notifyrc)
662 663 664 665 666 667
install(
    FILES
        org.kde.KWin.xml
        org.kde.kwin.Compositing.xml
        org.kde.kwin.Effects.xml
    DESTINATION
668
        ${KDE_INSTALL_DBUSINTERFACEDIR}
669
)
670
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/kwin_export.h DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)
671

672 673
# Install the KWin/Script service type
install( FILES scripting/kwinscript.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} )
674

Martin Flöser's avatar
Martin Flöser committed
675 676 677 678 679 680 681 682 683
ecm_install_icons(
    ICONS
        16-apps-kwin.png
        32-apps-kwin.png
        48-apps-kwin.png
        sc-apps-kwin.svgz
    DESTINATION
        ${ICON_INSTALL_DIR}
    THEME
684
        hicolor
Martin Flöser's avatar
Martin Flöser committed
685
)
686

687
add_subdirectory(qml)
688
add_subdirectory(autotests)
689
add_subdirectory(tests)
Marco Martin's avatar
Marco Martin committed
690
add_subdirectory(packageplugins)
691 692 693 694

if (KF5DocTools_FOUND)
    add_subdirectory(doc)
endif()
695

696 697
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)

698
include(CMakePackageConfigHelpers)
699
set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KWinDBusInterface")
700
configure_package_config_file(KWinDBusInterfaceConfig.cmake.in
701
    "${CMAKE_CURRENT_BINARY_DIR}/KWinDBusInterfaceConfig.cmake"
702
    PATH_VARS KDE_INSTALL_DBUSINTERFACEDIR
703
    INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR})
704 705
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/KWinDBusInterfaceConfig.cmake
    DESTINATION ${CMAKECONFIG_INSTALL_DIR})