Split the libs we link to into multiple variables

Using a lib variable for:
* own libs
* qt libs
* kde libs
* xlib libs
* xcb libs

and link those groups together in target_link_libraries. This should
make the code easier to read and easier to support in future for some
time both Qt4 and Qt5.
This commit is contained in:
Martin Gräßlin 2013-02-25 12:05:36 +01:00
parent ea83a9c578
commit 928e5d4912
3 changed files with 108 additions and 26 deletions

View file

@ -189,27 +189,75 @@ qt4_add_dbus_interface( kwin_KDEINIT_SRCS
qt4_add_resources( kwin_KDEINIT_SRCS resources.qrc )
set(kwinLibs ${KDE4_KDEUI_LIBS} ${KDE4_PLASMA_LIBS} ${QT_QTDECLARATIVE_LIBRARY} ${KDECLARATIVE_LIBRARIES} kdecorations kwineffects ${X11_LIBRARIES} ${X11_Xcursor_LIB} ${X11_Xrandr_LIB} ${X11_Xdamage_LIB} ${X11_Xrender_LIB} ${X11_Xfixes_LIB} ${XCB_XCB_LIBRARIES} ${X11_XCB_LIBRARIES} ${XCB_XFIXES_LIBRARIES} ${XCB_DAMAGE_LIBRARIES} ${XCB_COMPOSITE_LIBRARIES} ${XCB_SHAPE_LIBRARIES} ${XCB_SYNC_LIBRARIES} ${XCB_RENDER_LIBRARIES} ${XCB_RANDR_LIBRARIES} ${XCB_KEYSYMS_LIBRARIES})
########### target link libraries ###############
set(kwin_OWN_LIBS
kdecorations
kwineffects
)
set(kwin_QT_LIBS
${QT_QTDECLARATIVE_LIBRARY}
)
set(kwin_KDE_LIBS
${KDE4_KDEUI_LIBS}
${KDE4_PLASMA_LIBS}
${KDECLARATIVE_LIBRARIES}
)
set(kwin_XLIB_LIBS
${X11_LIBRARIES}
${X11_Xcursor_LIB}
${X11_Xrandr_LIB}
${X11_Xdamage_LIB}
${X11_Xrender_LIB}
${X11_Xfixes_LIB}
)
set(kwin_XCB_LIBS
${XCB_XCB_LIBRARIES}
${X11_XCB_LIBRARIES}
${XCB_XFIXES_LIBRARIES}
${XCB_DAMAGE_LIBRARIES}
${XCB_COMPOSITE_LIBRARIES}
${XCB_SHAPE_LIBRARIES}
${XCB_SYNC_LIBRARIES}
${XCB_RENDER_LIBRARIES}
${XCB_RANDR_LIBRARIES}
${XCB_KEYSYMS_LIBRARIES}
)
set(kwin_OPENGL_LIBS )
find_library(XF86VM_LIBRARY Xxf86vm)
if (XF86VM_LIBRARY)
set(kwinLibs ${kwinLibs} ${XF86VM_LIBRARY})
set(kwin_XLIB_LIBS ${kwin_XLIB_LIBS} ${XF86VM_LIBRARY})
else(XF86VM_LIBRARY)
add_definitions(-DKWIN_NO_XF86VM)
endif()
if(KWIN_BUILD_SCRIPTING)
set(kwinLibs ${kwinLibs} ${QT_QTSCRIPT_LIBRARY})
set(kwin_QT_LIBS ${kwin_QT_LIBS} ${QT_QTSCRIPT_LIBRARY})
endif()
if(KWIN_BUILD_ACTIVITIES)
set(kwinLibs ${kwinLibs} ${KACTIVITIES_LIBRARY})
set(kwin_KDE_LIBS ${kwin_KDE_LIBS} ${KACTIVITIES_LIBRARY})
endif()
if(OPENGL_EGL_FOUND)
set(kwinLibs ${kwinLibs} ${OPENGLES_EGL_LIBRARY})
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}
)
kde4_add_kdeinit_executable( kwin ${kwin_KDEINIT_SRCS})
target_link_libraries(kdeinit_kwin ${kwinLibs})

