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
master
Martin Gräßlin 8 years ago
parent 42456bdf7b
commit 0dc500fe94

@ -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)

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

@ -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

@ -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;

Loading…
Cancel
Save