Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

cmake_modules added

  • Loading branch information...
commit 11249977ead7381ab01995c2a6ca09e8813108a0 1 parent e9a82d5
@progschj authored
Showing with 124 additions and 0 deletions.
  1. +54 −0 cmake_modules/FindGLEW.cmake
  2. +70 −0 cmake_modules/FindGLFW.cmake
View
54 cmake_modules/FindGLEW.cmake
@@ -0,0 +1,54 @@
+#
+# Try to find GLEW library and include path.
+# Once done this will define
+#
+# GLEW_FOUND
+# GLEW_INCLUDE_PATH
+# GLEW_LIBRARY
+#
+
+IF (WIN32)
+ FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h
+ $ENV{PROGRAMFILES}/GLEW/include
+ ${GLEW_ROOT_DIR}/include
+ DOC "The directory where GL/glew.h resides")
+
+ FIND_LIBRARY( GLEW_LIBRARY
+ NAMES glew GLEW glew32 glew32s
+ PATHS
+ $ENV{PROGRAMFILES}/GLEW/lib
+ ${GLEW_ROOT_DIR}/lib
+ ${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin
+ ${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib
+ DOC "The GLEW library")
+ELSE (WIN32)
+ FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h
+ /usr/include
+ /usr/local/include
+ /sw/include
+ /opt/local/include
+ ${GLEW_ROOT_DIR}/include
+ DOC "The directory where GL/glew.h resides")
+
+ # Prefer the static library.
+ FIND_LIBRARY( GLEW_LIBRARY
+ NAMES libGLEW.a GLEW
+ PATHS
+ /usr/lib64
+ /usr/lib
+ /usr/local/lib64
+ /usr/local/lib
+ /sw/lib
+ /opt/local/lib
+ ${GLEW_ROOT_DIR}/lib
+ DOC "The GLEW library")
+ENDIF (WIN32)
+
+SET(GLEW_FOUND "NO")
+IF (GLEW_INCLUDE_PATH AND GLEW_LIBRARY)
+ SET(GLEW_LIBRARIES ${GLEW_LIBRARY})
+ SET(GLEW_FOUND "YES")
+ENDIF (GLEW_INCLUDE_PATH AND GLEW_LIBRARY)
+
+INCLUDE(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLEW DEFAULT_MSG GLEW_LIBRARY)
View
70 cmake_modules/FindGLFW.cmake
@@ -0,0 +1,70 @@
+# Locate the glfw library
+# This module defines the following variables:
+# GLFW_LIBRARY, the name of the library;
+# GLFW_INCLUDE_DIR, where to find glfw include files.
+# GLFW_FOUND, true if both the GLFW_LIBRARY and GLFW_INCLUDE_DIR have been found.
+#
+# To help locate the library and include file, you could define an environment variable called
+# GLFW_ROOT which points to the root of the glfw library installation. This is pretty useful
+# on a Windows platform.
+#
+#
+# Usage example to compile an "executable" target to the glfw library:
+#
+# FIND_PACKAGE (glfw REQUIRED)
+# INCLUDE_DIRECTORIES (${GLFW_INCLUDE_DIR})
+# ADD_EXECUTABLE (executable ${EXECUTABLE_SRCS})
+# TARGET_LINK_LIBRARIES (executable ${GLFW_LIBRARY})
+#
+# TODO:
+# Allow the user to select to link to a shared library or to a static library.
+
+#Search for the include file...
+FIND_PATH(GLFW_INCLUDE_DIR GL/glfw.h DOC "Path to GLFW include directory."
+ HINTS
+ $ENV{GLFW_ROOT}
+ PATH_SUFFIX include
+ PATHS
+ /usr/include/
+ /usr/local/include/
+ # By default headers are under GL subfolder
+ /usr/include/GL
+ /usr/local/include/GL
+ ${GLFW_ROOT_DIR}/include/ # added by ptr
+)
+
+FIND_LIBRARY(GLFW_LIBRARY_TEMP DOC "Absolute path to GLFW library."
+ NAMES glfw GLFW.lib
+ HINTS
+ $ENV{GLFW_ROOT}
+ # In the expanded GLFW source archive. Should be uncommon, but whatever.
+ PATH_SUFFIXES lib/win32 lib/cocoa lib/x11
+ PATHS
+ /usr/local/lib
+ /usr/lib
+ ${GLFW_ROOT_DIR}/lib-msvc100/release # added by ptr
+)
+
+SET(GLFW_FOUND "NO")
+IF(GLFW_LIBRARY_TEMP AND GLFW_INCLUDE_DIR)
+ SET(GLFW_FOUND "YES")
+ message(STATUS "Found GLFW: ${GLFW_LIBRARY_TEMP}")
+
+ # For MinGW library
+ IF(MINGW)
+ SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW")
+ SET(GLFW_LIBRARY_TEMP ${MINGW32_LIBRARY} ${GLFW_LIBRARY_TEMP})
+ ENDIF(MINGW)
+
+ # OS X uses the Cocoa port so we need to link against Cocoa
+ IF(APPLE)
+ SET(GLFW_LIBRARY_TEMP ${GLFW_LIBRARY_TEMP} "-framework Cocoa -framework IOKit")
+ SET(GLFW_LIBRARY ${GLFW_LIBRARY_TEMP})
+ ENDIF(APPLE)
+
+ # Set the final string here so the GUI reflects the final state.
+ SET(GLFW_LIBRARY ${GLFW_LIBRARY_TEMP} CACHE STRING "Where the GLFW Library can be found")
+ # Set the temp variable to INTERNAL so it is not seen in the CMake GUI
+ SET(GLFW_LIBRARY_TEMP "" CACHE INTERNAL "")
+ENDIF(GLFW_LIBRARY_TEMP AND GLFW_INCLUDE_DIR)
+
Please sign in to comment.
Something went wrong with that request. Please try again.