From 47814e50a476ecc0ed42da412fd1a67fbdc69277 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 8 May 2008 12:55:01 +0000 Subject: [PATCH] From Philip Lowman, "Attached is a patch to the toplevel CMakeLists.txt which adds an automated test for OSG_GLU_TESS_CALLBACK_TRIPLEDOT. This should help ease initial configuration on OS X systems." --- CMakeLists.txt | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a570e6b76..141258746 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,26 +98,6 @@ INCLUDE_DIRECTORIES( #ADD_DEFINITIONS(-D) # Platform specific definitions -IF(NOT DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT) - - SET(DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT OFF) - - IF (CMAKE_SYSTEM MATCHES "AIX.*") - SET(DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT ON) - ENDIF(CMAKE_SYSTEM MATCHES "AIX.*") - - IF (APPLE) - SET(DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT ON) - ENDIF(APPLE) - -ENDIF(NOT DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT) - -OPTION(OSG_GLU_TESS_CALLBACK_TRIPLEDOT "Set to ON to build build with (...) version of GLU tesselator callback" ${DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT}) - -IF (OSG_GLU_TESS_CALLBACK_TRIPLEDOT) - ADD_DEFINITIONS(-DGLU_TESS_CALLBACK_TRIPLEDOT) -ENDIF(OSG_GLU_TESS_CALLBACK_TRIPLEDOT) - IF(WIN32) @@ -254,7 +234,31 @@ ELSE(DESIRED_QT_VERSION) ENDIF(DESIRED_QT_VERSION) +# +# Test to determine if we want the "tripledot" form of the GLU tesselator callback. +# +IF(NOT DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT) + INCLUDE(CheckCXXSourceCompiles) + SET(CMAKE_REQUIRED_DEFINITIONS -DGLU_TESS_CALLBACK_TRIPLEDOT) + SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/include ${GLUT_INCLUDE_DIR} ${GL_INCLUDE_DIR}) + SET(CMAKE_REQUIRED_LIBRARIES ${GLUT_LIBRARY} ${GL_LIBRARY}) + CHECK_CXX_SOURCE_COMPILES( + "#include + #include + static void testcb(GLvoid *, void*) { } + int main() + { + GLUtesselator *t = gluNewTess(); + gluTessCallback(t, GLU_TESS_VERTEX_DATA, (GLU_TESS_CALLBACK) testcb); + return 0; + }" + DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT) +ENDIF(NOT DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT) +OPTION(OSG_GLU_TESS_CALLBACK_TRIPLEDOT "Set to ON to build build with (...) version of GLU tesselator callback" ${DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT}) +IF(OSG_GLU_TESS_CALLBACK_TRIPLEDOT) + ADD_DEFINITIONS(-DGLU_TESS_CALLBACK_TRIPLEDOT) +ENDIF(OSG_GLU_TESS_CALLBACK_TRIPLEDOT) # Platform specific: # (We can approach this one of two ways. We can try to FIND everything