Difference between revisions of "Integrating external libraries"

From Wiki for iCub and Friends
Jump to: navigation, search
(OpenCV)
 
(3 intermediate revisions by 2 users not shown)
Line 5: Line 5:
 
=== OpenCV ===
 
=== OpenCV ===
  
Waiting for notes from Eric...
+
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, with updates from Eric):
 +
 
 +
  PROJECT(kibitzer)
 +
  SET(YARP_DIR "$ENV{YARP_ROOT}" CACHE LOCATION "where is your yarp build directory?")
 +
  FIND_PACKAGE(YARP REQUIRED)<br>
 +
  # This line will tell CMake to look in the project directory for configure scripts
 +
  SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})<br>
 +
  # Adding 'REQUIRED' will cause CMake to stop with an error if a package is not found
 +
  FIND_PACKAGE(OpenCV REQUIRED)<br>
 +
  # The OPENCV_INCLUDE_DIR_CV variable should be enough to find all needed OpenCV headers
 +
  INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} ${OPENCV_INCLUDE_DIR_CV})<br>
 +
  # In addition to specifying the libraries to link, the directories containing the
 +
  # libraries should be added in case the libraries are in a non-standard location
 +
  LINK_DIRECTORIES(${OPENCV_LINK_DIRECTORIES})
 +
  LINK_LIBRARIES(${OPENCV_LIBRARIES})<br>
 +
  ADD_EXECUTABLE(kibitzer main.cpp)
 +
 
 +
----
  
 
=== ImageMagick++ ===
 
=== ImageMagick++ ===
  
 
see example in YARP source code, example/imagemagick
 
see example in YARP source code, example/imagemagick

Latest revision as of 12:16, 24 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, with updates from Eric):

 PROJECT(kibitzer)
 SET(YARP_DIR "$ENV{YARP_ROOT}" CACHE LOCATION "where is your yarp build directory?")
 FIND_PACKAGE(YARP REQUIRED)
# This line will tell CMake to look in the project directory for configure scripts SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
# Adding 'REQUIRED' will cause CMake to stop with an error if a package is not found FIND_PACKAGE(OpenCV REQUIRED)
# The OPENCV_INCLUDE_DIR_CV variable should be enough to find all needed OpenCV headers INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} ${OPENCV_INCLUDE_DIR_CV})
# In addition to specifying the libraries to link, the directories containing the # libraries should be added in case the libraries are in a non-standard location LINK_DIRECTORIES(${OPENCV_LINK_DIRECTORIES}) LINK_LIBRARIES(${OPENCV_LIBRARIES})
ADD_EXECUTABLE(kibitzer main.cpp)

ImageMagick++

see example in YARP source code, example/imagemagick