View file

@ -1,10 +1,42 @@
# the factory macros cause errors
kde4_no_enable_final(kwineffects)
set(kwin_effect_OWN_LIBS
kwineffects
)
set(kwin_effect_KDE_LIBS
${KDE4_KDEUI_LIBS}
${KDE4_PLASMA_LIBS}
)
set(kwin_effect_XLIB_LIBS
${X11_LIBRARIES}
${X11_Xcursor_LIB}
${X11_Xfixes_LIB}
)
set(kwin_effect_XCB_LIBS
${XCB_XCB_LIBRARIES}
${X11_XCB_LIBRARIES}
${XCB_IMAGE_LIBRARIES}
${XCB_XFIXES_LIBRARIES}
)
if( KWIN_HAVE_XRENDER_COMPOSITING )
set(kwin_effect_XLIB_LIBS ${kwin_effect_XLIB_LIBS} ${X11_Xrender_LIB})
set(kwin_effect_XCB_LIBS ${kwin_effect_XCB_LIBS} ${XCB_RENDER_LIBRARIES})
endif()
if(OPENGL_FOUND)
set(kwin_effect_OWN_LIBS ${kwin_effect_OWN_LIBS} kwinglutils)
elseif(OPENGLES_FOUND)
set(kwin_effect_OWN_LIBS ${kwin_effect_OWN_LIBS} kwinglesutils)
endif()
macro( KWIN4_ADD_EFFECT_BACKEND name )
kde4_add_plugin( ${name} ${ARGN} )
target_link_libraries( ${name} kwineffects ${KDE4_KDEUI_LIBS} ${KDE4_PLASMA_LIBS} ${X11_Xfixes_LIB} ${X11_Xcursor_LIB} ${X11_LIBRARIES} ${XCB_XCB_LIBRARIES} ${XCB_IMAGE_LIBRARIES} ${X11_XCB_LIBRARIES}
${XCB_XFIXES_LIBRARIES})
target_link_libraries( ${name} ${kwin_effect_OWN_LIBS} ${kwin_effect_KDE_LIBS} ${kwin_effect_XLIB_LIBS} ${kwin_effect_XCB_LIBS})
endmacro()
# Adds effect plugin with given name. Sources are given after the name
@ -13,12 +45,10 @@ macro( KWIN4_ADD_EFFECT name )
# OpenGL or neither OpenGL nor OpenGL ES - default set
KWIN4_ADD_EFFECT_BACKEND(kwin4_effect_${name} ${ARGN})
if(OPENGL_FOUND)
target_link_libraries(kwin4_effect_${name} kwinglutils)
if( KWIN_BUILD_OPENGL_1_COMPOSITING )
set_target_properties(kwin4_effect_${name} PROPERTIES COMPILE_FLAGS -DKWIN_HAVE_OPENGL_1)
endif()
elseif(OPENGLES_FOUND)
target_link_libraries(kwin4_effect_${name} kwinglesutils)
set_target_properties(kwin4_effect_${name} PROPERTIES COMPILE_FLAGS "-DKWIN_HAVE_OPENGLES")
endif()
set_target_properties(kwin4_effect_${name} PROPERTIES OUTPUT_NAME ${KWIN_NAME}4_effect_${name})
@ -29,7 +59,6 @@ macro( KWIN4_ADD_EFFECT name )
if(OPENGLES_FOUND)
KWIN4_ADD_EFFECT_BACKEND(kwin4_effect_gles_${name} ${ARGN})
# OpenGL ES gets into a different library
target_link_libraries(kwin4_effect_gles_${name} kwinglesutils)
set_target_properties(kwin4_effect_gles_${name} PROPERTIES COMPILE_FLAGS "-DKWIN_HAVE_OPENGLES")
set_target_properties(kwin4_effect_gles_${name} PROPERTIES OUTPUT_NAME ${KWIN_NAME}4_effect_gles_${name})
install( TARGETS kwin4_effect_gles_${name} DESTINATION ${PLUGIN_INSTALL_DIR} )
@ -57,18 +86,6 @@ macro( KWIN4_ADD_EFFECT_CONFIG name )
install( TARGETS kcm_kwin4_effect_${name} DESTINATION ${PLUGIN_INSTALL_DIR} )
endmacro()
macro( KWIN4_EFFECT_LINK_XRENDER name )
if( KWIN_HAVE_XRENDER_COMPOSITING )
target_link_libraries( kwin4_effect_${name} ${X11_Xrender_LIB} ${XCB_RENDER_LIBRARIES})
# if building for OpenGL and OpenGL ES we have two targets
# TODO: if building for OpenGL ES we should not build XRender support
if(OPENGLES_FOUND)
target_link_libraries( kwin4_effect_gles_${name} ${X11_Xrender_LIB} ${XCB_RENDER_LIBRARIES})
endif()
endif()
endmacro()
# Install the KWin/Effect service type
install( FILES kwineffect.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} )
@ -153,4 +170,3 @@ KWIN4_ADD_EFFECT( builtins ${kwin4_effect_builtins_sources} )
if( NOT KWIN_MOBILE_EFFECTS )
KWIN4_ADD_EFFECT_CONFIG( builtins ${kwin4_effect_builtins_config_sources} )
endif()
KWIN4_EFFECT_LINK_XRENDER( builtins )

