Skip to content
Newer
Older
100755 160 lines (130 sloc) 5.01 KB
3d07ac6 @petrm Replaced custom FindSSL.cmake with FindOpenSSL.cmake form cmake distr…
petrm authored May 11, 2010
1 # - Try to find OpenGL
2 # Once done this will define
3 #
4 # OPENGL_FOUND - system has OpenGL
5 # OPENGL_XMESA_FOUND - system has XMESA
6 # OPENGL_GLU_FOUND - system has GLU
7 # OPENGL_INCLUDE_DIR - the GL include directory
8 # OPENGL_LIBRARIES - Link these to use OpenGL and GLU
9 #
10 # If you want to use just GL you can use these values
11 # OPENGL_gl_LIBRARY - Path to OpenGL Library
12 # OPENGL_glu_LIBRARY - Path to GLU Library
13 #
14 # On OSX default to using the framework version of opengl
15 # People will have to change the cache values of OPENGL_glu_LIBRARY
16 # and OPENGL_gl_LIBRARY to use OpenGL with X11 on OSX
17
18 #=============================================================================
19 # Copyright 2001-2009 Kitware, Inc.
20 #
21 # Distributed under the OSI-approved BSD License (the "License");
22 # see accompanying file Copyright.txt for details.
23 #
24 # This software is distributed WITHOUT ANY WARRANTY; without even the
25 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
26 # See the License for more information.
27 #=============================================================================
28 # (To distributed this file outside of CMake, substitute the full
29 # License text for the above reference.)
30
31 IF (WIN32)
32 IF (CYGWIN)
33
34 FIND_PATH(OPENGL_INCLUDE_DIR GL/gl.h )
35
36 FIND_LIBRARY(OPENGL_gl_LIBRARY opengl32 )
37
38 FIND_LIBRARY(OPENGL_glu_LIBRARY glu32 )
39
40 ELSE (CYGWIN)
41
42 IF(BORLAND)
43 SET (OPENGL_gl_LIBRARY import32 CACHE STRING "OpenGL library for win32")
44 SET (OPENGL_glu_LIBRARY import32 CACHE STRING "GLU library for win32")
45 ELSE(BORLAND)
46 SET (OPENGL_gl_LIBRARY opengl32 CACHE STRING "OpenGL library for win32")
47 SET (OPENGL_glu_LIBRARY glu32 CACHE STRING "GLU library for win32")
48 ENDIF(BORLAND)
49
50 ENDIF (CYGWIN)
51
52 ELSE (WIN32)
53
54 IF (APPLE)
55
56 FIND_LIBRARY(OPENGL_gl_LIBRARY OpenGL DOC "OpenGL lib for OSX")
57 FIND_LIBRARY(OPENGL_glu_LIBRARY AGL DOC "AGL lib for OSX")
58 FIND_PATH(OPENGL_INCLUDE_DIR OpenGL/gl.h DOC "Include for OpenGL on OSX")
59
60 ELSE(APPLE)
61 # Handle HP-UX cases where we only want to find OpenGL in either hpux64
62 # or hpux32 depending on if we're doing a 64 bit build.
63 IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
64 SET(HPUX_IA_OPENGL_LIB_PATH /opt/graphics/OpenGL/lib/hpux32/)
65 ELSE(CMAKE_SIZEOF_VOID_P EQUAL 4)
66 SET(HPUX_IA_OPENGL_LIB_PATH
67 /opt/graphics/OpenGL/lib/hpux64/
68 /opt/graphics/OpenGL/lib/pa20_64)
69 ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4)
70
71 # The first line below is to make sure that the proper headers
72 # are used on a Linux machine with the NVidia drivers installed.
73 # They replace Mesa with NVidia's own library but normally do not
74 # install headers and that causes the linking to
75 # fail since the compiler finds the Mesa headers but NVidia's library.
76 # Make sure the NVIDIA directory comes BEFORE the others.
77 # - Atanas Georgiev <atanas@cs.columbia.edu>
78
79 FIND_PATH(OPENGL_INCLUDE_DIR GL/gl.h
80 /usr/share/doc/NVIDIA_GLX-1.0/include
81 /usr/openwin/share/include
82 /opt/graphics/OpenGL/include /usr/X11R6/include
83 )
84
85 FIND_PATH(OPENGL_xmesa_INCLUDE_DIR GL/xmesa.h
86 /usr/share/doc/NVIDIA_GLX-1.0/include
87 /usr/openwin/share/include
88 /opt/graphics/OpenGL/include /usr/X11R6/include
89 )
90
91 FIND_LIBRARY(OPENGL_gl_LIBRARY
92 NAMES GL MesaGL
93 PATHS /opt/graphics/OpenGL/lib
94 /usr/openwin/lib
95 /usr/shlib /usr/X11R6/lib
96 ${HPUX_IA_OPENGL_LIB_PATH}
97 )
98
99 # On Unix OpenGL most certainly always requires X11.
100 # Feel free to tighten up these conditions if you don't
101 # think this is always true.
102 # It's not true on OSX.
103
104 IF (OPENGL_gl_LIBRARY)
105 IF(NOT X11_FOUND)
106 INCLUDE(FindX11)
107 ENDIF(NOT X11_FOUND)
108 IF (X11_FOUND)
109 IF (NOT APPLE)
110 SET (OPENGL_LIBRARIES ${X11_LIBRARIES})
111 ENDIF (NOT APPLE)
112 ENDIF (X11_FOUND)
113 ENDIF (OPENGL_gl_LIBRARY)
114
115 FIND_LIBRARY(OPENGL_glu_LIBRARY
116 NAMES GLU MesaGLU
117 PATHS ${OPENGL_gl_LIBRARY}
118 /opt/graphics/OpenGL/lib
119 /usr/openwin/lib
120 /usr/shlib /usr/X11R6/lib
121 )
122
123 ENDIF(APPLE)
124 ENDIF (WIN32)
125
126 SET( OPENGL_FOUND "NO" )
127 IF(OPENGL_gl_LIBRARY)
128
129 IF(OPENGL_xmesa_INCLUDE_DIR)
130 SET( OPENGL_XMESA_FOUND "YES" )
131 ELSE(OPENGL_xmesa_INCLUDE_DIR)
132 SET( OPENGL_XMESA_FOUND "NO" )
133 ENDIF(OPENGL_xmesa_INCLUDE_DIR)
134
135 SET( OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY} ${OPENGL_LIBRARIES})
136 IF(OPENGL_glu_LIBRARY)
137 SET( OPENGL_GLU_FOUND "YES" )
138 SET( OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY} ${OPENGL_LIBRARIES} )
139 ELSE(OPENGL_glu_LIBRARY)
140 SET( OPENGL_GLU_FOUND "NO" )
141 ENDIF(OPENGL_glu_LIBRARY)
142
143 SET( OPENGL_FOUND "YES" )
144
145 # This deprecated setting is for backward compatibility with CMake1.4
146
147 SET (OPENGL_LIBRARY ${OPENGL_LIBRARIES})
148
149 ENDIF(OPENGL_gl_LIBRARY)
150
151 # This deprecated setting is for backward compatibility with CMake1.4
152 SET(OPENGL_INCLUDE_PATH ${OPENGL_INCLUDE_DIR})
153
154 MARK_AS_ADVANCED(
155 OPENGL_INCLUDE_DIR
156 OPENGL_xmesa_INCLUDE_DIR
157 OPENGL_glu_LIBRARY
158 OPENGL_gl_LIBRARY
159 )
Something went wrong with that request. Please try again.