diff options
Diffstat (limited to 'cmake/modules/FindOpenGl.cmake')
| -rw-r--r-- | cmake/modules/FindOpenGl.cmake | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/cmake/modules/FindOpenGl.cmake b/cmake/modules/FindOpenGl.cmake new file mode 100644 index 0000000..b8cff79 --- /dev/null +++ b/cmake/modules/FindOpenGl.cmake | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindOpenGl | ||
| 3 | # ---------- | ||
| 4 | # Finds the FindOpenGl library | ||
| 5 | # | ||
| 6 | # This will will define the following variables:: | ||
| 7 | # | ||
| 8 | # OPENGL_FOUND - system has OpenGl | ||
| 9 | # OPENGL_INCLUDE_DIRS - the OpenGl include directory | ||
| 10 | # OPENGL_LIBRARIES - the OpenGl libraries | ||
| 11 | # OPENGL_DEFINITIONS - the OpenGl definitions | ||
| 12 | |||
| 13 | if(PKG_CONFIG_FOUND) | ||
| 14 | pkg_check_modules(PC_OPENGL gl glu QUIET) | ||
| 15 | endif() | ||
| 16 | |||
| 17 | if(NOT CORE_SYSTEM_NAME STREQUAL osx) | ||
| 18 | find_path(OPENGL_INCLUDE_DIR GL/gl.h | ||
| 19 | PATHS ${PC_OPENGL_gl_INCLUDEDIR}) | ||
| 20 | find_library(OPENGL_gl_LIBRARY NAMES GL | ||
| 21 | PATHS ${PC_OPENGL_gl_LIBDIR}) | ||
| 22 | find_library(OPENGL_glu_LIBRARY NAMES GLU | ||
| 23 | PATHS ${PC_OPENGL_glu_LIBDIR}) | ||
| 24 | else() | ||
| 25 | find_library(OPENGL_gl_LIBRARY NAMES OpenGL | ||
| 26 | PATHS ${CMAKE_OSX_SYSROOT}/System/Library | ||
| 27 | PATH_SUFFIXES Frameworks | ||
| 28 | NO_DEFAULT_PATH) | ||
| 29 | set(OPENGL_INCLUDE_DIR ${OPENGL_gl_LIBRARY}/Headers) | ||
| 30 | set(OPENGL_glu_LIBRARY ${OPENGL_gl_LIBRARY}) | ||
| 31 | endif() | ||
| 32 | |||
| 33 | include(FindPackageHandleStandardArgs) | ||
| 34 | find_package_handle_standard_args(OpenGl | ||
| 35 | REQUIRED_VARS OPENGL_gl_LIBRARY OPENGL_glu_LIBRARY OPENGL_INCLUDE_DIR) | ||
| 36 | |||
| 37 | if(OPENGL_FOUND) | ||
| 38 | set(OPENGL_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR}) | ||
| 39 | set(OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}) | ||
| 40 | set(OPENGL_DEFINITIONS -DHAVE_LIBGL=1) | ||
| 41 | endif() | ||
| 42 | |||
| 43 | mark_as_advanced(OPENGL_INCLUDE_DIR OPENGL_gl_LIBRARY OPENGL_glu_LIBRARY) | ||
