Difference between revisions of "Integrating external libraries"

From Wiki for iCub and Friends
Jump to: navigation, search
(OpenCV)
Line 11: Line 11:
 
   #define YARP_CVTYPES_H_
 
   #define YARP_CVTYPES_H_
  
This will prevent YARP's local copy of the IPL types conflicting with OpenCV.  The two are the same.
+
This will prevent YARP's local copy of the IPL types conflicting with OpenCV.  The two are the same. An example CMakeLists.txt (from Joerg):
 +
 
 +
  PROJECT(kibitzer)
 +
  SET(YARP_DIR "$ENV{YARP_ROOT}" CACHE LOCATION "where is your yarp build directory?")
 +
  FIND_PACKAGE(YARP)
 +
  SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
 +
  FIND_PACKAGE(OpenCV)
 +
  INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} ${OPENCV_INCLUDE_DIR_CV})
 +
  LINK_LIBRARIES(${OPENCV_LIBRARY})
 +
  ADD_EXECUTABLE(kibitzer main.cpp)
  
 
=== ImageMagick++ ===
 
=== ImageMagick++ ===
  
 
see example in YARP source code, example/imagemagick
 
see example in YARP source code, example/imagemagick

Revision as of 15:50, 20 July 2006

Notes on integrating external libraries in a CMake project.

OpenCV

Eric has commited a "FindOpenCV.cmake" script in:

 iCub/src/vvv/emislive/CMakeModules

If you include opencv and yarp/sig header files in the same file, make sure you put the following line at the top of your program:

 #define YARP_CVTYPES_H_

This will prevent YARP's local copy of the IPL types conflicting with OpenCV. The two are the same. An example CMakeLists.txt (from Joerg):

 PROJECT(kibitzer)
 SET(YARP_DIR "$ENV{YARP_ROOT}" CACHE LOCATION "where is your yarp build directory?")
 FIND_PACKAGE(YARP)
 SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
 FIND_PACKAGE(OpenCV)
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} ${OPENCV_INCLUDE_DIR_CV})
 LINK_LIBRARIES(${OPENCV_LIBRARY})
 ADD_EXECUTABLE(kibitzer main.cpp)

ImageMagick++

see example in YARP source code, example/imagemagick