Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Build OpenCV and PCL with Cmake

Hello, I am new to Computer Vision and am having trouble to build OpenCV with PCL, i could build PCL alone. Since PCL is developed to be complementary to OpenCV, it is good to call both libraries.

I am using Windows 7 x64, OpenCV 3.2.0, Visual Studio 2017 (MSVC15) and PCL 1.8.0.

The OpenCV installed is the Win Pack, VS is working fine and PCL was installed with the all-in-one pack (http://unanancyowen.com/en/pcl18/#Download). The Enviromental variable used for OpenCV are: "Path" "%OPENCV_DIR%\bin;C:\Program Files\opencv\build\x64\vc14"& "OPENCV_DIR" "C:\Program Files\opencv\build" & "OPENCV_VER" "320" and also OpenCV_DIR, changing to lowercase.

The CmakeLists.txt code is and is a code from the same site as the all-in-one package:

cmake_minimum_required( VERSION 2.8 )
# Create Project
project( solution )
add_executable( project main.cpp )

# Set StartUp Project (Option)
# (This setting is able to enable by using CMake 3.6.0 RC1 or later.)
set_property( DIRECTORY PROPERTY VS_STARTUP_PROJECT "project" )

# Find Packages
# Find PCL
find_package( PCL 1.8 REQUIRED )

# Find OpenCV
set( "OpenCV_DIR" "C:/Program Files/opencv/build" )
find_package( OpenCV REQUIRED )


if( PCL_FOUND AND OpenCV_FOUND )
  # [C/C++]>[General]>[Additional Include Directories]
  include_directories( ${PCL_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS} )

  # [C/C++]>[Preprocessor]>[Preprocessor Definitions]
  add_definitions( ${PCL_DEFINITIONS} )

  # For Use Not PreCompiled Features 
  #add_definitions( -DPCL_NO_PRECOMPILE )

  # [Linker]>[General]>[Additional Library Directories]
  link_directories( ${PCL_LIBRARY_DIRS} ${OpenCV_LIB_DIR})

  # [Linker]>[Input]>[Additional Dependencies]
  target_link_libraries( project ${PCL_LIBRARIES}  ${OpenCV_LIBS} )
endif()

And the log given by the Cmake-gui is:

Boost version: 1.61.0
Found the following Boost libraries:
  system
  filesystem
  thread
  date_time
  iostreams
  serialization
  chrono
  atomic
  regex
Could NOT find openni (missing:  OPENNI_LIBRARY OPENNI_INCLUDE_DIRS) 
** WARNING ** io features related to openni will be disabled
Could NOT find ensenso (missing:  ENSENSO_LIBRARY ENSENSO_INCLUDE_DIR) 
** WARNING ** io features related to ensenso will be disabled
Could NOT find DAVIDSDK (missing:  DAVIDSDK_LIBRARY DAVIDSDK_INCLUDE_DIR) 
** WARNING ** io features related to davidSDK will be disabled
Could NOT find DSSDK (missing:  _DSSDK_LIBRARIES) 
** WARNING ** io features related to dssdk will be disabled
Could NOT find RSSDK (missing:  _RSSDK_LIBRARIES) 
** WARNING ** io features related to rssdk will be disabled
** WARNING ** io features related to pcap will be disabled
** WARNING ** io features related to png will be disabled
Could NOT find openni (missing:  OPENNI_LIBRARY OPENNI_INCLUDE_DIRS) 
** WARNING ** visualization features related to openni will be disabled
Could NOT find ensenso (missing:  ENSENSO_LIBRARY ENSENSO_INCLUDE_DIR) 
** WARNING ** visualization features related to ensenso will be disabled
Could NOT find DAVIDSDK (missing:  DAVIDSDK_LIBRARY DAVIDSDK_INCLUDE_DIR) 
** WARNING ** visualization features related to davidSDK will be disabled
Could NOT find DSSDK (missing:  _DSSDK_LIBRARIES) 
** WARNING ** visualization features related to dssdk will be disabled
Could NOT find RSSDK (missing:  _RSSDK_LIBRARIES) 
** WARNING ** visualization features related to rssdk will be disabled
looking for PCL_COMMON
looking for PCL_OCTREE
looking for PCL_IO
looking for PCL_KDTREE
looking for PCL_SEARCH
looking for PCL_SAMPLE_CONSENSUS
looking for PCL_FILTERS
looking for PCL_2D
looking for PCL_GEOMETRY
looking for PCL_FEATURES
looking for PCL_ML
looking for PCL_SEGMENTATION
looking for PCL_VISUALIZATION
looking for PCL_SURFACE
looking for PCL_REGISTRATION
looking for PCL_KEYPOINTS
looking for PCL_TRACKING
looking for PCL_RECOGNITION
looking for PCL_STEREO
looking for PCL_OUTOFCORE
looking for PCL_PEOPLE
OpenCV ARCH: x86
OpenCV RUNTIME: vc15
OpenCV STATIC: ON
CMake Warning at C:/Program Files/opencv/build/OpenCVConfig.cmake:138 (message):
  Found OpenCV Windows Pack but it has no binaries compatible with your
  configuration.

  You should manually point CMake variable OpenCV_DIR to your build of OpenCV
  library.
Call Stack (most recent call first):
  CMakeLists.txt:16 (find_package)


CMake Error at CMakeLists.txt:16 (find_package):
  Found package configuration file:

    C:/Program Files/opencv/build/OpenCVConfig.cmake

  but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be
  NOT FOUND.


Configuring incomplete, errors occurred!

If changing the OpenCVConfig.cmake line 137:

if(NOT OpenCV_FIND_QUIETLY)
    message(WARNING
"Found OpenCV Windows Pack but it has no binaries compatible with your configuration.
You should manually point CMake variable OpenCV_DIR to your build of OpenCV library."
    )
  endif()
  set(OpenCV_FOUND FALSE)
endif()

To

 if(NOT OpenCV_FIND_QUIETLY)
    message(WARNING
"Found OpenCV Windows Pack but it has no binaries compatible with your configuration.
You should manually point CMake variable OpenCV_DIR to your build of OpenCV library."
    )
  endif()
  set(OpenCV_FOUND TRUE)
endif()

The Cmake log is:

Boost version: 1.61.0
Found the following Boost libraries:
  system
  filesystem
  thread
  date_time
  iostreams
  serialization
  chrono
  atomic
  regex
Could NOT find openni (missing:  OPENNI_LIBRARY OPENNI_INCLUDE_DIRS) 
** WARNING ** io features related to openni will be disabled
Could NOT find ensenso (missing:  ENSENSO_LIBRARY ENSENSO_INCLUDE_DIR) 
** WARNING ** io features related to ensenso will be disabled
Could NOT find DAVIDSDK (missing:  DAVIDSDK_LIBRARY DAVIDSDK_INCLUDE_DIR) 
** WARNING ** io features related to davidSDK will be disabled
Could NOT find DSSDK (missing:  _DSSDK_LIBRARIES) 
** WARNING ** io features related to dssdk will be disabled
Could NOT find RSSDK (missing:  _RSSDK_LIBRARIES) 
** WARNING ** io features related to rssdk will be disabled
** WARNING ** io features related to pcap will be disabled
** WARNING ** io features related to png will be disabled
Could NOT find openni (missing:  OPENNI_LIBRARY OPENNI_INCLUDE_DIRS) 
** WARNING ** visualization features related to openni will be disabled
Could NOT find ensenso (missing:  ENSENSO_LIBRARY ENSENSO_INCLUDE_DIR) 
** WARNING ** visualization features related to ensenso will be disabled
Could NOT find DAVIDSDK (missing:  DAVIDSDK_LIBRARY DAVIDSDK_INCLUDE_DIR) 
** WARNING ** visualization features related to davidSDK will be disabled
Could NOT find DSSDK (missing:  _DSSDK_LIBRARIES) 
** WARNING ** visualization features related to dssdk will be disabled
Could NOT find RSSDK (missing:  _RSSDK_LIBRARIES) 
** WARNING ** visualization features related to rssdk will be disabled
looking for PCL_COMMON
looking for PCL_OCTREE
looking for PCL_IO
looking for PCL_KDTREE
looking for PCL_SEARCH
looking for PCL_SAMPLE_CONSENSUS
looking for PCL_FILTERS
looking for PCL_2D
looking for PCL_GEOMETRY
looking for PCL_FEATURES
looking for PCL_ML
looking for PCL_SEGMENTATION
looking for PCL_VISUALIZATION
looking for PCL_SURFACE
looking for PCL_REGISTRATION
looking for PCL_KEYPOINTS
looking for PCL_TRACKING
looking for PCL_RECOGNITION
looking for PCL_STEREO
looking for PCL_OUTOFCORE
looking for PCL_PEOPLE
OpenCV ARCH: x86
OpenCV RUNTIME: vc15
OpenCV STATIC: ON
CMake Warning at C:/Program Files/opencv/build/OpenCVConfig.cmake:138 (message):
  Found OpenCV Windows Pack but it has no binaries compatible with your
  configuration.

  You should manually point CMake variable OpenCV_DIR to your build of OpenCV
  library.
Call Stack (most recent call first):
  CMakeLists.txt:16 (find_package)


Configuring done
Generating done

However errors still occurs, even if i add the OpenCV_DIR Path manually on the Cmake-gui. How can i fix that? i am strugling with it for a week now.