Skip to content

Commit

Permalink
Merge pull request #276 from kwaegel/openni2_pullrequest
Browse files Browse the repository at this point in the history
OpenNI 2 grabber
  • Loading branch information
jspricke committed May 12, 2014
2 parents 9de4beb + 0a7a0f3 commit 0b88567
Show file tree
Hide file tree
Showing 41 changed files with 6,466 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ before_install:
- sudo add-apt-repository ppa:libreoffice/ppa -y
- sudo apt-get update -d
install:
- sudo apt-get install cmake libvtk5-qt4-dev libflann-dev libeigen3-dev libopenni-dev libqhull-dev libboost-filesystem1.53-dev libboost-iostreams1.53-dev libboost-thread1.53-dev
- sudo apt-get install cmake libvtk5-qt4-dev libflann-dev libeigen3-dev libopenni-dev libqhull-dev libboost-filesystem1.53-dev libboost-iostreams1.53-dev libboost-thread1.53-dev libboost-chrono1.53-dev
script:
- bash .travis.sh
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,16 @@ if(WITH_OPENNI)
endif(OPENNI_FOUND)
endif(WITH_OPENNI)

# OpenNI 2
option(WITH_OPENNI2 "OpenNI 2 driver support" TRUE)
if(WITH_OPENNI2)
find_package(OpenNI2)
if (OPENNI2_FOUND)
set(HAVE_OPENNI2 ON)
include_directories(SYSTEM ${OPENNI2_INCLUDE_DIRS})
endif(OPENNI2_FOUND)
endif(WITH_OPENNI2)

# Fotonic (FZ_API)
option(WITH_FZAPI "Build Fotonic Camera support" TRUE)
if(WITH_FZAPI)
Expand Down
41 changes: 40 additions & 1 deletion PCLConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,43 @@ macro(find_openni)
endif(OPENNI_FOUND)
endmacro(find_openni)

#remove this as soon as openni2-dev is shipped with FindOpenni2.cmake
macro(find_openni2)
if(NOT OPENNI2_ROOT AND ("ON" STREQUAL "ON"))
get_filename_component(OPENNI2_LIBRARY_HINT "OPENNI_LIBRARY-NOTFOUND" PATH)
endif(NOT OPENNI2_ROOT AND ("ON" STREQUAL "ON"))

set(OPENNI2_SUFFIX)
if(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 8)
set(OPENNI2_SUFFIX 64)
endif(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 8)

if(PKG_CONFIG_FOUND)
pkg_check_modules(PC_OPENNI2 openni2-dev)
endif(PKG_CONFIG_FOUND)

find_path(OPENNI2_INCLUDE_DIRS OpenNI.h
HINTS /usr/include/openni2 /usr/include/ni2
PATHS "$ENV{OPENNI2_INCLUDE${OPENNI2_SUFFIX}}"
PATH_SUFFIXES openni openni2 include Include)

find_library(OPENNI2_LIBRARY
NAMES OpenNI2 # No suffix needed on Win64
HINTS /usr/lib
PATHS "$ENV{OPENNI2_LIB${OPENNI2_SUFFIX}}"
PATH_SUFFIXES lib Lib Lib64)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OpenNI2 DEFAULT_MSG OPENNI2_LIBRARY OPENNI2_INCLUDE_DIRS)

if(OPENNI2_FOUND)
get_filename_component(OPENNI_LIBRARY_PATH ${OPENNI2_LIBRARY} PATH)
set(OPENNI2_LIBRARY_DIRS ${OPENNI2_LIBRARY_PATH})
set(OPENNI2_LIBRARIES "${OPENNI2_LIBRARY}")
set(OPENNI2_REDIST_DIR $ENV{OPENNI2_REDIST${OPENNI2_SUFFIX}})
endif(OPENNI2_FOUND)
endmacro(find_openni2)

