# - Try to find Oculus VR from Oculus Rift SDK (https://developer.oculusvr.com) # Once done this module will define # OVR_FOUND # OVR_INCLUDE_DIRS # OVR_LIBRARIES # OVR_DEFINITIONS # You can set a helper # OVR_ROOT_DIR # platform properties if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(BITS_64 ON) endif() # directories to search in set(OVR_ROOT_DIR $ENV{OVR_ROOT_DIR} CACHE PATH "root directory of the API (including LibOVR)") set(FIND_HINT_DIRS ${OVR_ROOT_DIR} ) # headers find_path(OVR_INCLUDE_DIR NAMES OVR.h PATHS ${FIND_HINT_DIRS} PATH_SUFFIXES Include DOC "include path" ) # library if(BITS_64) set(PATH_SUFFIX "Lib/x64") set(FILE_NAME_SUFFIX "64") else() set(PATH_SUFFIX "Lib/Win32") set(FILE_NAME_SUFFIX "") endif() if(MSVC) set(VS10 "Visual Studio 10") set(VS11 "Visual Studio 11") set(VS12 "Visual Studio 12") string(FIND ${CMAKE_GENERATOR} ${VS10} VS10_COMP) string(FIND ${CMAKE_GENERATOR} ${VS11} VS11_COMP) string(FIND ${CMAKE_GENERATOR} ${VS12} VS12_COMP) if(VS10_COMP GREATER -1) set(PATH_SUFFIX "${PATH_SUFFIX}/VS2010") endif() if(VS11_COMP GREATER -1) set(PATH_SUFFIX "${PATH_SUFFIX}/VS2012") endif() if(VS12_COMP GREATER -1 ) set(PATH_SUFFIX "${PATH_SUFFIX}/VS2013") endif() endif() find_library(OVR_LIBRARY_RELEASE NAMES libovr${FILE_NAME_SUFFIX} PATHS ${FIND_HINT_DIRS} PATH_SUFFIXES ${PATH_SUFFIX} DOC "library" ) find_library(OVR_LIBRARY_DEBUG NAMES libovr${FILE_NAME_SUFFIX}d PATHS ${FIND_HINT_DIRS} PATH_SUFFIXES ${PATH_SUFFIX} DOC "library" ) include(SelectLibraryConfigurations) select_library_configurations(OVR) # Workaround: Remove x_LIBRARY from the cache set(OVR_LIBRARY_TMP ${OVR_LIBRARY}) unset(OVR_LIBRARY CACHE) set(OVR_LIBRARY ${OVR_LIBRARY_TMP}) unset(OVR_LIBRARY_TMP) # mark all cached variables as advanced except helper mark_as_advanced( OVR_INCLUDE_DIR OVR_LIBRARY_DEBUG OVR_LIBRARY_RELEASE ) # results set(OVR_DEFINITIONS "") set(OVR_INCLUDE_DIRS ${OVR_INCLUDE_DIR}) set(OVR_LIBRARIES ${OVR_LIBRARY}) if(WIN32) list(APPEND OVR_LIBRARIES "Winmm.lib" "Ws2_32.lib") endif() # set x_FOUND include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(OVR REQUIRED_VARS OVR_LIBRARY OVR_INCLUDE_DIR FAIL_MESSAGE "Tip: set OVR_ROOT_DIR or set the advanced variables directly" )