From 1f0611ab09a3d990bfcb835a4b7e74b5b5fe9bcc Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 17 Jul 2014 15:58:29 -0700 Subject: [PATCH] cleanup the LibOVR and LeapMotion find modules by removing checks --- cmake/modules/FindLeapMotion.cmake | 46 +++++----------- cmake/modules/FindLibOVR.cmake | 88 ++++++++++++++---------------- 2 files changed, 54 insertions(+), 80 deletions(-) diff --git a/cmake/modules/FindLeapMotion.cmake b/cmake/modules/FindLeapMotion.cmake index 2c6a2ae1c0..1066be46af 100644 --- a/cmake/modules/FindLeapMotion.cmake +++ b/cmake/modules/FindLeapMotion.cmake @@ -12,40 +12,20 @@ # Copyright (c) 2014 High Fidelity # -if (LEAPMOTION_LIBRARIES AND LEAPMOTION_INCLUDE_DIRS) - # in cache already - set(LEAPMOTION_FOUND TRUE) -else (LEAPMOTION_LIBRARIES AND LEAPMOTION_INCLUDE_DIRS) - set(LEAPMOTION_SEARCH_DIRS "${LEAPMOTION_ROOT_DIR}" "$ENV{HIFI_LIB_DIR}/leapmotion") +set(LEAPMOTION_SEARCH_DIRS "${LEAPMOTION_ROOT_DIR}" "$ENV{HIFI_LIB_DIR}/leapmotion") - find_path(LEAPMOTION_INCLUDE_DIRS Leap.h PATH_SUFFIXES include HINTS ${LEAPMOTION_SEARCH_DIRS}) +find_path(LEAPMOTION_INCLUDE_DIRS Leap.h PATH_SUFFIXES include HINTS ${LEAPMOTION_SEARCH_DIRS}) - if (WIN32) - find_library(LEAPMOTION_LIBRARY_DEBUG "lib/x86/Leapd.lib" HINTS ${LEAPMOTION_SEARCH_DIRS}) - find_library(LEAPMOTION_LIBRARY_RELEASE "lib/x86/Leap.lib" HINTS ${LEAPMOTION_SEARCH_DIRS}) - endif (WIN32) - if (APPLE) - find_library(LEAPMOTION_LIBRARY_RELEASE "lib/libLeap.dylib" HINTS ${LEAPMOTION_SEARCH_DIRS}) - endif (APPLE) - - include(SelectLibraryConfigurations) - select_library_configurations(LEAPMOTION) - - if (LEAPMOTION_INCLUDE_DIRS AND LEAPMOTION_LIBRARIES) - set(LEAPMOTION_FOUND TRUE) - endif (LEAPMOTION_INCLUDE_DIRS AND LEAPMOTION_LIBRARIES) +if (WIN32) + find_library(LEAPMOTION_LIBRARY_DEBUG "lib/x86/Leapd.lib" HINTS ${LEAPMOTION_SEARCH_DIRS}) + find_library(LEAPMOTION_LIBRARY_RELEASE "lib/x86/Leap.lib" HINTS ${LEAPMOTION_SEARCH_DIRS}) +endif (WIN32) +if (APPLE) + find_library(LEAPMOTION_LIBRARY_RELEASE "lib/libLeap.dylib" HINTS ${LEAPMOTION_SEARCH_DIRS}) +endif (APPLE) - if (LEAPMOTION_FOUND) - if (NOT LEAPMOTION_FIND_QUIETLY) - message(STATUS "Found LEAPMOTION... ${LEAPMOTION_LIBRARIES}") - endif (NOT LEAPMOTION_FIND_QUIETLY) - else () - if (LEAPMOTION_FIND_REQUIRED) - message(FATAL_ERROR "Could not find LEAPMOTION") - endif (LEAPMOTION_FIND_REQUIRED) - endif () +include(SelectLibraryConfigurations) +select_library_configurations(LEAPMOTION) - # show the LEAPMOTION_INCLUDE_DIRS and LEAPMOTION_LIBRARIES variables only in the advanced view - mark_as_advanced(LEAPMOTION_INCLUDE_DIRS LEAPMOTION_LIBRARIES) - -endif (LEAPMOTION_LIBRARIES AND LEAPMOTION_INCLUDE_DIRS) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LEAPMOTION DEFAULT_MSG LEAPMOTION_INCLUDE_DIRS LEAPMOTION_LIBRARIES) diff --git a/cmake/modules/FindLibOVR.cmake b/cmake/modules/FindLibOVR.cmake index 136cb7da41..270d65a84d 100644 --- a/cmake/modules/FindLibOVR.cmake +++ b/cmake/modules/FindLibOVR.cmake @@ -18,53 +18,47 @@ # See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html # -if (LIBOVR_LIBRARIES AND LIBOVR_UTIL_INCLUDE_DIR AND LIBOVR_INCLUDE_DIRS) - # in cache already - set(LIBOVR_FIND_QUIETLY TRUE) -else () - set(LIBOVR_SEARCH_DIRS "${LIBOVR_ROOT_DIR}" "$ENV{HIFI_LIB_DIR}/oculus") - - find_path(LIBOVR_INCLUDE_DIRS OVR.h PATH_SUFFIXES Include HINTS ${LIBOVR_SEARCH_DIRS}) - find_path(LIBOVR_UTIL_INCLUDE_DIR Util_Render_Stereo.h PATH_SUFFIXES Src/Util HINTS ${LIBOVR_SEARCH_DIRS}) - - # add the util include dir to the general include dirs - set(LIBOVR_INCLUDE_DIRS "${LIBOVR_INCLUDE_DIRS} ${LIBOVR_UTIL_INCLUDE_DIR}") - - if (APPLE) - find_library(LIBOVR_LIBRARY_DEBUG "Lib/MacOS/Debug/libovr.a" HINTS ${LIBOVR_SEARCH_DIRS}) - find_library(LIBOVR_LIBRARY_RELEASE "Lib/MacOS/Release/libovr.a" HINTS ${LIBOVR_SEARCH_DIRS}) - elseif (UNIX) - find_library(UDEV_LIBRARY_RELEASE libudev.a /usr/lib/x86_64-linux-gnu/) - find_library(XINERAMA_LIBRARY_RELEASE libXinerama.a /usr/lib/x86_64-linux-gnu/) - - if (CMAKE_CL_64) - set(LINUX_ARCH_DIR "i386") - else() - set(LINUX_ARCH_DIR "x86_64") - endif() - - find_library(LIBOVR_LIBRARY_DEBUG "Lib/Linux/Debug/${LINUX_ARCH_DIR}/libovr.a" HINTS ${LIBOVR_SEARCH_DIRS}) - find_library(LIBOVR_LIBRARY_RELEASE "Lib/Linux/Release/${LINUX_ARCH_DIR}/libovr.a" HINTS ${LIBOVR_SEARCH_DIRS}) - - if (UDEV_LIBRARY AND XINERAMA_LIBRARY AND OVR_LIBRARY) - set(LIBOVR_LIBRARIES "${OVR_LIBRARY};${UDEV_LIBRARY};${XINERAMA_LIBRARY}" CACHE INTERNAL "Oculus libraries") - endif (UDEV_LIBRARY AND XINERAMA_LIBRARY AND OVR_LIBRARY) - elseif (WIN32) - find_library(LIBOVR_LIBRARY_DEBUG "Lib/Win32/libovrd.lib" HINTS ${LIBOVR_SEARCH_DIRS}) - find_library(LIBOVR_LIBRARY_RELEASE "Lib/Win32/libovr.lib" HINTS ${LIBOVR_SEARCH_DIRS}) - endif () +set(LIBOVR_SEARCH_DIRS "${LIBOVR_ROOT_DIR}" "$ENV{HIFI_LIB_DIR}/oculus") - include(SelectLibraryConfigurations) - select_library_configurations(LIBOVR) - - if (UNIX) - select_library_configurations(UDEV) - select_library_configurations(XINERAMA) - - set(${LIBOVR_LIBRARIES} ${LIBOVR_LIBRARIES} ${UDEV_LIBRARY} ${XINERAMA_LIBRARY}) - endif () - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(LIBOVR DEFAULT_MSG LIBOVR_INCLUDE_DIRS LIBOVR_UTIL_INCLUDE_DIR LIBOVR_LIBRARIES) +find_path(LIBOVR_INCLUDE_DIRS OVR.h PATH_SUFFIXES Include HINTS ${LIBOVR_SEARCH_DIRS}) +find_path(LIBOVR_UTIL_INCLUDE_DIR Util_Render_Stereo.h PATH_SUFFIXES Src/Util HINTS ${LIBOVR_SEARCH_DIRS}) +# add the util include dir to the general include dirs +set(LIBOVR_INCLUDE_DIRS "${LIBOVR_INCLUDE_DIRS} ${LIBOVR_UTIL_INCLUDE_DIR}") + +if (APPLE) + find_library(LIBOVR_LIBRARY_DEBUG "Lib/MacOS/Debug/libovr.a" HINTS ${LIBOVR_SEARCH_DIRS}) + find_library(LIBOVR_LIBRARY_RELEASE "Lib/MacOS/Release/libovr.a" HINTS ${LIBOVR_SEARCH_DIRS}) +elseif (UNIX) + find_library(UDEV_LIBRARY_RELEASE libudev.a /usr/lib/x86_64-linux-gnu/) + find_library(XINERAMA_LIBRARY_RELEASE libXinerama.a /usr/lib/x86_64-linux-gnu/) + + if (CMAKE_CL_64) + set(LINUX_ARCH_DIR "i386") + else() + set(LINUX_ARCH_DIR "x86_64") + endif() + + find_library(LIBOVR_LIBRARY_DEBUG "Lib/Linux/Debug/${LINUX_ARCH_DIR}/libovr.a" HINTS ${LIBOVR_SEARCH_DIRS}) + find_library(LIBOVR_LIBRARY_RELEASE "Lib/Linux/Release/${LINUX_ARCH_DIR}/libovr.a" HINTS ${LIBOVR_SEARCH_DIRS}) + + if (UDEV_LIBRARY AND XINERAMA_LIBRARY AND OVR_LIBRARY) + set(LIBOVR_LIBRARIES "${OVR_LIBRARY};${UDEV_LIBRARY};${XINERAMA_LIBRARY}" CACHE INTERNAL "Oculus libraries") + endif (UDEV_LIBRARY AND XINERAMA_LIBRARY AND OVR_LIBRARY) +elseif (WIN32) + find_library(LIBOVR_LIBRARY_DEBUG "Lib/Win32/libovrd.lib" HINTS ${LIBOVR_SEARCH_DIRS}) + find_library(LIBOVR_LIBRARY_RELEASE "Lib/Win32/libovr.lib" HINTS ${LIBOVR_SEARCH_DIRS}) endif () + +include(SelectLibraryConfigurations) +select_library_configurations(LIBOVR) + +if (UNIX) + select_library_configurations(UDEV) + select_library_configurations(XINERAMA) + + set(${LIBOVR_LIBRARIES} ${LIBOVR_LIBRARIES} ${UDEV_LIBRARY} ${XINERAMA_LIBRARY}) +endif () + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LIBOVR DEFAULT_MSG LIBOVR_INCLUDE_DIRS LIBOVR_UTIL_INCLUDE_DIR LIBOVR_LIBRARIES)