2012-06-09 00:06:35 +00:00
|
|
|
#
|
2013-09-26 19:04:57 +00:00
|
|
|
# Copyright 2013 Pixar
|
2012-06-09 00:06:35 +00:00
|
|
|
#
|
2013-09-26 19:04:57 +00:00
|
|
|
# Licensed under the Apache License, Version 2.0 (the "Apache License")
|
|
|
|
# with the following modification; you may not use this file except in
|
|
|
|
# compliance with the Apache License and the following modification to it:
|
|
|
|
# Section 6. Trademarks. is deleted and replaced with:
|
2012-06-09 00:06:35 +00:00
|
|
|
#
|
2013-09-26 19:04:57 +00:00
|
|
|
# 6. Trademarks. This License does not grant permission to use the trade
|
|
|
|
# names, trademarks, service marks, or product names of the Licensor
|
|
|
|
# and its affiliates, except as required to comply with Section 4(c) of
|
|
|
|
# the License and to reproduce the content of the NOTICE file.
|
2012-06-09 00:06:35 +00:00
|
|
|
#
|
2013-09-26 19:04:57 +00:00
|
|
|
# You may obtain a copy of the Apache License at
|
2012-06-09 00:06:35 +00:00
|
|
|
#
|
2013-09-26 19:04:57 +00:00
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
2012-06-09 00:06:35 +00:00
|
|
|
#
|
2013-09-26 19:04:57 +00:00
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the Apache License with the above modification is
|
|
|
|
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
# KIND, either express or implied. See the Apache License for the specific
|
|
|
|
# language governing permissions and limitations under the Apache License.
|
2012-06-09 00:06:35 +00:00
|
|
|
#
|
|
|
|
|
2013-01-29 23:54:18 +00:00
|
|
|
# Try to find GLFW library and include path.
|
2012-06-09 00:06:35 +00:00
|
|
|
# Once done this will define
|
|
|
|
#
|
2013-01-29 23:54:18 +00:00
|
|
|
# GLFW_FOUND
|
|
|
|
# GLFW_INCLUDE_DIR
|
|
|
|
# GLFW_LIBRARIES
|
2012-08-04 02:51:27 +00:00
|
|
|
#
|
2012-06-09 00:06:35 +00:00
|
|
|
|
2013-01-31 23:34:35 +00:00
|
|
|
find_path( GLFW_INCLUDE_DIR
|
|
|
|
NAMES
|
2013-06-20 18:53:33 +00:00
|
|
|
GLFW/glfw3.h
|
2015-02-10 21:13:39 +00:00
|
|
|
HINTS
|
2014-04-09 20:43:38 +00:00
|
|
|
"${GLFW_LOCATION}/include"
|
|
|
|
"$ENV{GLFW_LOCATION}/include"
|
2015-02-10 21:13:39 +00:00
|
|
|
PATHS
|
2014-04-09 20:43:38 +00:00
|
|
|
"$ENV{PROGRAMFILES}/GLFW/include"
|
|
|
|
"${OPENGL_INCLUDE_DIR}"
|
2013-01-31 23:34:35 +00:00
|
|
|
/usr/openwin/share/include
|
|
|
|
/usr/openwin/include
|
|
|
|
/usr/X11R6/include
|
|
|
|
/usr/include/X11
|
|
|
|
/opt/graphics/OpenGL/include
|
|
|
|
/opt/graphics/OpenGL/contrib/libglfw
|
|
|
|
/usr/local/include
|
|
|
|
/usr/include/GL
|
|
|
|
/usr/include
|
2015-04-19 04:28:07 +00:00
|
|
|
DOC
|
|
|
|
"The directory where GLFW/glfw3.h resides"
|
|
|
|
)
|
|
|
|
|
|
|
|
#
|
|
|
|
# XXX: Do we still need to search for GL/glfw.h?
|
|
|
|
#
|
|
|
|
find_path( GLFW_INCLUDE_DIR
|
|
|
|
NAMES
|
|
|
|
GL/glfw.h
|
|
|
|
HINTS
|
|
|
|
"${GLFW_LOCATION}/include"
|
|
|
|
"$ENV{GLFW_LOCATION}/include"
|
|
|
|
PATHS
|
|
|
|
"$ENV{PROGRAMFILES}/GLFW/include"
|
|
|
|
"${OPENGL_INCLUDE_DIR}"
|
|
|
|
/usr/openwin/share/include
|
|
|
|
/usr/openwin/include
|
|
|
|
/usr/X11R6/include
|
|
|
|
/usr/include/X11
|
|
|
|
/opt/graphics/OpenGL/include
|
|
|
|
/opt/graphics/OpenGL/contrib/libglfw
|
|
|
|
/usr/local/include
|
|
|
|
/usr/include/GL
|
|
|
|
/usr/include
|
2013-01-31 23:34:35 +00:00
|
|
|
DOC
|
|
|
|
"The directory where GL/glfw.h resides"
|
|
|
|
)
|
|
|
|
|
2012-06-14 02:08:03 +00:00
|
|
|
if (WIN32)
|
|
|
|
if(CYGWIN)
|
2013-01-31 23:34:35 +00:00
|
|
|
find_library( GLFW_glfw_LIBRARY
|
|
|
|
NAMES
|
|
|
|
glfw32
|
2015-02-10 21:13:39 +00:00
|
|
|
HINTS
|
2014-04-09 20:43:38 +00:00
|
|
|
"${GLFW_LOCATION}/lib"
|
|
|
|
"${GLFW_LOCATION}/lib/x64"
|
|
|
|
"$ENV{GLFW_LOCATION}/lib"
|
2015-02-10 21:13:39 +00:00
|
|
|
PATHS
|
2014-04-09 20:43:38 +00:00
|
|
|
"${OPENGL_LIBRARY_DIR}"
|
2013-01-31 23:34:35 +00:00
|
|
|
/usr/lib
|
|
|
|
/usr/lib/w32api
|
|
|
|
/usr/local/lib
|
|
|
|
/usr/X11R6/lib
|
|
|
|
DOC
|
|
|
|
"The GLFW library"
|
2012-06-14 02:08:03 +00:00
|
|
|
)
|
|
|
|
else()
|
2013-01-29 23:54:18 +00:00
|
|
|
find_library( GLFW_glfw_LIBRARY
|
2013-01-31 23:34:35 +00:00
|
|
|
NAMES
|
|
|
|
glfw32
|
|
|
|
glfw32s
|
|
|
|
glfw
|
2013-02-01 00:26:39 +00:00
|
|
|
glfw3
|
2015-02-10 21:13:39 +00:00
|
|
|
HINTS
|
2014-04-09 20:43:38 +00:00
|
|
|
"${GLFW_LOCATION}/lib"
|
|
|
|
"${GLFW_LOCATION}/lib/x64"
|
|
|
|
"${GLFW_LOCATION}/lib-msvc110"
|
2015-01-25 12:24:10 +00:00
|
|
|
"${GLFW_LOCATION}/lib-vc2012"
|
2014-04-09 20:43:38 +00:00
|
|
|
"$ENV{GLFW_LOCATION}/lib"
|
2014-04-18 01:14:51 +00:00
|
|
|
"$ENV{GLFW_LOCATION}/lib/x64"
|
|
|
|
"$ENV{GLFW_LOCATION}/lib-msvc110"
|
2015-01-25 12:24:10 +00:00
|
|
|
"$ENV{GLFW_LOCATION}/lib-vc2012"
|
2015-02-10 21:13:39 +00:00
|
|
|
PATHS
|
2014-04-09 20:43:38 +00:00
|
|
|
"$ENV{PROGRAMFILES}/GLFW/lib"
|
|
|
|
"${OPENGL_LIBRARY_DIR}"
|
2013-01-31 23:34:35 +00:00
|
|
|
DOC
|
|
|
|
"The GLFW library"
|
|
|
|
)
|
2012-06-14 02:08:03 +00:00
|
|
|
endif()
|
|
|
|
else ()
|
|
|
|
if (APPLE)
|
2013-01-29 23:54:18 +00:00
|
|
|
find_library( GLFW_glfw_LIBRARY glfw
|
2013-01-31 23:34:35 +00:00
|
|
|
NAMES
|
|
|
|
glfw
|
|
|
|
glfw3
|
2015-02-10 21:13:39 +00:00
|
|
|
HINTS
|
2014-04-09 20:43:38 +00:00
|
|
|
"${GLFW_LOCATION}/lib"
|
|
|
|
"${GLFW_LOCATION}/lib/cocoa"
|
|
|
|
"$ENV{GLFW_LOCATION}/lib"
|
|
|
|
"$ENV{GLFW_LOCATION}/lib/cocoa"
|
2015-02-10 21:13:39 +00:00
|
|
|
PATHS
|
2013-01-31 23:34:35 +00:00
|
|
|
/usr/local/lib
|
2012-06-14 02:08:03 +00:00
|
|
|
)
|
2013-01-29 23:54:18 +00:00
|
|
|
set(GLFW_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX")
|
2013-11-13 21:08:29 +00:00
|
|
|
set(GLFW_corevideo_LIBRARY "-framework CoreVideo" CACHE STRING "CoreVideo framework for OSX")
|
2013-01-29 23:54:18 +00:00
|
|
|
set(GLFW_iokit_LIBRARY "-framework IOKit" CACHE STRING "IOKit framework for OSX")
|
2012-06-14 02:08:03 +00:00
|
|
|
else ()
|
2013-01-31 23:34:35 +00:00
|
|
|
# (*)NIX
|
|
|
|
|
2014-09-24 21:47:57 +00:00
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
|
2013-01-31 23:34:35 +00:00
|
|
|
find_package(X11 REQUIRED)
|
|
|
|
|
|
|
|
if(NOT X11_Xrandr_FOUND)
|
2013-07-30 17:30:55 +00:00
|
|
|
message(FATAL_ERROR "Xrandr library not found - required for GLFW")
|
2013-01-31 23:34:35 +00:00
|
|
|
endif()
|
2013-07-30 17:30:55 +00:00
|
|
|
|
|
|
|
if(NOT X11_xf86vmode_FOUND)
|
|
|
|
message(FATAL_ERROR "xf86vmode library not found - required for GLFW")
|
|
|
|
endif()
|
|
|
|
|
2014-08-07 00:16:32 +00:00
|
|
|
if(NOT X11_Xcursor_FOUND)
|
|
|
|
message(FATAL_ERROR "Xcursor library not found - required for GLFW")
|
|
|
|
endif()
|
|
|
|
|
2015-06-04 19:51:52 +00:00
|
|
|
if(NOT X11_Xinerama_FOUND)
|
|
|
|
message(FATAL_ERROR "Xinerama library not found - required for GLFW")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
list(APPEND GLFW_x11_LIBRARY "${X11_Xrandr_LIB}" "${X11_Xxf86vm_LIB}" "${X11_Xcursor_LIB}" "${X11_Xinerama_LIB}" "${CMAKE_THREAD_LIBS_INIT}" -lrt -lXi)
|
2013-07-30 17:30:55 +00:00
|
|
|
|
2013-01-31 23:34:35 +00:00
|
|
|
find_library( GLFW_glfw_LIBRARY
|
|
|
|
NAMES
|
|
|
|
glfw
|
|
|
|
glfw3
|
2015-02-10 21:13:39 +00:00
|
|
|
HINTS
|
2014-04-09 20:43:38 +00:00
|
|
|
"${GLFW_LOCATION}/lib"
|
|
|
|
"$ENV{GLFW_LOCATION}/lib"
|
|
|
|
"${GLFW_LOCATION}/lib/x11"
|
|
|
|
"$ENV{GLFW_LOCATION}/lib/x11"
|
2015-02-10 21:13:39 +00:00
|
|
|
PATHS
|
2013-09-17 17:26:25 +00:00
|
|
|
/usr/lib64
|
2013-01-31 23:34:35 +00:00
|
|
|
/usr/lib
|
2013-09-17 17:26:25 +00:00
|
|
|
/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}
|
|
|
|
/usr/local/lib64
|
2013-01-31 23:34:35 +00:00
|
|
|
/usr/local/lib
|
2013-09-17 17:26:25 +00:00
|
|
|
/usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE}
|
2013-01-31 23:34:35 +00:00
|
|
|
/usr/openwin/lib
|
|
|
|
/usr/X11R6/lib
|
|
|
|
DOC
|
|
|
|
"The GLFW library"
|
2012-06-14 02:08:03 +00:00
|
|
|
)
|
|
|
|
endif (APPLE)
|
|
|
|
endif (WIN32)
|
|
|
|
|
2013-01-29 23:54:18 +00:00
|
|
|
set( GLFW_FOUND "NO" )
|
2012-06-14 02:08:03 +00:00
|
|
|
|
2013-01-29 23:54:18 +00:00
|
|
|
if(GLFW_INCLUDE_DIR)
|
2013-01-31 23:34:35 +00:00
|
|
|
|
|
|
|
if(GLFW_glfw_LIBRARY)
|
2014-04-09 20:43:38 +00:00
|
|
|
set( GLFW_LIBRARIES "${GLFW_glfw_LIBRARY}"
|
|
|
|
"${GLFW_x11_LIBRARY}"
|
|
|
|
"${GLFW_cocoa_LIBRARY}"
|
|
|
|
"${GLFW_iokit_LIBRARY}"
|
|
|
|
"${GLFW_corevideo_LIBRARY}" )
|
2013-01-31 23:34:35 +00:00
|
|
|
set( GLFW_FOUND "YES" )
|
2014-04-09 20:43:38 +00:00
|
|
|
set (GLFW_LIBRARY "${GLFW_LIBRARIES}")
|
|
|
|
set (GLFW_INCLUDE_PATH "${GLFW_INCLUDE_DIR}")
|
2013-01-31 23:34:35 +00:00
|
|
|
endif(GLFW_glfw_LIBRARY)
|
|
|
|
|
|
|
|
|
|
|
|
# Tease the GLFW_VERSION numbers from the lib headers
|
|
|
|
function(parseVersion FILENAME VARNAME)
|
|
|
|
|
|
|
|
set(PATTERN "^#define ${VARNAME}.*$")
|
|
|
|
|
2013-06-20 18:53:33 +00:00
|
|
|
file(STRINGS "${GLFW_INCLUDE_DIR}/${FILENAME}" TMP REGEX ${PATTERN})
|
2013-01-31 23:34:35 +00:00
|
|
|
|
|
|
|
string(REGEX MATCHALL "[0-9]+" TMP ${TMP})
|
|
|
|
|
|
|
|
set(${VARNAME} ${TMP} PARENT_SCOPE)
|
|
|
|
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
|
|
|
|
if(EXISTS "${GLFW_INCLUDE_DIR}/GL/glfw.h")
|
|
|
|
|
2013-06-20 18:53:33 +00:00
|
|
|
parseVersion(GL/glfw.h GLFW_VERSION_MAJOR)
|
|
|
|
parseVersion(GL/glfw.h GLFW_VERSION_MINOR)
|
|
|
|
parseVersion(GL/glfw.h GLFW_VERSION_REVISION)
|
2013-01-31 23:34:35 +00:00
|
|
|
|
2013-06-20 18:53:33 +00:00
|
|
|
elseif(EXISTS "${GLFW_INCLUDE_DIR}/GLFW/glfw3.h")
|
2013-01-31 23:34:35 +00:00
|
|
|
|
2013-06-20 18:53:33 +00:00
|
|
|
parseVersion(GLFW/glfw3.h GLFW_VERSION_MAJOR)
|
|
|
|
parseVersion(GLFW/glfw3.h GLFW_VERSION_MINOR)
|
|
|
|
parseVersion(GLFW/glfw3.h GLFW_VERSION_REVISION)
|
2013-01-31 23:34:35 +00:00
|
|
|
|
|
|
|
endif()
|
2013-06-20 18:53:33 +00:00
|
|
|
|
2013-01-31 23:34:35 +00:00
|
|
|
if(${GLFW_VERSION_MAJOR} OR ${GLFW_VERSION_MINOR} OR ${GLFW_VERSION_REVISION})
|
|
|
|
set(GLFW_VERSION "${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR}.${GLFW_VERSION_REVISION}")
|
|
|
|
set(GLFW_VERSION_STRING "${GLFW_VERSION}")
|
|
|
|
mark_as_advanced(GLFW_VERSION)
|
|
|
|
endif()
|
|
|
|
|
2013-01-29 23:54:18 +00:00
|
|
|
endif(GLFW_INCLUDE_DIR)
|
2012-06-09 00:06:35 +00:00
|
|
|
|
2012-06-14 02:08:03 +00:00
|
|
|
include(FindPackageHandleStandardArgs)
|
2012-06-09 00:06:35 +00:00
|
|
|
|
2013-01-31 23:34:35 +00:00
|
|
|
find_package_handle_standard_args(GLFW
|
|
|
|
REQUIRED_VARS
|
|
|
|
GLFW_INCLUDE_DIR
|
|
|
|
GLFW_LIBRARIES
|
|
|
|
VERSION_VAR
|
|
|
|
GLFW_VERSION
|
2012-06-09 00:06:35 +00:00
|
|
|
)
|
|
|
|
|
2012-06-14 02:08:03 +00:00
|
|
|
mark_as_advanced(
|
2013-01-29 23:54:18 +00:00
|
|
|
GLFW_INCLUDE_DIR
|
2013-01-31 23:34:35 +00:00
|
|
|
GLFW_LIBRARIES
|
2013-01-29 23:54:18 +00:00
|
|
|
GLFW_glfw_LIBRARY
|
|
|
|
GLFW_cocoa_LIBRARY
|
2012-06-09 00:06:35 +00:00
|
|
|
)
|
2012-08-04 02:51:27 +00:00
|
|
|
|
2013-01-31 23:34:35 +00:00
|
|
|
|