#remove this as soon as flann is shipped with FindFlann.cmake
macro(find_flann)
if(PCL_ALL_IN_ONE_INSTALLER)
Expand Down Expand Up @@ -404,6 +441,8 @@ macro(find_external_library _component _lib _is_optional)
find_qhull()
elseif("${_lib}" STREQUAL "openni")
find_openni()
elseif("${_lib}" STREQUAL "openni2")
find_openni2()
elseif("${_lib}" STREQUAL "vtk")
find_VTK()
elseif("${_lib}" STREQUAL "libusb-1.0")
Expand Down Expand Up @@ -680,7 +719,7 @@ endif(NOT "${PCL_DEFINITIONS}" STREQUAL "")
pcl_remove_duplicate_libraries(PCL_LIBRARIES PCL_DEDUP_LIBRARIES)
set(PCL_LIBRARIES ${PCL_DEDUP_LIBRARIES})
# Add 3rd party libraries, as user code might include our .HPP implementations
list(APPEND PCL_LIBRARIES ${BOOST_LIBRARIES} ${QHULL_LIBRARIES} ${OPENNI_LIBRARIES} ${FLANN_LIBRARIES} ${VTK_LIBRARIES})
list(APPEND PCL_LIBRARIES ${BOOST_LIBRARIES} ${QHULL_LIBRARIES} ${OPENNI_LIBRARIES} ${OPENNI2_LIBRARIES} ${FLANN_LIBRARIES} ${VTK_LIBRARIES})

find_package_handle_standard_args(PCL DEFAULT_MSG PCL_LIBRARIES PCL_INCLUDE_DIRS)
mark_as_advanced(PCL_LIBRARIES PCL_INCLUDE_DIRS PCL_LIBRARY_DIRS)
80 changes: 80 additions & 0 deletions cmake/Modules/FindOpenNI2.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
###############################################################################
# Find OpenNI 2
#
# This sets the following variables:
# OPENNI2_FOUND - True if OPENNI 2 was found.
# OPENNI2_INCLUDE_DIRS - Directories containing the OPENNI 2 include files.
# OPENNI2_LIBRARIES - Libraries needed to use OPENNI 2.
# OPENNI2_DEFINITIONS - Compiler flags for OPENNI 2.
#
# For libusb-1.0, add USB_10_ROOT if not found

find_package(PkgConfig QUIET)

# Find LibUSB
if(NOT WIN32)
pkg_check_modules(PC_USB_10 libusb-1.0)
find_path(USB_10_INCLUDE_DIR libusb-1.0/libusb.h
HINTS ${PC_USB_10_INCLUDEDIR} ${PC_USB_10_INCLUDE_DIRS} "${USB_10_ROOT}" "$ENV{USB_10_ROOT}"
PATH_SUFFIXES libusb-1.0)

find_library(USB_10_LIBRARY
NAMES usb-1.0
HINTS ${PC_USB_10_LIBDIR} ${PC_USB_10_LIBRARY_DIRS} "${USB_10_ROOT}" "$ENV{USB_10_ROOT}"
PATH_SUFFIXES lib)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(USB_10 DEFAULT_MSG USB_10_LIBRARY USB_10_INCLUDE_DIR)

if(NOT USB_10_FOUND)
message(STATUS "OpenNI 2 disabled because libusb-1.0 not found.")
return()
else()
include_directories(SYSTEM ${USB_10_INCLUDE_DIR})
endif()
endif(NOT WIN32)

if(${CMAKE_VERSION} VERSION_LESS 2.8.2)
pkg_check_modules(PC_OPENNI2 openni2-dev)
else()
pkg_check_modules(PC_OPENNI2 QUIET openni2-dev)
endif()

set(OPENNI2_DEFINITIONS ${PC_OPENNI_CFLAGS_OTHER})

set(OPENNI2_SUFFIX)
if(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 8)
set(OPENNI2_SUFFIX 64)
endif(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 8)

find_path(OPENNI2_INCLUDE_DIRS OpenNI.h
PATHS
"$ENV{OPENNI2_INCLUDE${OPENNI2_SUFFIX}}" # Win64 needs '64' suffix
/usr/include/openni2 # common path for deb packages
)

find_library(OPENNI2_LIBRARY
NAMES OpenNI2 # No suffix needed on Win64
libOpenNI2 # Linux
PATHS "$ENV{OPENNI2_LIB${OPENNI2_SUFFIX}}" # Windows default path, Win64 needs '64' suffix
"$ENV{OPENNI2_REDIST}" # Linux install does not use a separate 'lib' directory
)

if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(OPENNI2_LIBRARIES ${OPENNI2_LIBRARY} ${LIBUSB_1_LIBRARIES})
else()
set(OPENNI2_LIBRARIES ${OPENNI2_LIBRARY})
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OpenNI2 DEFAULT_MSG OPENNI2_LIBRARY OPENNI2_INCLUDE_DIRS)

