summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt66
-rw-r--r--ConfigureChecks.cmake55
-rw-r--r--config.h.cmake11
-rw-r--r--qtinterface/CMakeLists.txt1
-rw-r--r--qtinterface/interface_qt3/tqgl.cpp6
-rw-r--r--qtinterface/interface_tqt3/tqgl.cpp6
6 files changed, 121 insertions, 24 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b23f4a3..9a2eda8 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,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 )
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 )
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 454c13a..f43fc0b 100644
--- a/qtinterface/CMakeLists.txt
+++ b/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(
diff --git a/qtinterface/interface_qt3/tqgl.cpp b/qtinterface/interface_qt3/tqgl.cpp
index 66f69cc..e165f5c 100644
--- a/qtinterface/interface_qt3/tqgl.cpp
+++ b/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
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