diff --git a/cmake/modules/FindUVCCameraControl.cmake b/cmake/modules/FindUVCCameraControl.cmake new file mode 100644 index 0000000000..8495aea494 --- /dev/null +++ b/cmake/modules/FindUVCCameraControl.cmake @@ -0,0 +1,39 @@ +# Try to find the UVCCameraControl library to manipulate webcam via USB on OS X +# +# You must provide a UVCCAMERACONTROL_ROOT_DIR which contains lib and include directories +# +# Once done this will define +# +# UVCCAMERACONTROL_FOUND - system found UVCCameraControl +# UVCCAMERACONTROL_INCLUDE_DIRS - the UVCCameraControl include directory +# UVCCAMERACONTROL_LIBRARIES - Link this to use UVCCameraControl +# +# Created on 6/19/2013 by Andrzej Kapolka +# Copyright (c) 2013 High Fidelity +# + +if (UVCCAMERACONTROL_LIBRARIES AND UVCCAMERACONTROL_INCLUDE_DIRS) + # in cache already + set(UVCCAMERACONTROL_FOUND TRUE) +else (UVCCAMERACONTROL_LIBRARIES AND UVCCAMERACONTROL_INCLUDE_DIRS) + find_path(UVCCAMERACONTROL_INCLUDE_DIRS UVCCameraControl.hpp ${UVCCAMERACONTROL_ROOT_DIR}/include) + find_library(UVCCAMERACONTROL_LIBRARIES libUVCCameraControl.a ${UVCCAMERACONTROL_ROOT_DIR}/lib) + + if (UVCCAMERACONTROL_INCLUDE_DIRS AND UVCCAMERACONTROL_LIBRARIES) + set(UVCCAMERACONTROL_FOUND TRUE) + endif (UVCCAMERACONTROL_INCLUDE_DIRS AND UVCCAMERACONTROL_LIBRARIES) + + if (UVCCAMERACONTROL_FOUND) + if (NOT UVCCAMERACONTROL_FIND_QUIETLY) + message(STATUS "Found UVCCameraControl: ${UVCCAMERACONTROL_LIBRARIES}") + endif (NOT UVCCAMERACONTROL_FIND_QUIETLY) + else (UVCCAMERACONTROL_FOUND) + if (UVCCAMERACONTROL_FIND_REQUIRED) + message(FATAL_ERROR "Could not find UVCCameraControl") + endif (UVCCAMERACONTROL_FIND_REQUIRED) + endif (UVCCAMERACONTROL_FOUND) + + # show the UVCCAMERACONTROL_INCLUDE_DIRS and UVCCAMERACONTROL_LIBRARIES variables only in the advanced view + mark_as_advanced(UVCCAMERACONTROL_INCLUDE_DIRS UVCCAMERACONTROL_LIBRARIES) + +endif (UVCCAMERACONTROL_LIBRARIES AND UVCCAMERACONTROL_INCLUDE_DIRS) diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index aa2257fbf1..9a57a546f1 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -11,6 +11,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../cmake set(LIBOVR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/LibOVR) set(PORTAUDIO_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/PortAudio) set(OPENCV_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/OpenCV) +set(UVCCAMERACONTROL_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/UVCCameraControl) if (APPLE) set(GL_HEADERS "#include \n#include ") @@ -87,6 +88,7 @@ find_package(GLM REQUIRED) find_package(LibOVR) find_package(OpenCV) find_package(ZLIB) +find_package(UVCCameraControl) # include headers for interface and InterfaceConfig. include_directories( @@ -120,7 +122,7 @@ if (APPLE) find_library(QTKit QTKit) find_library(QuartzCore QuartzCore) - include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/external/UVCCameraControl/include) + include_directories(SYSTEM ${UVCCAMERACONTROL_INCLUDE_DIRS}) target_link_libraries( ${TARGET_NAME} @@ -136,7 +138,7 @@ if (APPLE) ${IOKit} ${QTKit} ${QuartzCore} - ${CMAKE_CURRENT_SOURCE_DIR}/external/UVCCameraControl/lib/libUVCCameraControl.a + ${UVCCAMERACONTROL_LIBRARIES} ${LIBOVR_LIBRARIES} ) else (APPLE)