mark_as_advanced(OPENNI2_LIBRARY OPENNI2_INCLUDE_DIRS)

if(OPENNI2_FOUND)
# Add the include directories
set(OPENNI2_INCLUDE_DIRS ${OPENNI2_INCLUDE_DIR})
set(OPENNI2_REDIST_DIR $ENV{OPENNI2_REDIST${OPENNI2_SUFFIX}})
message(STATUS "OpenNI 2 found (include: ${OPENNI2_INCLUDE_DIRS}, lib: ${OPENNI2_LIBRARY}, redist: ${OPENNI2_REDIST_DIR})")
endif(OPENNI2_FOUND)

12 changes: 3 additions & 9 deletions cmake/pcl_find_boost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ endif(${CMAKE_VERSION} VERSION_LESS 2.8.5)
set(Boost_NO_BOOST_CMAKE ON)

# Optional boost modules
find_package(Boost 1.40.0 QUIET COMPONENTS serialization mpi)
find_package(Boost 1.47.0 QUIET COMPONENTS serialization mpi)

This comment has been minimized.

Copy link
@VictorLamoine

VictorLamoine May 13, 2014

Contributor

@kwaegel why is it necessary to upgrade to 1.47 ?

This comment has been minimized.

Copy link
@kwaegel

kwaegel via email May 13, 2014

if(Boost_MPI_FOUND)
set(BOOST_MPI_FOUND TRUE)
endif(Boost_MPI_FOUND)
Expand All @@ -32,15 +32,9 @@ if(Boost_SERIALIZATION_FOUND)
endif(Boost_SERIALIZATION_FOUND)

# Required boost modules
set(BOOST_REQUIRED_MODULES system filesystem thread date_time iostreams)
# Starting with Boost 1.50, boost_thread depends on chrono. As this is not
# taken care of automatically on Windows, we add an explicit dependency as a
# workaround.
if(WIN32 AND Boost_VERSION VERSION_GREATER "104900")
set(BOOST_REQUIRED_MODULES ${BOOST_REQUIRED_MODULES} chrono)
endif(WIN32 AND Boost_VERSION VERSION_GREATER "104900")
set(BOOST_REQUIRED_MODULES system filesystem thread date_time iostreams chrono)

find_package(Boost 1.40.0 REQUIRED COMPONENTS ${BOOST_REQUIRED_MODULES})
find_package(Boost 1.47.0 REQUIRED COMPONENTS ${BOOST_REQUIRED_MODULES})

if(Boost_FOUND)
set(BOOST_FOUND TRUE)
Expand Down
6 changes: 4 additions & 2 deletions gpu/people/tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ include_directories(${VTK_INCLUDE_DIRS})
#PCL_ADD_EXECUTABLE("${the_target}" "${SUBSYS_NAME}" people_tracking.cpp)
#target_link_libraries("${the_target}" pcl_common pcl_filters pcl_kdtree pcl_segmentation pcl_kdtree pcl_gpu_people pcl_filters pcl_io pcl_visualization)

PCL_ADD_EXECUTABLE(pcl_people_app "${SUBSYS_NAME}" people_app.cpp)
target_link_libraries (pcl_people_app pcl_common pcl_filters pcl_kdtree pcl_segmentation pcl_kdtree pcl_gpu_people pcl_filters pcl_io pcl_visualization ${Boost_LIBRARIES})
if (HAVE_OPENNI)
PCL_ADD_EXECUTABLE(pcl_people_app "${SUBSYS_NAME}" people_app.cpp)
target_link_libraries (pcl_people_app pcl_common pcl_filters pcl_kdtree pcl_segmentation pcl_kdtree pcl_gpu_people pcl_filters pcl_io pcl_visualization ${Boost_LIBRARIES})
endif (HAVE_OPENNI)

PCL_ADD_EXECUTABLE(pcl_people_pcd_prob "${SUBSYS_NAME}" people_pcd_prob.cpp)
target_link_libraries (pcl_people_pcd_prob pcl_common pcl_filters pcl_kdtree pcl_segmentation pcl_kdtree pcl_gpu_people pcl_filters pcl_io pcl_visualization ${Boost_LIBRARIES})
Expand Down
Loading

0 comments on commit 0b88567

Please sign in to comment.