1# - try to find VRJuggler 3.0 OpenGL library 2# Requires VRJ core 3.0 (thus FindVRJ30.cmake) 3# Requires OpenGL. 4# Optionally uses Flagpoll and FindFlagpoll.cmake 5# 6# This library is a part of VR Juggler 3.0 - you probably want to use 7# find_package(VRJuggler30) instead, for an easy interface to this and 8# related scripts. See FindVRJuggler30.cmake for more information. 9# 10# VRJOGL30_LIBRARY_DIR, library search path 11# VRJOGL30_INCLUDE_DIRS, include search path for dependencies 12# VRJOGL30_LIBRARY, the library to link against 13# VRJOGL30_FOUND, If false, do not try to use this library. 14# 15# Plural versions refer to this library and its dependencies, and 16# are recommended to be used instead, unless you have a good reason. 17# 18# Useful configuration variables you might want to add to your cache: 19# VRJOGL30_ROOT_DIR - A directory prefix to search 20# (a path that contains include/ as a subdirectory) 21# 22# This script will use Flagpoll, if found, to provide hints to the location 23# of this library, but does not use the compiler flags returned by Flagpoll 24# directly. 25# 26# The VJ_BASE_DIR environment variable is also searched (preferentially) 27# when searching for this component, so most sane build environments should 28# "just work." Note that you need to manually re-run CMake if you change 29# this environment variable, because it cannot auto-detect this change 30# and trigger an automatic re-run. 31# 32# Original Author: 33# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> 34# http://academic.cleardefinition.com 35# Iowa State University HCI Graduate Program/VRAC 36# Updated for VR Juggler 3.0 by: 37# Brandon Newendorp <brandon@newendorp.com> 38 39 40set(_HUMAN "VR Juggler 3.0 OpenGL Core") 41set(_FP_PKG_NAME vrjuggler-opengl) 42set(_RELEASE_NAMES) 43set(_DEBUG_NAMES) 44foreach(VER 3_0 3_0_0 3_0_1 3_0_2) 45 list(APPEND _RELEASE_NAMES vrj_ogl-${VER}) 46 list(APPEND _DEBUG_NAMES vrj_ogl_d-${VER}) 47endforeach() 48set(_DIR vrjuggler-3.0) 49 50include(SelectLibraryConfigurations) 51include(CreateImportedTarget) 52include(CleanLibraryList) 53include(CleanDirectoryList) 54 55if(VRJOGL30_FIND_QUIETLY) 56 set(_FIND_FLAGS "QUIET") 57else() 58 set(_FIND_FLAGS "") 59endif() 60 61# Try flagpoll. 62find_package(Flagpoll QUIET) 63 64if(FLAGPOLL) 65 flagpoll_get_library_dirs(${_FP_PKG_NAME} NO_DEPS) 66 flagpoll_get_library_names(${_FP_PKG_NAME} NO_DEPS) 67endif() 68 69set(VRJOGL30_ROOT_DIR 70 "${VRJOGL30_ROOT_DIR}" 71 CACHE 72 PATH 73 "Root directory to search for VRJOGL") 74if(DEFINED VRJUGGLER30_ROOT_DIR) 75 mark_as_advanced(VRJOGL30_ROOT_DIR) 76endif() 77if(NOT VRJOGL30_ROOT_DIR) 78 set(VRJOGL30_ROOT_DIR "${VRJUGGLER30_ROOT_DIR}") 79endif() 80 81set(_ROOT_DIR "${VRJOGL30_ROOT_DIR}") 82 83find_library(VRJOGL30_LIBRARY_RELEASE 84 NAMES 85 ${_RELEASE_NAMES} 86 HINTS 87 "${_ROOT_DIR}" 88 ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} 89 PATH_SUFFIXES 90 ${_VRJ_LIBSUFFIXES} 91 DOC 92 "${_HUMAN} release library full path") 93 94find_library(VRJOGL30_LIBRARY_DEBUG 95 NAMES 96 ${_DEBUG_NAMES} 97 HINTS 98 "${_ROOT_DIR}" 99 ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} 100 PATH_SUFFIXES 101 ${_VRJ_LIBDSUFFIXES} 102 DOC 103 "${_HUMAN} debug library full path") 104 105select_library_configurations(VRJOGL30) 106 107# Dependency 108if(NOT VRJ30_FOUND) 109 find_package(VRJ30 ${_FIND_FLAGS}) 110endif() 111 112if(NOT OPENGL_FOUND) 113 find_package(OpenGL ${_FIND_FLAGS}) 114endif() 115 116if(APPLE) 117 set(VRJOGL30_AppKit_LIBRARY 118 "-framework AppKit" 119 CACHE 120 STRING 121 "AppKit framework for OSX") 122 set(VRJOGL30_Cocoa_LIBRARY 123 "-framework Cocoa" 124 CACHE 125 STRING 126 "Cocoa framework for OSX") 127 mark_as_advanced(VRJOGL30_AppKit_LIBRARY VRJOGL30_Cocoa_LIBRARY) 128endif() 129 130# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if 131# all listed variables are TRUE 132include(FindPackageHandleStandardArgs) 133find_package_handle_standard_args(VRJOGL30 134 DEFAULT_MSG 135 VRJOGL30_LIBRARY 136 VRJ30_FOUND 137 VRJ30_LIBRARIES 138 VRJ30_INCLUDE_DIRS 139 OPENGL_FOUND 140 OPENGL_LIBRARIES) 141 142if(VRJOGL30_FOUND) 143 set(_DEPS ${VRJ30_LIBRARIES} ${OPENGL_LIBRARIES}) 144 if(APPLE) 145 list(APPEND 146 _DEPS 147 ${VRJOGL30_AppKit_LIBRARY} 148 ${VRJOGL30_Cocoa_LIBRARY}) 149 endif() 150 151 set(VRJOGL30_INCLUDE_DIRS ${VRJ30_INCLUDE_DIRS} ${OPENGL_INCLUDE_DIRS}) 152 153 if(VRJUGGLER30_CREATE_IMPORTED_TARGETS) 154 create_imported_target(VRJOGL30 ${_DEPS}) 155 else() 156 clean_library_list(VRJOGL30_LIBRARIES ${_DEPS}) 157 endif() 158 159 mark_as_advanced(VRJOGL30_ROOT_DIR) 160endif() 161 162mark_as_advanced(VRJOGL30_LIBRARY_RELEASE VRJOGL30_LIBRARY_DEBUG) 163