summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgregory guy <gregory-tde@laposte.net>2020-04-24 12:18:37 +0200
committerSlávek Banko <slavek.banko@axis.cz>2020-04-27 02:45:51 +0200
commit5cdb5457400812f7d9d2a92c6ee4922c4af627c7 (patch)
tree118841fa26d59800eeb57e71b12f10551a925888
parente43a3c98104250fe06959b5352d17bff6e611bfb (diff)
downloadtqtinterface-5cdb5457400812f7d9d2a92c6ee4922c4af627c7.tar.gz
tqtinterface-5cdb5457400812f7d9d2a92c6ee4922c4af627c7.zip
Allow tqtinterface to build without OpenGL support.
This should close bug 2645. Some cosmetics here and there. Signed-off-by: gregory guy <gregory-tde@laposte.net> Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
-rw-r--r--CMakeLists.txt80
-rw-r--r--ConfigureChecks.cmake55
-rw-r--r--config.h.cmake11
-rw-r--r--qtinterface/CMakeLists.txt1
-rw-r--r--qtinterface/interface_tqt3/tqgl.cpp6
5 files changed, 122 insertions, 31 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3af09da..a3d0722 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,13 +1,18 @@
-#################################################
-#
-# (C) 2010-2011 Serghei Amelian
-# serghei (DOT) amelian (AT) gmail.com
-#
-# Improvements and feedback are welcome
-#
-# This file is released under GPL >= 2
-#
-#################################################
+###########################################
+# #
+# (C) 2010-2011 Serghei Amelian #
+# serghei (DOT) amelian (AT) gmail.com #
+# #
+# Improvements and feedback are welcome #
+# #
+# This file is released under GPL >= 2 #
+# #
+###########################################
+
+cmake_minimum_required( VERSION 2.8 )
+
+
+#### general package setup
project( tqt )
@@ -17,48 +22,69 @@ set( TQT_MICRO_VERSION 0 )
set( TQT_VERSION "${TQT_MAJOR_VERSION}.${TQT_MINOR_VERSION}.${TQT_MICRO_VERSION}" )
-##### cmake setup ###############################
-
-cmake_minimum_required( VERSION 2.8 )
+#### include essential cmake modules
+include( FindPkgConfig )
+include( CheckFunctionExists )
+include( CheckSymbolExists )
+include( CheckIncludeFile )
+include( CheckLibraryExists )
+include( CheckCSourceCompiles )
include( CheckCXXSourceCompiles )
+
include( GNUInstallDirs OPTIONAL )
-##### include our cmake modules #################
+##### include our cmake modules
set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" )
include( TDEMacros )
-##### install paths setup #######################
+##### install paths setup
+
+tde_setup_install_path( EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" )
+tde_setup_install_path( BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" )
-tde_setup_install_path( EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" )
-tde_setup_install_path( BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" )
if( CMAKE_INSTALL_LIBDIR )
- tde_setup_install_path( LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" )
-else( )
- tde_setup_install_path( LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" )
-endif( )
+ tde_setup_install_path( LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" )
+ else()
+ tde_setup_install_path( LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" )
+endif()
+
tde_setup_install_path( INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include/tqt" )
tde_setup_install_path( PKGCONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/pkgconfig" )
-##### optional stuff ############################
+##### optional stuff
option( WITH_ALL_OPTIONS "Enable all optional support" OFF )
-##### user requested modules ####################
+##### configure checks
-option( BUILD_ALL "Build all" OFF )
+include( ConfigureChecks.cmake )
-##### configure checks ##########################
+###### global compiler settings
-include( ConfigureChecks.cmake )
+add_definitions( -DHAVE_CONFIG_H )
+
+set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" )
+set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )
+set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined" )
+
+
+# tqt.pc and tqtqui.pc definitions
+set( QT_DEFINITIONS "-DTQT_NO_ASCII_CAST -DTQT_NO_STL -DTQT_NO_COMPAT -DTQT_NO_TRANSLATION -DTQT_THREAD_SUPPORT -D_REENTRANT" )
-##### tqtinterface sources ######################
+
+##### directories
add_subdirectory( qtinterface )
+
+
+##### write configure files
+
+configure_file( config.h.cmake config.h @ONLY )
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 8cf8d08..f76d691 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( )
@@ -109,10 +119,6 @@ endif( )
qt_message( " UIC_EXECUTABLE: ${UIC_EXECUTABLE}" )
-# definitions
-set( QT_DEFINITIONS "-DTQT_NO_ASCII_CAST -DTQT_NO_STL -DTQT_NO_COMPAT -DTQT_NO_TRANSLATION -DTQT_THREAD_SUPPORT -D_REENTRANT" )
-
-
tde_save( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
set( CMAKE_REQUIRED_INCLUDES ${TQT_INCLUDE_DIR} )
set( CMAKE_REQUIRED_LIBRARIES -L${TQT_LIBRARY_DIR} ${TQT_LIBRARIES} )
@@ -162,3 +168,44 @@ if( NOT HAVE_PATCHED_QT3 )
endif( )
tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
+
+
+##### check for OpenGL
+
+execute_process(
+ COMMAND ${PKG_CONFIG_EXECUTABLE} ${TQT_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 ${TQT_INCLUDE_DIR} )
+set( CMAKE_REQUIRED_LIBRARIES -L${TQT_LIBRARY_DIR} ${TQT_LIBRARIES} )
+
+check_cxx_source_compiles("
+#include <cstdlib>
+#include <ntqgl.h>
+int main( int, char** )
+{
+ (void) new TQGLWidget( (TQWidget*)0, \"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 )
diff --git a/config.h.cmake b/config.h.cmake
new file mode 100644
index 0000000..558e25c
--- /dev/null
+++ b/config.h.cmake
@@ -0,0 +1,11 @@
+#define VERSION "@TQT_VERSION@"
+
+// Defined if you have fvisibility and fvisibility-inlines-hidden support.
+#cmakedefine __KDE_HAVE_GCC_VISIBILITY 1
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+ significant byte first (like Motorola and SPARC, unlike Intel). */
+#cmakedefine WORDS_BIGENDIAN @WORDS_BIGENDIAN@
+
+/* Defined if you build with OpenGL */
+#cmakedefine HAVE_OPENGL 1
diff --git a/qtinterface/CMakeLists.txt b/qtinterface/CMakeLists.txt
index 480760b..848921c 100644
--- a/qtinterface/CMakeLists.txt
+++ b/qtinterface/CMakeLists.txt
@@ -20,6 +20,7 @@ include_directories(
${TQT_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/${IFACE}
${CMAKE_CURRENT_SOURCE_DIR}/${IFACE}/private
+ ${CMAKE_BINARY_DIR}
)
link_directories(
diff --git a/qtinterface/interface_tqt3/tqgl.cpp b/qtinterface/interface_tqt3/tqgl.cpp
index 33c8bb6..3ec7177 100644
--- a/qtinterface/interface_tqt3/tqgl.cpp
+++ b/qtinterface/interface_tqt3/tqgl.cpp
@@ -18,6 +18,12 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <tqt.h>
+
+#ifdef HAVE_OPENGL
#include <ntqgl.h>
+#endif