From 4ca200fe1a93cd9e66875837fad2b014a8d58754 Mon Sep 17 00:00:00 2001 From: Mathieu Labbe Date: Fri, 3 Apr 2015 15:13:05 -0400 Subject: [PATCH] Added cmake DC1394 lookup --- CMakeLists.txt | 7 +++++++ cmake_modules/FindDC1394.cmake | 33 +++++++++++++++++++++++++++++++++ corelib/src/CMakeLists.txt | 12 ++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 cmake_modules/FindDC1394.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 63e66bda..580c11fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -135,6 +135,7 @@ ENDIF("${VTK_MAJOR_VERSION}" EQUAL 5) FIND_PACKAGE(ZLIB REQUIRED) FIND_PACKAGE(Freenect) FIND_PACKAGE(OpenNI2) +FIND_PACKAGE(DC1394) FIND_PACKAGE(G2O) # If Qt is here, the GUI will be built @@ -343,6 +344,12 @@ ELSE() MESSAGE(STATUS " With OpenNI2 = NO (OpenNI2 not found)") ENDIF() +IF(DC1394_FOUND) +MESSAGE(STATUS " With dc1394 = YES") +ELSE() +MESSAGE(STATUS " With dc1394 = NO (dc1394 not found)") +ENDIF() + IF(G2O_FOUND) MESSAGE(STATUS " With g2o = YES") ELSE() diff --git a/cmake_modules/FindDC1394.cmake b/cmake_modules/FindDC1394.cmake new file mode 100644 index 00000000..e9cce581 --- /dev/null +++ b/cmake_modules/FindDC1394.cmake @@ -0,0 +1,33 @@ +# - Find DC1394 alias libdc1394 +# This module finds an installed DC1394 package. +# +# It sets the following variables: +# DC1394_FOUND - Set to false, or undefined, if DC1394 isn't found. +# DC1394_INCLUDE_DIRS - The DC1394 include directory. +# DC1394_LIBRARIES - The DC1394 library to link against. + +find_path(DC1394_INCLUDE_DIRS NAMES dc1394.h PATH_SUFFIXES dc1394) +find_library(DC1394_LIBRARIES NAMES dc1394) + +IF (DC1394_INCLUDE_DIRS AND DC1394_LIBRARIES) + SET(DC1394_FOUND TRUE) + + #On Mac OS X + if(CMAKE_SYSTEM_NAME MATCHES "Darwin") + set(DC1394_LIBRARIES ${DC1394_LIBRARIES} "-framework CoreServices") + endif(CMAKE_SYSTEM_NAME MATCHES "Darwin") + +ENDIF (DC1394_INCLUDE_DIRS AND DC1394_LIBRARIES) + +IF (DC1394_FOUND) + # show which DC1394 was found only if not quiet + IF (NOT DC1394_FIND_QUIETLY) + MESSAGE(STATUS "Found DC1394: ${DC1394_LIBRARIES}") + ENDIF (NOT DC1394_FIND_QUIETLY) +ELSE (DC1394_FOUND) + # fatal error if DC1394 is required but not found + IF (DC1394_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find DC1394 (libdc1394)") + ENDIF (DC1394_FIND_REQUIRED) +ENDIF (DC1394_FOUND) + diff --git a/corelib/src/CMakeLists.txt b/corelib/src/CMakeLists.txt index 4676e417..8f12ae10 100644 --- a/corelib/src/CMakeLists.txt +++ b/corelib/src/CMakeLists.txt @@ -83,6 +83,18 @@ IF(OpenNI2_FOUND) ) ENDIF(OpenNI2_FOUND) +IF(DC1394_FOUND) + ADD_DEFINITIONS("-DWITH_DC1394") + SET(INCLUDE_DIRS + ${INCLUDE_DIRS} + ${DC1394_INCLUDE_DIRS} + ) + SET(LIBRARIES + ${LIBRARIES} + ${DC1394_LIBRARIES} + ) +ENDIF(DC1394_FOUND) + IF(G2O_FOUND) ADD_DEFINITIONS("-DWITH_G2O") SET(INCLUDE_DIRS