Skip to content

Commit

Permalink
Merge pull request ekumenlabs#24 from Intermodalics/fix-opencv-linking
Browse files Browse the repository at this point in the history
Fix opencv linker errors
  • Loading branch information
Juan Ignacio Ubeira authored Nov 28, 2018
2 parents 7c4cc91 + e5a956c commit 28cc893
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 40 deletions.
5 changes: 2 additions & 3 deletions do_everything.sh
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,8 @@ if [[ $skip -ne 1 ]] ; then
# https://source.android.com/reference/com/android/tradefed/testtype/GTest.html
# apply_patch $my_loc/patches/camera_info_manager.patch

# Patch cv_bridge - remove Python dependencies
# TODO: https://github.com/ros-perception/vision_opencv/pull/55 merged, need to wait until new version (current 1.11.7)
# apply_patch $my_loc/patches/cv_bridge.patch
# Patch cv_bridge - fix transitive linking in cv_bridge-extras.cmake
apply_patch $my_loc/patches/cv_bridge.patch

# Patch robot_pose_ekf - Add bfl library cmake variables, also, remove tests
# TODO: The correct way to handle this would be to create .cmake files for bfl and do a findpackage(orocos-bfl)
Expand Down
69 changes: 32 additions & 37 deletions patches/cv_bridge.patch
Original file line number Diff line number Diff line change
@@ -1,39 +1,34 @@
--- catkin_ws/src/vision_opencv/cv_bridge/CMakeLists.txt 2014-12-16 13:23:41.106085276 -0300
+++ catkin_ws/src/vision_opencv/cv_bridge/CMakeLists.txt 2014-12-16 13:25:29.358088880 -0300
@@ -3,7 +3,11 @@
--- catkin_ws/src/vision_opencv/cv_bridge/CMakeLists.txt
+++ catkin_ws/src/vision_opencv/cv_bridge/CMakeLists.txt
@@ -25,7 +25,6 @@ catkin_package(
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME}
CATKIN_DEPENDS rosconsole sensor_msgs
- DEPENDS OpenCV
CFG_EXTRAS cv_bridge-extras.cmake
)

find_package(catkin REQUIRED COMPONENTS rosconsole sensor_msgs)
--- catkin_ws/src/vision_opencv/cv_bridge/cmake/cv_bridge-extras.cmake.in
+++ catkin_ws/src/vision_opencv/cv_bridge/cmake/cv_bridge-extras.cmake.in
@@ -1,12 +1,7 @@
-set(OpenCV_VERSION @OpenCV_VERSION@)
-set(OpenCV_VERSION_MAJOR @OpenCV_VERSION_MAJOR@)
-set(OpenCV_VERSION_MINOR @OpenCV_VERSION_MINOR@)
-set(OpenCV_VERSION_PATCH @OpenCV_VERSION_PATCH@)
-set(OpenCV_SHARED @OpenCV_SHARED@)
-set(OpenCV_CONFIG_PATH @OpenCV_CONFIG_PATH@)
-set(OpenCV_INSTALL_PATH @OpenCV_INSTALL_PATH@)
-set(OpenCV_LIB_COMPONENTS @OpenCV_LIB_COMPONENTS@)
-set(OpenCV_USE_MANGLED_PATHS @OpenCV_USE_MANGLED_PATHS@)
-set(OpenCV_MODULES_SUFFIX @OpenCV_MODULES_SUFFIX@)
-
+find_package(OpenCV 3 REQUIRED
+ COMPONENTS
+ opencv_core
+ opencv_imgproc
+ opencv_imgcodecs
+ CONFIG
+)

+if(NOT ANDROID)
find_package(Boost REQUIRED python)
+else()
+find_package(Boost REQUIRED)
+endif()
find_package(OpenCV REQUIRED)
if (OpenCV_VERSION VERSION_EQUAL "3")
add_definitions("-DOPENCV3=1")
@@ -21,7 +25,9 @@
include_directories(SYSTEM ${Boost_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS})
include_directories(include ${catkin_INCLUDE_DIRS})

+if(NOT ANDROID)
add_subdirectory(python)
+endif()
add_subdirectory(src)
if(CATKIN_ENABLE_TESTING)
add_subdirectory(test)
--- catkin_ws/src/vision_opencv/cv_bridge/src/CMakeLists.txt 2014-12-12 14:16:26.261088783 -0300
+++ catkin_ws/src/vision_opencv/cv_bridge/src/CMakeLists.txt 2014-12-12 14:17:17.117087617 -0300
@@ -5,6 +5,7 @@

install(TARGETS ${PROJECT_NAME} DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})

+if(NOT ANDROID)
# add a Boost Python library
find_package(PythonInterp REQUIRED)
find_package(PythonLibs "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
@@ -54,3 +55,4 @@
endif()

install(TARGETS ${PROJECT_NAME}_boost DESTINATION ${CATKIN_PACKAGE_PYTHON_DESTINATION}/boost/)
+endif()
+list(APPEND @PROJECT_NAME@_LIBRARIES ${OpenCV_LIBRARIES})
+list(APPEND @PROJECT_NAME@_INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS})
14 changes: 14 additions & 0 deletions patches/opencv.patch
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,17 @@

# ----------------------------------------------------------------------------
# Finalization: generate configuration-based files
@@ -850,11 +845,11 @@
if(ANDROID OR NOT UNIX)
install(FILES ${OPENCV_LICENSE_FILE}
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ
- DESTINATION ./ COMPONENT libs)
+ DESTINATION ${OPENCV_OTHER_INSTALL_PATH} COMPONENT libs)
if(OPENCV_README_FILE)
install(FILES ${OPENCV_README_FILE}
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ
- DESTINATION ./ COMPONENT libs)
+ DESTINATION ${OPENCV_OTHER_INSTALL_PATH} COMPONENT libs)
endif()
endif()

0 comments on commit 28cc893

Please sign in to comment.