Revision: 40561
          http://brlcad.svn.sourceforge.net/brlcad/?rev=40561&view=rev
Author:   starseeker
Date:     2010-09-14 16:05:54 +0000 (Tue, 14 Sep 2010)

Log Message:
-----------
Turn on the opengl code - can now pick X11 or Aqua based on X11 being 
enabled/disabled.

Modified Paths:
--------------
    brlcad/branches/cmake/CMakeLists.txt
    brlcad/branches/cmake/TODO.cmake
    brlcad/branches/cmake/misc/CMake/FindGL.cmake
    brlcad/branches/cmake/src/libdm/CMakeLists.txt
    brlcad/branches/cmake/src/libfb/CMakeLists.txt
    brlcad/branches/cmake/src/libtclcad/CMakeLists.txt
    brlcad/branches/cmake/src/mged/CMakeLists.txt

Modified: brlcad/branches/cmake/CMakeLists.txt
===================================================================
--- brlcad/branches/cmake/CMakeLists.txt        2010-09-14 16:04:44 UTC (rev 
40560)
+++ brlcad/branches/cmake/CMakeLists.txt        2010-09-14 16:05:54 UTC (rev 
40561)
@@ -417,10 +417,21 @@
        INCLUDE(${BRLCAD_CMAKE_DIR}/FindX11.cmake)
 endif (BRLCAD-ENABLE_X11)
 
