Browse Source

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 <gregory-tde@laposte.net>
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit db81506ab3)
r14.0.x
gregory guy 2 years ago committed by Slávek Banko
parent
commit
be0376665a
Signed by: SlavekB
GPG Key ID: 608F5293A04BE668
  1. 66
      CMakeLists.txt
  2. 55
      ConfigureChecks.cmake
  3. 11
      config.h.cmake
  4. 1
      qtinterface/CMakeLists.txt
  5. 6
      qtinterface/interface_qt3/tqgl.cpp
  6. 6
      qtinterface/interface_tqt3/tqgl.cpp

66
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,46 +22,59 @@ 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 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( LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" )
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( LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" )
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 )
option( WITH_QT3 "Build TQt interface based on TQt3" ${WITH_ALL_OPTIONS} )
option( WITH_QT4 "Build TQt interface based on Qt4" OFF )
##### configure checks
##### user requested modules ####################
include( ConfigureChecks.cmake )
option( BUILD_ALL "Build all" OFF )
###### global compiler settings
##### configure checks ##########################
add_definitions( -DHAVE_CONFIG_H )
include( ConfigureChecks.cmake )
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" )
##### tqtinterface sources ######################
##### directories
add_subdirectory( qtinterface )
##### write configure files
configure_file( config.h.cmake config.h @ONLY )

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

11
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

1
qtinterface/CMakeLists.txt

@ -24,6 +24,7 @@ include_directories(
${QT_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/${IFACE}
${CMAKE_CURRENT_SOURCE_DIR}/${IFACE}/private
${CMAKE_BINARY_DIR}
)
link_directories(

6
qtinterface/interface_qt3/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 <tqgl.h>
#endif

6
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

Loading…
Cancel
Save