Brian Silverman | 72890c2 | 2015-09-19 14:37:37 -0400 | [diff] [blame^] | 1 | # Copyright (c) 2009 Boudewijn Rempt <boud@valdyas.org> |
| 2 | # |
| 3 | # Redistribution and use is allowed according to the terms of the BSD license. |
| 4 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. |
| 5 | # |
| 6 | # - try to find glew library and include files |
| 7 | # GLEW_INCLUDE_DIR, where to find GL/glew.h, etc. |
| 8 | # GLEW_LIBRARIES, the libraries to link against |
| 9 | # GLEW_FOUND, If false, do not try to use GLEW. |
| 10 | # Also defined, but not for general use are: |
| 11 | # GLEW_GLEW_LIBRARY = the full path to the glew library. |
| 12 | |
| 13 | IF (WIN32) |
| 14 | |
| 15 | IF(CYGWIN) |
| 16 | |
| 17 | FIND_PATH( GLEW_INCLUDE_DIR GL/glew.h) |
| 18 | |
| 19 | FIND_LIBRARY( GLEW_GLEW_LIBRARY glew32 |
| 20 | ${OPENGL_LIBRARY_DIR} |
| 21 | /usr/lib/w32api |
| 22 | /usr/X11R6/lib |
| 23 | ) |
| 24 | |
| 25 | |
| 26 | ELSE(CYGWIN) |
| 27 | |
| 28 | FIND_PATH( GLEW_INCLUDE_DIR GL/glew.h |
| 29 | $ENV{GLEW_ROOT_PATH}/include |
| 30 | ) |
| 31 | |
| 32 | FIND_LIBRARY( GLEW_GLEW_LIBRARY |
| 33 | NAMES glew glew32 |
| 34 | PATHS |
| 35 | $ENV{GLEW_ROOT_PATH}/lib |
| 36 | ${OPENGL_LIBRARY_DIR} |
| 37 | ) |
| 38 | |
| 39 | ENDIF(CYGWIN) |
| 40 | |
| 41 | ELSE (WIN32) |
| 42 | |
| 43 | IF (APPLE) |
| 44 | # These values for Apple could probably do with improvement. |
| 45 | FIND_PATH( GLEW_INCLUDE_DIR glew.h |
| 46 | /System/Library/Frameworks/GLEW.framework/Versions/A/Headers |
| 47 | ${OPENGL_LIBRARY_DIR} |
| 48 | ) |
| 49 | SET(GLEW_GLEW_LIBRARY "-framework GLEW" CACHE STRING "GLEW library for OSX") |
| 50 | SET(GLEW_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX") |
| 51 | ELSE (APPLE) |
| 52 | |
| 53 | FIND_PATH( GLEW_INCLUDE_DIR GL/glew.h |
| 54 | /usr/include/GL |
| 55 | /usr/openwin/share/include |
| 56 | /usr/openwin/include |
| 57 | /usr/X11R6/include |
| 58 | /usr/include/X11 |
| 59 | /opt/graphics/OpenGL/include |
| 60 | /opt/graphics/OpenGL/contrib/libglew |
| 61 | ) |
| 62 | |
| 63 | FIND_LIBRARY( GLEW_GLEW_LIBRARY GLEW |
| 64 | /usr/openwin/lib |
| 65 | /usr/X11R6/lib |
| 66 | ) |
| 67 | |
| 68 | ENDIF (APPLE) |
| 69 | |
| 70 | ENDIF (WIN32) |
| 71 | |
| 72 | SET( GLEW_FOUND "NO" ) |
| 73 | IF(GLEW_INCLUDE_DIR) |
| 74 | IF(GLEW_GLEW_LIBRARY) |
| 75 | # Is -lXi and -lXmu required on all platforms that have it? |
| 76 | # If not, we need some way to figure out what platform we are on. |
| 77 | SET( GLEW_LIBRARIES |
| 78 | ${GLEW_GLEW_LIBRARY} |
| 79 | ${GLEW_cocoa_LIBRARY} |
| 80 | ) |
| 81 | SET( GLEW_FOUND "YES" ) |
| 82 | |
| 83 | #The following deprecated settings are for backwards compatibility with CMake1.4 |
| 84 | SET (GLEW_LIBRARY ${GLEW_LIBRARIES}) |
| 85 | SET (GLEW_INCLUDE_PATH ${GLEW_INCLUDE_DIR}) |
| 86 | |
| 87 | ENDIF(GLEW_GLEW_LIBRARY) |
| 88 | ENDIF(GLEW_INCLUDE_DIR) |
| 89 | |
| 90 | IF(GLEW_FOUND) |
| 91 | IF(NOT GLEW_FIND_QUIETLY) |
| 92 | MESSAGE(STATUS "Found Glew: ${GLEW_LIBRARIES}") |
| 93 | ENDIF(NOT GLEW_FIND_QUIETLY) |
| 94 | ELSE(GLEW_FOUND) |
| 95 | IF(GLEW_FIND_REQUIRED) |
| 96 | MESSAGE(FATAL_ERROR "Could not find Glew") |
| 97 | ENDIF(GLEW_FIND_REQUIRED) |
| 98 | ENDIF(GLEW_FOUND) |
| 99 | |
| 100 | MARK_AS_ADVANCED( |
| 101 | GLEW_INCLUDE_DIR |
| 102 | GLEW_GLEW_LIBRARY |
| 103 | GLEW_Xmu_LIBRARY |
| 104 | GLEW_Xi_LIBRARY |
| 105 | ) |