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>
pull/3/head
gregory guy 4 years ago committed by Slávek Banko
parent e43a3c9810
commit 5cdb545740
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

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

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

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

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

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