2011-02-04 14:41:10 +01:00
# Main variables:
# OPENNI_LIBRARY and OPENNI_INCLUDES to link OpenCV modules with OpenNI
# HAVE_OPENNI for conditional compilation OpenCV with/without OpenNI
if ( NOT "${OPENNI_LIB_DIR}" STREQUAL "${OPENNI_LIB_DIR_INTERNAL}" )
2011-02-04 16:36:41 +01:00
unset ( OPENNI_LIBRARY CACHE )
2011-08-10 16:58:55 +02:00
unset ( OPENNI_LIB_DIR CACHE )
2011-02-04 14:41:10 +01:00
endif ( )
2011-08-10 16:58:55 +02:00
2011-02-04 14:41:10 +01:00
if ( NOT "${OPENNI_INCLUDE_DIR}" STREQUAL "${OPENNI_INCLUDE_DIR_INTERNAL}" )
2011-02-04 16:36:41 +01:00
unset ( OPENNI_INCLUDES CACHE )
2011-08-10 16:58:55 +02:00
unset ( OPENNI_INCLUDE_DIR CACHE )
2011-02-04 14:41:10 +01:00
endif ( )
2011-08-10 16:58:55 +02:00
if ( NOT "${OPENNI_PRIME_SENSOR_MODULE_BIN_DIR}" STREQUAL "${OPENNI_PRIME_SENSOR_MODULE_BIN_DIR_INTERNAL}" )
2011-02-04 16:36:41 +01:00
unset ( OPENNI_PRIME_SENSOR_MODULE CACHE )
2011-08-10 16:58:55 +02:00
unset ( OPENNI_PRIME_SENSOR_MODULE_BIN_DIR CACHE )
2011-02-04 14:41:10 +01:00
endif ( )
2012-02-20 10:16:19 +01:00
if ( WIN32 )
if ( NOT ( MSVC64 OR MINGW64 ) )
find_file ( OPENNI_INCLUDES "XnCppWrapper.h" PATHS "$ENV{OPEN_NI_INSTALL_PATH}Include" DOC "OpenNI c++ interface header" )
find_library ( OPENNI_LIBRARY "OpenNI" PATHS $ENV{ OPEN_NI_LIB } DOC "OpenNI library" )
else ( )
find_file ( OPENNI_INCLUDES "XnCppWrapper.h" PATHS "$ENV{OPEN_NI_INSTALL_PATH64}Include" DOC "OpenNI c++ interface header" )
find_library ( OPENNI_LIBRARY "OpenNI64" PATHS $ENV{ OPEN_NI_LIB64 } DOC "OpenNI library" )
endif ( )
elseif ( UNIX OR APPLE )
find_file ( OPENNI_INCLUDES "XnCppWrapper.h" PATHS "/usr/include/ni" "/usr/include/openni" DOC "OpenNI c++ interface header" )
find_library ( OPENNI_LIBRARY "OpenNI" PATHS "/usr/lib" DOC "OpenNI library" )
endif ( )
2011-02-04 14:41:10 +01:00
if ( OPENNI_LIBRARY AND OPENNI_INCLUDES )
2011-02-04 16:36:41 +01:00
set ( HAVE_OPENNI TRUE )
2011-08-10 16:58:55 +02:00
# the check: are PrimeSensor Modules for OpenNI installed
2011-02-04 16:36:41 +01:00
if ( WIN32 )
2012-10-17 09:12:04 +02:00
if ( NOT ( MSVC64 OR MINGW64 ) )
2012-02-20 10:16:19 +01:00
find_file ( OPENNI_PRIME_SENSOR_MODULE "XnCore.dll" PATHS "$ENV{OPEN_NI_INSTALL_PATH}../PrimeSense/Sensor/Bin" "$ENV{OPEN_NI_INSTALL_PATH}../PrimeSense/SensorKinect/Bin" DOC "Core library of PrimeSensor Modules for OpenNI" )
else ( )
find_file ( OPENNI_PRIME_SENSOR_MODULE "XnCore64.dll" PATHS "$ENV{OPEN_NI_INSTALL_PATH64}../PrimeSense/Sensor/Bin64" "$ENV{OPEN_NI_INSTALL_PATH64}../PrimeSense/SensorKinect/Bin64" DOC "Core library of PrimeSensor Modules for OpenNI" )
endif ( )
2011-02-04 16:36:41 +01:00
elseif ( UNIX OR APPLE )
2011-08-10 16:58:55 +02:00
find_library ( OPENNI_PRIME_SENSOR_MODULE "XnCore" PATHS "/usr/lib" DOC "Core library of PrimeSensor Modules for OpenNI" )
2011-02-04 16:36:41 +01:00
endif ( )
2012-01-03 14:48:12 +01:00
2011-02-04 16:36:41 +01:00
if ( OPENNI_PRIME_SENSOR_MODULE )
set ( HAVE_OPENNI_PRIME_SENSOR_MODULE TRUE )
2011-08-10 16:58:55 +02:00
endif ( )
2011-02-04 14:41:10 +01:00
endif ( ) #if(OPENNI_LIBRARY AND OPENNI_INCLUDES)
2012-04-13 23:50:59 +02:00
get_filename_component ( OPENNI_LIB_DIR "${OPENNI_LIBRARY}" PATH )
get_filename_component ( OPENNI_INCLUDE_DIR ${ OPENNI_INCLUDES } PATH )
get_filename_component ( OPENNI_PRIME_SENSOR_MODULE_BIN_DIR "${OPENNI_PRIME_SENSOR_MODULE}" PATH )
if ( HAVE_OPENNI )
set ( OPENNI_LIB_DIR "${OPENNI_LIB_DIR}" CACHE PATH "Path to OpenNI libraries" FORCE )
set ( OPENNI_INCLUDE_DIR "${OPENNI_INCLUDE_DIR}" CACHE PATH "Path to OpenNI headers" FORCE )
set ( OPENNI_PRIME_SENSOR_MODULE_BIN_DIR "${OPENNI_PRIME_SENSOR_MODULE_BIN_DIR}" CACHE PATH "Path to OpenNI PrimeSensor Module binaries" FORCE )
endif ( )
2011-08-10 16:58:55 +02:00
2011-02-04 14:41:10 +01:00
if ( OPENNI_LIBRARY )
2011-02-04 16:36:41 +01:00
set ( OPENNI_LIB_DIR_INTERNAL "${OPENNI_LIB_DIR}" CACHE INTERNAL "This is the value of the last time OPENNI_LIB_DIR was set successfully." FORCE )
2011-02-04 14:41:10 +01:00
else ( )
2011-02-04 16:36:41 +01:00
message ( WARNING, " OpenNI library directory (set by OPENNI_LIB_DIR variable) is not found or does not have OpenNI libraries." )
2011-02-04 14:41:10 +01:00
endif ( )
if ( OPENNI_INCLUDES )
2011-02-04 16:36:41 +01:00
set ( OPENNI_INCLUDE_DIR_INTERNAL "${OPENNI_INCLUDE_DIR}" CACHE INTERNAL "This is the value of the last time OPENNI_INCLUDE_DIR was set successfully." FORCE )
2011-02-04 14:41:10 +01:00
else ( )
2011-08-10 16:58:55 +02:00
message ( WARNING, " OpenNI include directory (set by OPENNI_INCLUDE_DIR variable) is not found or does not have OpenNI include files." )
2011-02-04 14:41:10 +01:00
endif ( )
if ( OPENNI_PRIME_SENSOR_MODULE )
2011-02-04 16:36:41 +01:00
set ( OPENNI_PRIME_SENSOR_MODULE_BIN_DIR_INTERNAL "${OPENNI_PRIME_SENSOR_MODULE_BIN_DIR}" CACHE INTERNAL "This is the value of the last time OPENNI_PRIME_SENSOR_MODULE_BIN_DIR was set successfully." FORCE )
2011-02-04 14:41:10 +01:00
else ( )
2011-02-04 16:36:41 +01:00
message ( WARNING, " PrimeSensor Module binaries directory (set by OPENNI_PRIME_SENSOR_MODULE_BIN_DIR variable) is not found or does not have PrimeSensor Module binaries." )
2011-02-04 14:41:10 +01:00
endif ( )
mark_as_advanced ( FORCE OPENNI_PRIME_SENSOR_MODULE )
mark_as_advanced ( FORCE OPENNI_LIBRARY )
mark_as_advanced ( FORCE OPENNI_INCLUDES )
2012-04-13 23:50:59 +02:00
if ( HAVE_OPENNI )
ocv_parse_header ( "${OPENNI_INCLUDE_DIR}/XnVersion.h" OPENNI_VERSION_LINES XN_MAJOR_VERSION XN_MINOR_VERSION XN_MAINTENANCE_VERSION XN_BUILD_VERSION )
if ( XN_MAJOR_VERSION )
set ( OPENNI_VERSION_STRING ${ XN_MAJOR_VERSION } . ${ XN_MINOR_VERSION } . ${ XN_MAINTENANCE_VERSION } CACHE INTERNAL "OpenNI version" )
set ( OPENNI_VERSION_BUILD ${ XN_BUILD_VERSION } CACHE INTERNAL "OpenNI build version" )
endif ( )
endif ( )