kwin/CMakeLists.txt
Martin Gräßlin 324aae916a [kwin] Drop testapp for detecting whether direct rendering works on glx
The main purpose of the opengl testapp was to set the environment
variable LIBGL_ALWAYS_INDIRECT if direct rendering is not supported
before glx gets initialized.

With Qt5 we may no longer set this environment variable. QtQuick
requires direct rendering. On IvyBridge QtQuick is crashing if the
variable is set. Thus we are no longer allowed to set it and thus the
complete test becomes pointless.

The test app basically whitelisted most drivers anyway, the only
drivers which were problematic are the proprietary Catalyst drivers.
It that's still a problem we can also disable OpenGL compositing on
those drivers through the recommendation in the GLPlatform.

This also means that the KWIN_DIRECT_GL variable is no longer useful.
2013-11-05 14:48:40 +01:00

361 lines
9.7 KiB
CMake

########### configure tests ###############
INCLUDE(CMakeDependentOption)
OPTION(KWIN_BUILD_DECORATIONS "Enable building of KWin decorations." ON)
OPTION(KWIN_BUILD_OXYGEN "Enable building of default decoration Oxygen" ON)
OPTION(KWIN_BUILD_KCMS "Enable building of KWin configuration modules." ON)
OPTION(KWIN_MOBILE_EFFECTS "Only build effects relevant for mobile devices" OFF)
OPTION(KWIN_BUILD_TABBOX "Enable building of KWin Tabbox functionality" ON)
OPTION(KWIN_BUILD_SCREENEDGES "Enable building of KWin with screen edge support" ON)
OPTION(KWIN_BUILD_SCRIPTING "Enable building of KWin with scripting support" ON)
OPTION(KWIN_BUILD_KAPPMENU "Enable building of KWin with application menu support" ON)
OPTION(KWIN_BUILD_XRENDER_COMPOSITING "Enable building of KWin with XRender Compositing support" ON)
OPTION(KWIN_BUILD_OPENGL_1_COMPOSITING "Enable support for OpenGL 1.x, automatically disabled when building for OpenGL ES 2.0" ON)
OPTION(KWIN_BUILD_ACTIVITIES "Enable building of KWin with kactivities support" OFF)
if(${KDE_PLATFORM_PROFILE} STREQUAL "Desktop")
OPTION(KWIN_PLASMA_ACTIVE "Enable building KWin for Plasma Active." OFF)
else()
OPTION(KWIN_PLASMA_ACTIVE "Enable building KWin for Plasma Active." On)
endif()
# Binary name of KWin
set(KWIN_NAME "kwin")
if(KWIN_PLASMA_ACTIVE)
set(KWIN_BUILD_DECORATIONS OFF)
set(KWIN_BUILD_KCMS OFF)
set(KWIN_BUILD_SCREENEDGES OFF)
set(KWIN_BUILD_SCRIPTING ON)
set(KWIN_BUILD_XRENDER_COMPOSITING OFF)
set(KWIN_MOBILE_EFFECTS ON)
set(KWIN_BUILD_WITH_OPENGLES ON)
set(KWIN_NAME "kwinactive")
endif()
cmake_dependent_option(KWIN_BUILD_KAPPMENU "Build without appmenu support" ON "KWIN_BUILD_DECORATIONS" FALSE)
set(KWIN_BUILD_OPENGL FALSE)
set(KWIN_BUILD_OPENGLES FALSE)
if(OPENGL_FOUND AND (${Qt5Gui_OPENGL_IMPLEMENTATION} STREQUAL "GL"))
set(KWIN_BUILD_OPENGL TRUE)
message("Building KWin with OpenGL support")
endif()
if(OPENGLES_FOUND AND (${Qt5Gui_OPENGL_IMPLEMENTATION} STREQUAL "GLESv2"))
set(KWIN_BUILD_OPENGLES TRUE)
message("Building KWin with OpenGL ES 2 support")
endif()
if(NOT KWIN_BUILD_OPENGL AND NOT KWIN_BUILD_OPENGLES)
message(FATAL_ERROR "KWin needs to be built against either OpenGL or OpenGL ES 2. Check your Qt config!")
endif()
# KWIN_HAVE_XRENDER_COMPOSITING - whether XRender-based compositing support is available: may be disabled
if( KWIN_BUILD_XRENDER_COMPOSITING )
set( KWIN_HAVE_XRENDER_COMPOSITING 1 )
endif()
if(KWIN_BUILD_OPENGL)
include_directories(${OPENGL_INCLUDE_DIR})
endif()
if(OPENGL_EGL_FOUND)
include_directories(${OPENGLES_EGL_INCLUDE_DIR})
set(KWIN_HAVE_EGL 1)
endif()
if(KWIN_BUILD_OPENGLES)
include_directories(${OPENGLES_INCLUDE_DIR})
endif()
include_directories(${XCB_INCLUDE_DIR})
if(WAYLAND_FOUND AND KWIN_HAVE_EGL)
include_directories(${WAYLAND_INCLUDE_DIR})
endif()
# for things that are also used by kwin libraries
configure_file(libkwineffects/kwinconfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/libkwineffects/kwinconfig.h )
# for kwin internal things
configure_file(config-kwin.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kwin.h )
########### global ###############
include_directories(BEFORE
${CMAKE_CURRENT_BINARY_DIR}/libkwineffects
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/libkwineffects
${CMAKE_CURRENT_SOURCE_DIR}/libkdecorations
${CMAKE_CURRENT_SOURCE_DIR}/effects
${CMAKE_CURRENT_SOURCE_DIR}/tabbox
)
add_subdirectory( libkdecorations )
add_subdirectory( libkwineffects )
add_subdirectory( killer )
if(KWIN_BUILD_KCMS)
add_subdirectory( kcmkwin )
endif()
if( KWIN_BUILD_DECORATIONS )
add_subdirectory( clients )
endif()
# add_subdirectory( data )
add_subdirectory( effects )
add_subdirectory( scripts )
add_subdirectory( tabbox )
if(KWIN_BUILD_SCRIPTING)
add_subdirectory(scripting)
endif()
add_definitions(-DKDE_DEFAULT_DEBUG_AREA=1212)
########### next target ###############
set(kwin_KDEINIT_SRCS
workspace.cpp
dbusinterface.cpp
client.cpp
client_machine.cpp
cursor.cpp
tabgroup.cpp
focuschain.cpp
netinfo.cpp
placement.cpp
atoms.cpp
utils.cpp
layers.cpp
main.cpp
options.cpp
outline.cpp
decorations.cpp
events.cpp
killwindow.cpp
geometrytip.cpp
screens.cpp
shadow.cpp
sm.cpp
group.cpp
bridge.cpp
manage.cpp
overlaywindow.cpp
activation.cpp
useractions.cpp
geometry.cpp
rules.cpp
composite.cpp
toplevel.cpp
unmanaged.cpp
scene.cpp
scene_xrender.cpp
scene_opengl.cpp
glxbackend.cpp
thumbnailitem.cpp
lanczosfilter.cpp
deleted.cpp
effects.cpp
compositingprefs.cpp
paintredirector.cpp
virtualdesktops.cpp
xcbutils.cpp
)
if(KWIN_BUILD_SCRIPTING)
set(
kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS}
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
)
endif()
if(KWIN_BUILD_TABBOX)
set(
kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS}
tabbox/tabbox.cpp
tabbox/clientmodel.cpp
tabbox/declarative.cpp
tabbox/desktopchain.cpp
tabbox/desktopmodel.cpp
tabbox/tabboxconfig.cpp
tabbox/tabboxhandler.cpp
)
endif()
if(KWIN_BUILD_SCREENEDGES)
set(
kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS}
screenedge.cpp
)
endif()
if(KWIN_BUILD_KAPPMENU)
set(
kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS}
appmenu.cpp
)
endif()
if(KWIN_BUILD_ACTIVITIES)
set(
kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS}
activities.cpp
)
endif()
if(KWIN_HAVE_EGL)
set(kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS} eglonxbackend.cpp)
endif()
if(WAYLAND_FOUND AND KWIN_HAVE_EGL)
set(kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS} egl_wayland_backend.cpp)
endif()
kde4_add_kcfg_files(kwin_KDEINIT_SRCS settings.kcfgc)
qt4_add_dbus_adaptor( kwin_KDEINIT_SRCS org.kde.KWin.xml dbusinterface.h KWin::DBusInterface )
qt4_add_dbus_adaptor( kwin_KDEINIT_SRCS org.kde.kwin.Compositing.xml composite.h KWin::Compositor )
qt4_add_dbus_adaptor( kwin_KDEINIT_SRCS org.kde.kwin.Effects.xml effects.h KWin::EffectsHandlerImpl )
qt4_add_dbus_interface( kwin_KDEINIT_SRCS
${KDEBASE_WORKSPACE_SOURCE_DIR}/ksmserver/org.kde.KSMServerInterface.xml ksmserver_interface)
qt4_add_dbus_interface( kwin_KDEINIT_SRCS
${KDEBASE_WORKSPACE_SOURCE_DIR}/ksmserver/screenlocker/dbus/org.freedesktop.ScreenSaver.xml screenlocker_interface)
qt4_add_resources( kwin_KDEINIT_SRCS resources.qrc )
########### target link libraries ###############
set(kwin_OWN_LIBS
kdecorations
kwineffects
)
set(kwin_QT_LIBS
Qt5::Concurrent
Qt5::DBus
Qt5::Quick
Qt5::X11Extras
)
set(kwin_KDE_LIBS
KF5::KDE4Support
KF5::KDeclarative
KF5::KConfigCore
KF5::KCoreAddons
KF5::KCrash
KF5::KI18n
KF5::KIconThemes
KF5::KNotifications
KF5::KService
KF5::Plasma
KF5::KWindowSystem
KF5::XmlGui
)
set(kwin_XLIB_LIBS
${X11_X11_LIB}
${X11_Xcursor_LIB}
${X11_ICE_LIB}
${X11_SM_LIB}
)
set(kwin_XCB_LIBS
${XCB_XCB_LIBRARY}
${XCB_XFIXES_LIBRARY}
${XCB_DAMAGE_LIBRARY}
${XCB_COMPOSITE_LIBRARY}
${XCB_SHAPE_LIBRARY}
${XCB_SYNC_LIBRARY}
${XCB_RENDER_LIBRARY}
${XCB_RANDR_LIBRARY}
${XCB_KEYSYMS_LIBRARY}
)
set(kwin_WAYLAND_LIBS
${WAYLAND_CLIENT_LIBRARIES}
${WAYLAND_EGL_LIBRARIES}
${XCB_SHM_LIBRARY}
${XCB_XTEST_LIBRARY}
)
set(kwin_OPENGL_LIBS )
find_library(XF86VM_LIBRARY Xxf86vm)
if (XF86VM_LIBRARY)
set(kwin_XLIB_LIBS ${kwin_XLIB_LIBS} ${XF86VM_LIBRARY})
else()
add_definitions(-DKWIN_NO_XF86VM)
endif()
if(KWIN_BUILD_SCRIPTING)
set(kwin_QT_LIBS ${kwin_QT_LIBS} Qt5::Script)
endif()
if(KWIN_BUILD_ACTIVITIES)
set(kwin_KDE_LIBS ${kwin_KDE_LIBS} ${KACTIVITIES_LIBRARY})
endif()
if(OPENGL_EGL_FOUND)
set(kwin_OPENGL_LIBS ${kwin_OPENGL_LIBS} ${OPENGLES_EGL_LIBRARY})
endif()
set(kwinLibs
${kwin_OWN_LIBS}
${kwin_QT_LIBS}
${kwin_KDE_LIBS}
${kwin_XLIB_LIBS}
${kwin_XCB_LIBS}
${kwin_OPENGL_LIBS}
)
if(WAYLAND_FOUND AND KWIN_HAVE_EGL)
set(kwinLibs ${kwinLibs} ${kwin_WAYLAND_LIBS})
endif()
kf5_add_kdeinit_executable( kwin ${kwin_KDEINIT_SRCS})
target_link_libraries(kdeinit_kwin ${kwinLibs})
set_target_properties(kwin PROPERTIES OUTPUT_NAME ${KWIN_NAME})
set_target_properties(kdeinit_kwin PROPERTIES OUTPUT_NAME kdeinit4_${KWIN_NAME})
if(KWIN_BUILD_OPENGL)
if( KWIN_BUILD_OPENGL_1_COMPOSITING )
set_target_properties(kdeinit_kwin PROPERTIES COMPILE_FLAGS -DKWIN_HAVE_OPENGL_1)
endif()
target_link_libraries(kdeinit_kwin kwinglutils ${OPENGL_gl_LIBRARY})
# -ldl used by OpenGL code
find_library(DL_LIBRARY dl)
if (DL_LIBRARY)
target_link_libraries(kdeinit_kwin ${DL_LIBRARY})
endif()
elseif(KWIN_BUILD_OPENGLES)
target_link_libraries(kdeinit_kwin ${kwinLibs} kwinglesutils ${OPENGLES_LIBRARIES})
set_target_properties(kdeinit_kwin PROPERTIES COMPILE_FLAGS "-DKWIN_HAVE_OPENGLES")
endif()
install(TARGETS kdeinit_kwin ${INSTALL_TARGETS_DEFAULT_ARGS} )
install(TARGETS kwin ${INSTALL_TARGETS_DEFAULT_ARGS} )
########### install files ###############
install( FILES kwin.kcfg DESTINATION ${KCFG_INSTALL_DIR} RENAME ${KWIN_NAME}.kcfg )
install( FILES kwin.notifyrc DESTINATION ${DATA_INSTALL_DIR}/${KWIN_NAME} RENAME ${KWIN_NAME}.notifyrc)
install( FILES org.kde.KWin.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR} )
if( KWIN_BUILD_SCRIPTING )
# Install the KWin/WindowSwitcher service type
install( FILES scripting/kwinscript.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} )
endif()
ecm_install_icons( ${ICON_INSTALL_DIR} )
add_subdirectory(tests)