summaryrefslogtreecommitdiffstats
path: root/ConfigureChecks.cmake
diff options
context:
space:
mode:
authorgregory guy <[email protected]>2020-04-24 12:18:37 +0200
committerSlávek Banko <[email protected]>2020-04-29 14:28:46 +0200
commitbe0376665a80d0d8f4777bed34c2a39d11fc38ab (patch)
tree727d657b20b5d5fa6fc8a998bcbe500eaf9ccf38 /ConfigureChecks.cmake
parentafc170a48eaeb698810bc133e1514b7c6c8b8c50 (diff)
downloadtqtinterface-be0376665a80d0d8f4777bed34c2a39d11fc38ab.tar.gz
tqtinterface-be0376665a80d0d8f4777bed34c2a39d11fc38ab.zip
Allow tqtinterface to build without OpenGL support.
This should close bug 2645. Some cosmetics here and there. Adapted for r14.0.x branch. Signed-off-by: gregory guy <[email protected]> Signed-off-by: Slávek Banko <[email protected]> (cherry picked from commit db81506ab39530bfee455d14054040b4f43cd945)
Diffstat (limited to 'ConfigureChecks.cmake')
-rw-r--r--ConfigureChecks.cmake55
1 files changed, 55 insertions, 0 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 2f8204f..b603ac1 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -9,6 +9,16 @@
#
#################################################
+##### setup architecture flags ##################
+
+tde_setup_architecture_flags( )
+
+include(TestBigEndian)
+test_big_endian(WORDS_BIGENDIAN)
+
+tde_setup_largefiles( )
+
+
macro( qt_message )
message( STATUS "${ARGN}" )
endmacro( )
@@ -75,8 +85,12 @@ qt_message( " QT_INCLUDE_DIR: ${QT_INCLUDE_DIR}" )
# detect native tqt
if( EXISTS "${QT_INCLUDE_DIR}/ntqglobal.h" )
set( HAVE_REAL_TQT ON CACHE BOOL "Native TQt3 detected" )
+ set( TQGLWIDGET_NAME "TQGLWidget" )
+ set( TQGL_INCLUDE "ntqgl.h" )
qt_message( "Native TQt3 detected" )
else( )
+ set( TQGLWIDGET_NAME "QGLWidget" )
+ set( TQGL_INCLUDE "qgl.h" )
qt_message( "Qt3 detected" )
endif( )
@@ -233,3 +247,44 @@ if( QT_VERSION STREQUAL "3" )
endif( )
tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
+
+
+##### check for OpenGL
+
+execute_process(
+ COMMAND ${PKG_CONFIG_EXECUTABLE} ${QT_LIBRARIES} --variable=qt_config
+ OUTPUT_VARIABLE TQT_CONF_VARS
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+MESSAGE(STATUS "List of qt_config variables: ${TQT_CONF_VARS}")
+
+string( REGEX MATCH " opengl " OPENGL_ENABLED " ${TQT_CONF_VARS} " )
+
+if( OPENGL_ENABLED )
+
+check_include_file( "OpenGL/glu.h" HAVE_GLU_OPENGL )
+check_include_file( "GL/glu.h" HAVE_GLU_GL )
+
+tde_save( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
+set( CMAKE_REQUIRED_INCLUDES ${QT_INCLUDE_DIR} )
+set( CMAKE_REQUIRED_LIBRARIES -L${QT_LIBRARY_DIR} ${QT_LIBRARIES} )
+
+check_cxx_source_compiles("
+#include <cstdlib>
+#include <${TQGL_INCLUDE}>
+int main( int, char** )
+{
+ (void) new ${TQGLWIDGET_NAME}( NULL, \"qgl\" ) ;
+ return EXIT_SUCCESS ;
+}"
+TQGLWIDGET )
+
+tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
+
+if( ( HAVE_GLU_OPENGL OR HAVE_GLU_GL ) AND TQGLWIDGET )
+ set( HAVE_OPENGL 1 )
+ else()
+ tde_message_fatal( "OpenGL has been requested, but neither the OpenGL headers or tqt3 with OpenGL support have been found on your system" )
+endif()
+endif( OPENGL_ENABLED )