Move linking to DL_LIBRARY to x11standalone platform

Summary:
It's only needed by the GLX backend, so only find if we have GLX at all
and only link where needed. As it was handled incorrectly before, it's
now using proper ifdef.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3448
This commit is contained in:
Martin Gräßlin 2016-11-22 08:34:59 +01:00
parent 42456bdf7b
commit 0dc500fe94
4 changed files with 17 additions and 5 deletions

View file

@ -148,6 +148,14 @@ set_package_properties(epoxy PROPERTIES DESCRIPTION "libepoxy"
PURPOSE "OpenGL dispatch library"
)
set(HAVE_DL_LIBRARY FALSE)
if(epoxy_HAS_GLX)
find_library(DL_LIBRARY dl)
if(DL_LIBRARY)
set(HAVE_DL_LIBRARY TRUE)
endif()
endif()
find_package(Wayland 1.2 REQUIRED COMPONENTS Cursor OPTIONAL_COMPONENTS Egl)
set_package_properties(Wayland PROPERTIES
TYPE REQUIRED
@ -573,11 +581,6 @@ target_link_libraries(kwin ${kwinLibs})
generate_export_header(kwin EXPORT_FILE_NAME kwin_export.h)
target_link_libraries(kwin kwinglutils ${epoxy_LIBRARY})
# -ldl used by OpenGL code
find_library(DL_LIBRARY dl)
if (DL_LIBRARY)
target_link_libraries(kwin ${DL_LIBRARY})
endif()
kf5_add_kdeinit_executable(kwin_x11 main_x11.cpp)
target_link_libraries(kdeinit_kwin_x11 kwin KF5::Crash)

View file

@ -21,5 +21,6 @@
#cmakedefine01 HAVE_EPOXY_GLX
#cmakedefine01 HAVE_DL_LIBRARY
#endif

View file

@ -21,6 +21,10 @@ if(X11_Xinput_FOUND)
target_link_libraries(KWinX11Platform ${X11_Xinput_LIB})
endif()
if(HAVE_DL_LIBRARY)
target_link_libraries(KWinX11Platform ${DL_LIBRARY})
endif()
install(
TARGETS
KWinX11Platform

View file

@ -43,7 +43,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <deque>
#include <algorithm>
#if HAVE_DL_LIBRARY
#include <dlfcn.h>
#endif
#ifndef XCB_GLX_BUFFER_SWAP_COMPLETE
#define XCB_GLX_BUFFER_SWAP_COMPLETE 1
@ -159,8 +161,10 @@ static glXFuncPtr getProcAddress(const char* name)
#if HAVE_EPOXY_GLX
ret = glXGetProcAddress((const GLubyte*) name);
#endif
#if HAVE_DL_LIBRARY
if (ret == nullptr)
ret = (glXFuncPtr) dlsym(RTLD_DEFAULT, name);
#endif
return ret;
}
glXSwapIntervalMESA_func glXSwapIntervalMESA;