View file

@ -9,16 +9,34 @@ set(kwin_EFFECTSLIB_SRCS
kwinxrenderutils.cpp
)
kde4_add_library(kwineffects SHARED ${kwin_EFFECTSLIB_SRCS})
target_link_libraries(kwineffects ${KDE4_KDEUI_LIBS} ${QT_QTGUI_LIBRARY}
set(kwineffects_QT_LIBS
${QT_QTGUI_LIBRARY}
)
set(kwineffects_KDE_LIBS
${KDE4_KDEUI_LIBS}
)
set(kwineffects_XLIB_LIBS
${X11_LIBRARIES}
${X11_Xrandr_LIB}
${X11_Xdamage_LIB}
)
set(kwineffects_XCB_LIBS
${XCB_XCB_LIBRARIES}
${X11_XCB_LIBRARIES}
${XCB_XFIXES_LIBRARIES}
${XCB_RENDER_LIBRARIES}
)
kde4_add_library(kwineffects SHARED ${kwin_EFFECTSLIB_SRCS})
target_link_libraries(kwineffects
${kwineffects_QT_LIBS}
${kwineffects_KDE_LIBS}
${kwineffects_XLIB_LIBS}
${kwineffects_XCB_LIBS}
)
set_target_properties(kwineffects PROPERTIES VERSION 1.0.0 SOVERSION 1 )
set_target_properties(kwineffects PROPERTIES OUTPUT_NAME ${KWIN_NAME}effects)
@ -39,7 +57,7 @@ macro( KWIN4_ADD_GLUTILS_BACKEND name glinclude )
include_directories(${OPENGLES_EGL_INCLUDE_DIR})
endif()
kde4_add_library(${name} SHARED ${kwin_GLUTILSLIB_SRCS})
target_link_libraries(${name} ${KDE4_KDEUI_LIBS} ${QT_QTGUI_LIBRARY} ${X11_LIBRARIES} ${XCB_XCB_LIBRARIES} ${X11_XCB_LIBRARIES} kwineffects)
target_link_libraries(${name} ${KDE4_KDEUI_LIBS} ${QT_QTGUI_LIBRARY} ${kwineffects_XLIB_LIBS} ${kwineffects_XCB_LIBS} kwineffects)
if(OPENGL_EGL_FOUND)
target_link_libraries(${name} ${OPENGLES_EGL_LIBRARY})
endif()