victorprad / InfiniTAM

A Framework for the Volumetric Integration of Depth Images
http://www.infinitam.org
Other
918 stars 351 forks source link

Cannot find Open_NI_Root in Ubuntu 16.04 #123

Closed sabrinazuraimi closed 5 years ago

sabrinazuraimi commented 5 years ago

Hi, I'm currently trying to run this on Ubuntu16.04, I have my OpenNI2 library in /usr/lib/OpenNI2 and the include file is in /usr/include . I modified my FindOpenNI.cmake as such


# - Find OpenNI
# This module defines
#  OpenNI_INCLUDE_DIR, where to find OpenNI include files
#  OpenNI_LIBRARIES, the libraries needed to use OpenNI
#  OpenNI_FOUND, If false, do not try to use OpenNI.
# also defined, but not for general use are
#  OpenNI_LIBRARY, where to find the OpenNI library.

set(OPEN_NI_ROOT "/usr" CACHE FILEPATH "Root directory of OpenNI2")

# Finally the library itself
find_library(OpenNI_LIBRARY
NAMES OpenNI
PATHS "${OPEN_NI_ROOT}/Lib" "C:/Program Files (x86)/OpenNI/Lib" "C:/Program Files/OpenNI/Lib" ${CMAKE_LIB_PATH}
)

find_path(OpenNI_INCLUDE_DIR OpenNI.h PATH "${OPEN_NI_ROOT}/include/openni2")

find_library(OpenNI_LIBRARY OpenNI2 PATH "${OPEN_NI_ROOT}/lib")

# handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if
# all listed variables are TRUE
#include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
#include(${CMAKE_MODULE_PATH}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(OpenNI DEFAULT_MSG OpenNI_LIBRARY OpenNI_INCLUDE_DIR)

if(OPENNI_FOUND)
  set(OpenNI_LIBRARIES ${OpenNI_LIBRARY})
endif()

mark_as_advanced(OpenNI_LIBRARY OpenNI_INCLUDE_DIR)

And then I ran the cmake build with this command cmake /home/muser/Desktop/InfiniTAM-master/InfiniTAM -DOPEN_NI_ROOT=/usr

However, I got an error saying

-- The C compiler identification is GNU 5.4.0 -- The CXX compiler identification is GNU 5.4.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Looking for pthread.h -- Looking for pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - not found -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE
-- /home/muser/Desktop/InfiniTAM-master/InfiniTAM/cmake/cuda_compute_capability.cpp -- Compile: 61 -- compiled -> 0 -- worked -- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so
-- Configuring done -- Generating done CMake Warning: Manually-specified variables were not used by the project:

OPEN_NI_ROOT

-- Build files have been written to: /home/muser/Desktop/InfiniTAM-master/build

How is this so? As far as I know, my path is correct..

sabrinazuraimi commented 5 years ago

By the way, my UseOpenNI.cmake is as below


###################
# UseOpenNI.cmake #
###################

OPTION(WITH_OPENNI "Build with OpenNI support?" OFF)

IF(WITH_OPENNI)
  IF(MSVC_IDE)
    FIND_PATH(OPENNI_ROOT LICENSE HINTS "C:/Program Files/OpenNI2")
  ELSEIF(APPLE)
    FIND_PATH(OPENNI_ROOT primesense-usb.rules HINTS ~/Downloads/OpenNI-MacOSX-x64-2.2)
  ELSEIF("${CMAKE_SYSTEM}" MATCHES "Linux")
    FIND_PATH(OPENNI_ROOT LICENSE HINTS ~/Software/OpenNI2)
  ELSE()
    MESSAGE(FATAL_ERROR "OpenNI not currently set up to work on this platform.")
  ENDIF()

  FIND_PATH(OPENNI_INCLUDE_DIR OpenNI.h HINTS "${OPENNI_ROOT}/include/openni2")
  FIND_LIBRARY(OPENNI_LIBRARY OpenNI2 HINTS "${OPENNI_ROOT}/Bin/x64-Release" "${OPENNI_ROOT}/lib" "${OPENNI_ROOT}/Redist")

  INCLUDE_DIRECTORIES(${OPENNI_INCLUDE_DIR})
ELSE()
  ADD_DEFINITIONS(-DCOMPILE_WITHOUT_OpenNI)
ENDIF()
sgolodetz commented 5 years ago

Are you being bitten by the difference between OPENNI_ROOT and OPEN_NI_ROOT by any chance?

sgolodetz commented 5 years ago

The script is written to find a downloaded and extracted version of OpenNI2, not a centralised one. It might be better if it did something else, but in the short term you can fix it by downloading and extracting OpenNI2 somewhere and setting OPENNI_ROOT to the root folder of that.

sgolodetz commented 5 years ago

Note that FindOpenNI.cmake is never actually used as things stand - so its contents are actually irrelevant to the problem you're having.

sabrinazuraimi commented 5 years ago

Oh yeah, that fixed it, also I forgot to change the boolean for "Build with OpenNI support?" to ON..

sgolodetz commented 5 years ago

That helps too :) Glad it works now!