-OPTION(BRLCAD-ENABLE_OPENGL "Use OpenGL." OFF)
+OPTION(BRLCAD-ENABLE_OPENGL "Use OpenGL." ON)
+if(APPLE)
+       if(BRLCAD-ENABLE_X11)
+               SET(OPENGL_USE_AQUA OFF CACHE STRING "Don't use Aqua OpenGL if 
we're doing X11")
+       endif(BRLCAD-ENABLE_X11)
+endif(APPLE)
 if (BRLCAD-ENABLE_OPENGL)
        INCLUDE(${BRLCAD_CMAKE_DIR}/FindGL.cmake)
 endif (BRLCAD-ENABLE_OPENGL)
+if (OPENGL_INCLUDE_DIR_GL)
+       FILE(APPEND  ${CONFIG_H_FILE} "#define HAVE_GL_GL_H 1\n")
+endif (OPENGL_INCLUDE_DIR_GL)
+if (OPENGL_INCLUDE_DIR_GLX)
+       FILE(APPEND  ${CONFIG_H_FILE} "#define HAVE_GL_GLX_H 1\n")
+endif (OPENGL_INCLUDE_DIR_GLX)
 
 OPTION(BRLCAD-BUILD_EXTRADOCS "Build Docbook documentation" ON)
 OPTION(BRLCAD-BUILD_EXTRADOCS_PDF "Build PDF output from Docbook 
documentation" OFF)

Modified: brlcad/branches/cmake/TODO.cmake
===================================================================
--- brlcad/branches/cmake/TODO.cmake    2010-09-14 16:04:44 UTC (rev 40560)
+++ brlcad/branches/cmake/TODO.cmake    2010-09-14 16:05:54 UTC (rev 40561)
@@ -1,7 +1,5 @@
 Remaining items:
 
-1.  Detect OpenGL properly on Apple - choose X11 vs Aqua, and get the ogl code 
working
-
 2.  Do a diff of all the generated scripts using configure_file - make sure 
what autotools produces 
         is what is being produced by CMake, and make sure no variable 
definitions in support of scripts 
         are nuking variables used by CMake
@@ -23,6 +21,8 @@
 
 Done (to first order, all this needs testing)
 
+1.  Detect OpenGL properly on Apple - choose X11 vs Aqua, and get the ogl code 
working
+
 4.  Scrub the third party logic and clean up/simplify - try to get away from 
using BRLCAD_ variables
     when they aren't needed.
 

Modified: brlcad/branches/cmake/misc/CMake/FindGL.cmake
===================================================================
--- brlcad/branches/cmake/misc/CMake/FindGL.cmake       2010-09-14 16:04:44 UTC 
(rev 40560)
+++ brlcad/branches/cmake/misc/CMake/FindGL.cmake       2010-09-14 16:05:54 UTC 
(rev 40561)
@@ -1,126 +1,164 @@
-########################################################################
-#
-# Copyright (c) 2008, Lawrence Livermore National Security, LLC.  
-# Produced at the Lawrence Livermore National Laboratory  
-# Written by [email protected],[email protected].  
-# LLNL-CODE-406031.  
-# All rights reserved.  
+# - Try to find OpenGL
+# Once done this will define
+#  
+#  OPENGL_FOUND            - system has OpenGL
+#  OPENGL_XMESA_FOUND      - system has XMESA
+#  OPENGL_GLU_FOUND        - system has GLU
+#  OPENGL_INCLUDE_DIR_GL   - the GL include directory
+#  OPENGL_INCLUDE_DIR_GLX  - the GLX include directory
+#  OPENGL_LIBRARIES        - Link these to use OpenGL and GLU
 #   
-# This file is part of "Simple and Flexible Scene Graph Version 2.0."
-# Please also read BSD_ADDITIONAL.txt.
-#   
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#   
-# @ Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the disclaimer below.
-# @ Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the disclaimer (as noted below) in
-#   the documentation and/or other materials provided with the
-#   distribution.
-# @ Neither the name of the LLNS/LLNL nor the names of its contributors
-#   may be used to endorse or promote products derived from this software
-#   without specific prior written permission.
-#   
-#  
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL LAWRENCE
-# LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING
+# If you want to use just GL you can use these values
+#  OPENGL_gl_LIBRARY   - Path to OpenGL Library
+#  OPENGL_glu_LIBRARY  - Path to GLU Library
 #
-########################################################################
+# Define controlling option OPENGL_USE_AQUA if on Apple - 
+# if this is not true, look for the X11 OpenGL.  Defaults
+# to true.
+
+#=============================================================================
+# Copyright 2001-2009 Kitware, Inc.
 #
-# BSD_ADDITIONAL.txt
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
 #
-# 1. This notice is required to be provided under our contract with the
-# U.S.  Department of Energy (DOE).  This work was produced at Lawrence
-# Livermore National Laboratory under Contract No. DE-AC52-07NA27344
-# with the DOE.
-#  
-# 2. Neither the United States Government nor Lawrence Livermore
-# National Security, LLC nor any of their employees, makes any warranty,
-# express or implied, or assumes any liability or responsibility for the
-# accuracy, completeness, or usefulness of any information, apparatus,
-# product, or process disclosed, or represents that its use would not
-# infringe privately-owned rights.
-#    
-# 3.  Also, reference herein to any specific commercial products,
-# process, or services by trade name, trademark, manufacturer or
-# otherwise does not necessarily constitute or imply its endorsement,
-# recommendation, or favoring by the United States Government or
-# Lawrence Livermore National Security, LLC.  The views and opinions of
-# authors expressed herein do not necessarily state or reflect those of
-# the United States Government or Lawrence Livermore National Security,
-# LLC, and shall not be used for advertising or product endorsement
-# purposes.
-# 
- 
-INCLUDE(${CMAKE_ROOT}/Modules/FindOpenGL.cmake)
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distributed this file outside of CMake, substitute the full
+#  License text for the above reference.)
 
-IF (APPLE_NATIVE_GL)
+IF (WIN32)
+       IF (CYGWIN)
 
-   FIND_PATH(AGL_INCLUDE_DIR agl.h
-      /System/Library/Frameworks/AGL.framework/Headers
-      NO_DEFAULT_PATH)
-      
+               FIND_PATH(OPENGL_INCLUDE_DIR_GL GL/gl.h )
 
-ELSE (APPLE_NATIVE_GL)
+               FIND_LIBRARY(OPENGL_gl_LIBRARY opengl32 )
 
-   # If we are supposed to use the standard OpenGL we first check
-   # whetherwe got the correct path (the one containing the GL/
-   # prefix)
+               FIND_LIBRARY(OPENGL_glu_LIBRARY glu32 )
 
-   IF (NOT EXISTS ${OPENGL_INCLUDE_DIR}/GL/gl.h)
-      SET(OPENGL_INCLUDE_DIR OPENGL_INCLUDE_DIR-NOTFOUND)
-      FIND_PATH(OPENGL_INCLUDE_DIR GL/gl.h
-         /usr/
-         /usr/X11R6/
-         PATH_SUFFIXES /include 
-      ) 
-   ENDIF (NOT EXISTS ${OPENGL_INCLUDE_DIR}/GL/gl.h)
+       ELSE (CYGWIN)
 
-   # IF we are on apple but are not using the native OpenGl we must
-   # search for the X version of the libraries since the first find
-   # command has likely returned the Frameworks instead
+               IF(BORLAND)
+                       SET (OPENGL_gl_LIBRARY import32 CACHE STRING "OpenGL 
library for win32")
+                       SET (OPENGL_glu_LIBRARY import32 CACHE STRING "GLU 
library for win32")
+               ELSE(BORLAND)
+                       SET (OPENGL_gl_LIBRARY opengl32 CACHE STRING "OpenGL 
library for win32")
+                       SET (OPENGL_glu_LIBRARY glu32 CACHE STRING "GLU library 
for win32")
+               ENDIF(BORLAND)
 
-   IF (APPLE)
-      SET(OPENGL_glu_LIBRARY OPENGL_glu_LIBRARY-NOTFOUND) 
-      FIND_LIBRARY(OPENGL_glu_LIBRARY glu
-         /usr
-         /usr/X11
-         /usr/X11R6
-         PATH_SUFFIXES /lib        
-      ) 
-   
-      SET(OPENGL_gl_LIBRARY OPENGL_gl_LIBRARY-NOTFOUND) 
-      FIND_LIBRARY(OPENGL_gl_LIBRARY gl
-         /usr
-         /usr/X11
-         /usr/X11R6
-         PATH_SUFFIXES /lib        
-      )   
-   
-      SET(OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY} ${OPENGL_gl_LIBRARY})
-   ENDIF (APPLE)
-ENDIF (APPLE_NATIVE_GL)
-     
-# Now do a last check whether we found everything we needed
-   
-IF (OPENGL_INCLUDE_DIR AND OPENGL_LIBRARIES)   
+       ENDIF (CYGWIN)
 
-   IF (CMAKE_VERBOSE_MAKEFILE)
-      MESSAGE("Using OPENGL_INCLUDE_DIR = " ${OPENGL_INCLUDE_DIR})
-      MESSAGE("Using OPENGL_LIBRARIES = " ${OPENGL_LIBRARIES})        
-   ENDIF (CMAKE_VERBOSE_MAKEFILE)
- 
-ELSE (OPENGL_INCLUDE_DIR AND OPENGL_LIBRARIES)   
-   SET(OPENGL_FOUND "NO") 
-ENDIF (OPENGL_INCLUDE_DIR AND OPENGL_LIBRARIES)   
+ELSE (WIN32)
+
+       IF (APPLE)
+               OPTION(OPENGL_USE_AQUA "Require native OSX Framework version of 
OpenGL." ON)
+       ENDIF(APPLE)
+
+       IF(OPENGL_USE_AQUA)
+               FIND_LIBRARY(OPENGL_gl_LIBRARY OpenGL DOC "OpenGL lib for OSX")
+               FIND_LIBRARY(OPENGL_glu_LIBRARY AGL DOC "AGL lib for OSX")
+               FIND_PATH(OPENGL_INCLUDE_DIR_GL OpenGL/gl.h DOC "Include for 
OpenGL on OSX")
+       ELSE(OPENGL_USE_AQUA)
+               # Handle HP-UX cases where we only want to find OpenGL in 
either hpux64
+               # or hpux32 depending on if we're doing a 64 bit build.
+               IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
+                       SET(HPUX_IA_OPENGL_LIB_PATH 
/opt/graphics/OpenGL/lib/hpux32/)
+               ELSE(CMAKE_SIZEOF_VOID_P EQUAL 4)
+                       SET(HPUX_IA_OPENGL_LIB_PATH 
+                               /opt/graphics/OpenGL/lib/hpux64/
+                               /opt/graphics/OpenGL/lib/pa20_64)
+               ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4)
+
+               # The first line below is to make sure that the proper headers
+               # are used on a Linux machine with the NVidia drivers installed.
+               # They replace Mesa with NVidia's own library but normally do 
not
+               # install headers and that causes the linking to
+               # fail since the compiler finds the Mesa headers but NVidia's 
library.
+               # Make sure the NVIDIA directory comes BEFORE the others.
+               #  - Atanas Georgiev <[email protected]>
+
+               FIND_PATH(OPENGL_INCLUDE_DIR_GL GL/gl.h
+                       /usr/share/doc/NVIDIA_GLX-1.0/include
+                       /usr/openwin/share/include
+                       /opt/graphics/OpenGL/include /usr/X11R6/include
+                       )
+
+               FIND_PATH(OPENGL_INCLUDE_DIR_GLX GL/glx.h
+                       /usr/share/doc/NVIDIA_GLX-1.0/include
+                       /usr/openwin/share/include
+                       /opt/graphics/OpenGL/include /usr/X11R6/include
+                       )
+
+               FIND_PATH(OPENGL_xmesa_INCLUDE_DIR GL/xmesa.h
+                       /usr/share/doc/NVIDIA_GLX-1.0/include
+                       /usr/openwin/share/include
+                       /opt/graphics/OpenGL/include /usr/X11R6/include
+                       )
+
+               FIND_LIBRARY(OPENGL_gl_LIBRARY
+                       NAMES GL MesaGL
+                       PATHS /opt/graphics/OpenGL/lib
+                       /usr/openwin/lib
+                       /usr/shlib /usr/X11R6/lib
+                       ${HPUX_IA_OPENGL_LIB_PATH}
+                       )
+
+               # On Unix OpenGL most certainly always requires X11.
+               # Feel free to tighten up these conditions if you don't 
+               # think this is always true.
+               # It's not true on OSX.
+
+               IF (OPENGL_gl_LIBRARY)
+                       IF(NOT X11_FOUND)
+                               INCLUDE(FindX11)
+                       ENDIF(NOT X11_FOUND)
+                       IF (X11_FOUND)
+                               SET (OPENGL_LIBRARIES ${X11_LIBRARIES})
+                       ENDIF (X11_FOUND)
+               ENDIF (OPENGL_gl_LIBRARY)
+
+               FIND_LIBRARY(OPENGL_glu_LIBRARY
+                       NAMES GLU MesaGLU
+                       PATHS ${OPENGL_gl_LIBRARY}
+                       /opt/graphics/OpenGL/lib
+                       /usr/openwin/lib
+                       /usr/shlib /usr/X11R6/lib
+                       )
+       ENDIF(OPENGL_USE_AQUA)
+
+ENDIF (WIN32)
+
+SET( OPENGL_FOUND "NO" )
+IF(OPENGL_gl_LIBRARY)
+
+       IF(OPENGL_xmesa_INCLUDE_DIR)
+               SET( OPENGL_XMESA_FOUND "YES" )
+       ELSE(OPENGL_xmesa_INCLUDE_DIR)
+               SET( OPENGL_XMESA_FOUND "NO" )
+       ENDIF(OPENGL_xmesa_INCLUDE_DIR)
+
+       SET( OPENGL_LIBRARIES  ${OPENGL_gl_LIBRARY} ${OPENGL_LIBRARIES})
+       IF(OPENGL_glu_LIBRARY)
+               SET( OPENGL_GLU_FOUND "YES" )
+               SET( OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY} ${OPENGL_LIBRARIES} 
)
+       ELSE(OPENGL_glu_LIBRARY)
+               SET( OPENGL_GLU_FOUND "NO" )
+       ENDIF(OPENGL_glu_LIBRARY)
+
+       SET( OPENGL_FOUND "YES" )
+
+       # This deprecated setting is for backward compatibility with CMake1.4
+
+       SET (OPENGL_LIBRARY ${OPENGL_LIBRARIES})
+
+ENDIF(OPENGL_gl_LIBRARY)
+
+MARK_AS_ADVANCED(
+       OPENGL_INCLUDE_DIR_GL
+       OPENGL_INCLUDE_DIR_GLX
+       OPENGL_xmesa_INCLUDE_DIR
+       OPENGL_glu_LIBRARY
+       OPENGL_gl_LIBRARY
+       )

Modified: brlcad/branches/cmake/src/libdm/CMakeLists.txt
===================================================================
--- brlcad/branches/cmake/src/libdm/CMakeLists.txt      2010-09-14 16:04:44 UTC 
(rev 40560)
+++ brlcad/branches/cmake/src/libdm/CMakeLists.txt      2010-09-14 16:05:54 UTC 
(rev 40561)
@@ -51,6 +51,8 @@
        ${TERMLIB_INCLUDE_DIR}
        ${PNG_INCLUDE_DIR}
        ${X11_INCLUDE_DIR}
+       ${OPENGL_INCLUDE_DIR_GL}
+       ${OPENGL_INCLUDE_DIR_GLX}
        ${TCL_INCLUDE_PATH}
        ${TK_INCLUDE_PATH}
 )

Modified: brlcad/branches/cmake/src/libfb/CMakeLists.txt
===================================================================
--- brlcad/branches/cmake/src/libfb/CMakeLists.txt      2010-09-14 16:04:44 UTC 
(rev 40560)
+++ brlcad/branches/cmake/src/libfb/CMakeLists.txt      2010-09-14 16:05:54 UTC 
(rev 40561)
@@ -5,14 +5,12 @@
        FOREACH(xlib ${X11_LIBRARIES})
           SET(LINKLIBS "${LINKLIBS} ${xlib}")
        ENDFOREACH(xlib ${X11_LIBRARIES})
-   SET(INCLUDEDIRS "${INCLUDEDIRS} ${X11_INCLUDE_DIR}")
 endif()
 if(BRLCAD-ENABLE_OPENGL AND OPENGL_FOUND)
    SET(FBOGLDEFS "-DIF_OGL")
        FOREACH(ogllib ${OPENGL_LIBRARIES})
           SET(LINKLIBS "${LINKLIBS} ${ogllib}")
        ENDFOREACH(ogllib ${OPENGL_LIBRARIES})
-   SET(INCLUDEDIRS "${INCLUDEDIRS} ${OPENGL_INCLUDE_DIR}")
 endif()
 
 set(LIBFB_SOURCES
@@ -40,10 +38,12 @@
 )
 
 include_directories(
-    ${INCLUDEDIRS}
-    ${TCL_INCLUDE_PATH}
-    ${TK_INCLUDE_PATH}
-)
+       ${X11_INCLUDE_DIR}
+       ${OPENGL_INCLUDE_DIR_GL}
+       ${OPENGL_INCLUDE_DIR_GLX}
+       ${TCL_INCLUDE_PATH}
+       ${TK_INCLUDE_PATH}
+       )
 
 add_definitions(
        -DIF_REMOTE

Modified: brlcad/branches/cmake/src/libtclcad/CMakeLists.txt
===================================================================
--- brlcad/branches/cmake/src/libtclcad/CMakeLists.txt  2010-09-14 16:04:44 UTC 
(rev 40560)
+++ brlcad/branches/cmake/src/libtclcad/CMakeLists.txt  2010-09-14 16:05:54 UTC 
(rev 40561)
@@ -17,6 +17,8 @@
 include_directories(
   ${PNG_INCLUDE_DIR}
   ${X11_INCLUDE_DIR}
+  ${OPENGL_INCLUDE_DIR_GL}
+  ${OPENGL_INCLUDE_DIR_GLX}
   ${TCL_INCLUDE_PATH}
   ${TK_INCLUDE_PATH}
 )

Modified: brlcad/branches/cmake/src/mged/CMakeLists.txt
===================================================================
--- brlcad/branches/cmake/src/mged/CMakeLists.txt       2010-09-14 16:04:44 UTC 
(rev 40560)
+++ brlcad/branches/cmake/src/mged/CMakeLists.txt       2010-09-14 16:05:54 UTC 
(rev 40561)
@@ -6,6 +6,8 @@
   ${TERMLIB_INCLUDE_DIR}
   ${PNG_INCLUDE_DIR}
   ${X11_INCLUDE_DIR}
+  ${OPENGL_INCLUDE_DIR_GL}
+  ${OPENGL_INCLUDE_DIR_GLX}
   ${TCL_INCLUDE_PATH}
   ${TK_INCLUDE_PATH}
 )


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to