From 440db91f914eb9ba19bd208c443638a508be8f46 Mon Sep 17 00:00:00 2001 From: Alexander Golubev Date: Sun, 1 Sep 2013 09:29:15 +0400 Subject: [PATCH] Add optional opengl support --- CMakeLists.txt | 2 ++ ConfigureChecks.cmake | 27 ++++++++++++++++++++++----- kcontrol/info/CMakeLists.txt | 17 +++++++++++------ kcontrol/info/opengl.desktop | 4 ++-- kcontrol/screensaver/CMakeLists.txt | 2 +- kdesktop/lock/CMakeLists.txt | 2 +- tdescreensaver/CMakeLists.txt | 2 +- tdescreensaver/random.cpp | 2 +- 8 files changed, 41 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index da54b40b1..be4fceca3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,7 @@ include( CheckCXXSourceRuns ) include( CheckCXXSourceCompiles ) include( CheckLibraryExists ) include( CheckFunctionExists ) +include( CheckSymbolExists ) include( CheckStructHasMember ) include( CheckTypeSize ) @@ -70,6 +71,7 @@ option( WITH_XRENDER "Enable xrender support" ${WITH_ALL_OPTIONS} ) option( WITH_XDAMAGE "Enable xdamage support" ${WITH_ALL_OPTIONS} ) option( WITH_XEXT "Enable xext support" ${WITH_ALL_OPTIONS} ) option( WITH_XTEST "Enable xtest support" ${WITH_ALL_OPTIONS} ) +option( WITH_OPENGL "Enable openGL support" ${WITH_ALL_OPTIONS} ) option( WITH_XSCREENSAVER "Enable xscreensaver support" ${WITH_ALL_OPTIONS} ) option( WITH_LIBART "Enable libart support (for SVG icons and wallpapers)" ${WITH_ALL_OPTIONS} ) option( WITH_LIBUSB "Enable control of some mouse models through libusb" ${WITH_ALL_OPTIONS} ) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 06087ba76..ce20b392b 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -168,12 +168,29 @@ if( WITH_XSCREENSAVER ) endif( ) -# GL -if( BUILD_KDESKTOP OR BUILD_KCONTROL OR BUILD_TDESCREENSAVER ) -check_library_exists( GL glXChooseVisual "" HAVE_GLXCHOOSEVISUAL ) - if( HAVE_GLXCHOOSEVISUAL ) - set( GL_LIBRARY "GL" ) +# openGL (kdesktop or kcontrol or tdescreensaver ) +if( WITH_OPENGL ) + pkg_search_module( GL gl ) + if( GL_FOUND ) + # some extra check, stricktly speaking they are not necessary + tde_save( CMAKE_REQUIRED_LIBRARIES ) + set( CMAKE_REQUIRED_LIBRARIES ${GL_LIBRARIES} ) + check_symbol_exists( glXChooseVisual "GL/glx.h" HAVE_GLXCHOOSEVISUAL ) + tde_restore( CMAKE_REQUIRED_LIBRARIES ) + if( NOT HAVE_GLXCHOOSEVISUAL ) + tde_message_fatal( "opengl is requested and found, but it doesn't provides glXChooseVisual() or GL/glx.h" ) + endif( ) + else( ) + tde_message_fatal( "opengl is requested, but not found on your system" ) endif( ) + + if( BUILD_KCONTROL ) + pkg_search_module( GLU glu ) + if( NOT GLU_FOUND ) + tde_message_fatal( "glu is required, but not found on your system" ) + endif( ) + endif( BUILD_KCONTROL ) + endif( ) diff --git a/kcontrol/info/CMakeLists.txt b/kcontrol/info/CMakeLists.txt index fdd30ef2f..58f941e13 100644 --- a/kcontrol/info/CMakeLists.txt +++ b/kcontrol/info/CMakeLists.txt @@ -9,8 +9,6 @@ # ################################################# -# FIXME no OPENGL support yet - include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} @@ -22,20 +20,27 @@ link_directories( ${TQT_LIBRARY_DIRS} ) +if( WITH_OPENGL ) + add_definitions( -DINFO_OPENGL_AVAILABLE ) + set( OPENGL_DESKTOP opengl.desktop ) + set( OPENGL_SOURCES opengl.cpp ) +endif( WITH_OPENGL ) + ##### other data ################################ install( FILES memory.desktop processor.desktop dma.desktop - interrupts.desktop ioports.desktop opengl.desktop - pci.desktop sound.desktop devices.desktop scsi.desktop + interrupts.desktop ioports.desktop pci.desktop + sound.desktop devices.desktop scsi.desktop partitions.desktop xserver.desktop cdinfo.desktop + ${OPENGL_DESKTOP} DESTINATION ${XDG_APPS_INSTALL_DIR} ) ##### kcm_info (module) ######################### tde_add_kpart( kcm_info AUTOMOC - SOURCES main.cpp memory.cpp opengl.cpp - LINK tdeui-shared + SOURCES main.cpp memory.cpp ${OPENGL_SOURCES} + LINK tdeui-shared ${GL_LIBRARIES} ${GLU_LIBRARIES} DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kcontrol/info/opengl.desktop b/kcontrol/info/opengl.desktop index c7cdf29a9..c6ec67758 100644 --- a/kcontrol/info/opengl.desktop +++ b/kcontrol/info/opengl.desktop @@ -1,5 +1,5 @@ [Desktop Entry] -NoDisplay=true +# NoDisplay=true Exec=tdecmshell opengl Icon=kcmopengl Type=Application @@ -8,7 +8,7 @@ DocPath=kinfocenter/opengl/index.html X-TDE-Library=info X-TDE-FactoryName=opengl -X-TDE-ParentApp=kcontrol +X-TDE-ParentApp=kinfocenter Name=OpenGL Name[bn]=ওপেন-জি-এল diff --git a/kcontrol/screensaver/CMakeLists.txt b/kcontrol/screensaver/CMakeLists.txt index e57bc1eca..bb6bd8bf0 100644 --- a/kcontrol/screensaver/CMakeLists.txt +++ b/kcontrol/screensaver/CMakeLists.txt @@ -32,6 +32,6 @@ tde_add_kpart( kcm_screensaver AUTOMOC advanceddialogimpl.ui scrnsave.cpp testwin.cpp saverlist.cpp saverconfig.cpp advanceddialog.cpp kswidget.cpp - LINK tdeio-shared ${GL_LIBRARY} + LINK tdeio-shared ${GL_LIBRARIES} DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kdesktop/lock/CMakeLists.txt b/kdesktop/lock/CMakeLists.txt index 03772be47..256c6a498 100644 --- a/kdesktop/lock/CMakeLists.txt +++ b/kdesktop/lock/CMakeLists.txt @@ -38,6 +38,6 @@ set( ${target}_SRCS tde_add_executable( ${target} AUTOMOC SOURCES ${${target}_SRCS} LINK kdesktopsettings-static dmctl-static tdeio-shared Xext - ${GL_LIBRARY} "${LINKER_IMMEDIATE_BINDING_FLAGS}" + ${GL_LIBRARIES} "${LINKER_IMMEDIATE_BINDING_FLAGS}" DESTINATION ${BIN_INSTALL_DIR} ) diff --git a/tdescreensaver/CMakeLists.txt b/tdescreensaver/CMakeLists.txt index 289ec1661..619166dc5 100644 --- a/tdescreensaver/CMakeLists.txt +++ b/tdescreensaver/CMakeLists.txt @@ -30,7 +30,7 @@ install( FILES KRandom.desktop KBlankscreen.desktop DESTINATION ${APPS_INSTALL_D tde_add_executable( krandom.kss AUTOMOC SOURCES random.cpp - LINK tdeui-shared ${GL_LIBRARY} + LINK tdeui-shared ${GL_LIBRARIES} DESTINATION ${BIN_INSTALL_DIR} ) diff --git a/tdescreensaver/random.cpp b/tdescreensaver/random.cpp index ae2bce601..b7c90db97 100644 --- a/tdescreensaver/random.cpp +++ b/tdescreensaver/random.cpp @@ -92,7 +92,7 @@ bool hasDirectRendering () { return false; } #else -#error no GL? + // no GL return false; #endif