From aaa409602452f1e4e9cb5a8a2a28b531cb6efcfd Mon Sep 17 00:00:00 2001 From: Jeremie Deray <todo@stuff.com> Date: Sat, 15 Jul 2017 11:32:34 +0200 Subject: [PATCH] fix compilation without opencv --- src/CMakeLists.txt | 12 ++++++++---- src/ceres_wrapper/create_auto_diff_cost_function.cpp | 10 +++++++--- src/examples/CMakeLists.txt | 6 ++++-- src/test/CMakeLists.txt | 7 ++++--- 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4bebb8f68..0ddae8bea 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -199,7 +199,6 @@ SET(HDRS constraint_container.h constraint_corner_2D.h constraint_epipolar.h - constraint_AHP.h constraint_imu.h constraint_fix.h constraint_fix_3D.h @@ -222,7 +221,6 @@ SET(HDRS frame_imu.h landmark_corner_2D.h landmark_container.h - landmark_point_3d.h landmark_line_2D.h landmark_polyline_2D.h local_parametrization_polyline_extreme.h @@ -291,7 +289,6 @@ SET(SRCS frame_imu.cpp landmark_corner_2D.cpp landmark_container.cpp - landmark_point_3d.cpp landmark_line_2D.cpp landmark_polyline_2D.cpp local_parametrization_polyline_extreme.cpp @@ -373,8 +370,10 @@ IF (OpenCV_FOUND) SET(HDRS ${HDRS} active_search.h capture_image.h + constraint_AHP.h feature_point_image.h landmark_AHP.h + landmark_point_3d.h processor_image_feature.h processor_image_landmark.h ) @@ -383,6 +382,7 @@ IF (OpenCV_FOUND) capture_image.cpp feature_point_image.cpp landmark_AHP.cpp + landmark_point_3d.cpp processor_image_feature.cpp processor_image_landmark.cpp ) @@ -401,7 +401,6 @@ IF(YAMLCPP_FOUND) # sources SET(SRCS ${SRCS} - yaml/processor_image_yaml.cpp yaml/processor_odom_3D_yaml.cpp yaml/sensor_camera_yaml.cpp yaml/sensor_odom_3D_yaml.cpp @@ -411,6 +410,11 @@ IF(YAMLCPP_FOUND) yaml/sensor_laser_2D_yaml.cpp ) ENDIF(laser_scan_utils_FOUND) + IF(OpenCV_FOUND) + SET(SRCS ${SRCS} + yaml/processor_image_yaml.cpp + ) + ENDIF(OpenCV_FOUND) ENDIF(YAMLCPP_FOUND) # create the shared library diff --git a/src/ceres_wrapper/create_auto_diff_cost_function.cpp b/src/ceres_wrapper/create_auto_diff_cost_function.cpp index 545f03166..4c93aae48 100644 --- a/src/ceres_wrapper/create_auto_diff_cost_function.cpp +++ b/src/ceres_wrapper/create_auto_diff_cost_function.cpp @@ -20,7 +20,11 @@ #include "../constraint_point_2D.h" #include "../constraint_point_to_line_2D.h" #include "../constraint_container.h" -#include "../constraint_AHP.h" + +#ifdef CV_VERSION + #include "../constraint_AHP.h" +#endif + #include "../constraint_imu.h" // Wolf and ceres auto_diff creators @@ -98,7 +102,7 @@ ceres::CostFunction* createAutoDiffCostFunction(ConstraintBasePtr _ctr_ptr, bool return createAutoDiffCostFunctionWrapper<ConstraintPointToLine2D>(_ctr_ptr); else return createAutoDiffCostFunctionCeres<ConstraintPointToLine2D>(_ctr_ptr); - +#ifdef CV_VERSION case CTR_EPIPOLAR: if (_use_wolf_autodiff) return createAutoDiffCostFunctionWrapper<ConstraintAHP>(_ctr_ptr); @@ -110,7 +114,7 @@ ceres::CostFunction* createAutoDiffCostFunction(ConstraintBasePtr _ctr_ptr, bool return createAutoDiffCostFunctionWrapper<ConstraintAHP>(_ctr_ptr); else return createAutoDiffCostFunctionCeres<ConstraintAHP>(_ctr_ptr); - +#endif case CTR_IMU: if (_use_wolf_autodiff) return createAutoDiffCostFunctionWrapper<ConstraintIMU>(_ctr_ptr); diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt index f898a9d3b..3aadcc853 100644 --- a/src/examples/CMakeLists.txt +++ b/src/examples/CMakeLists.txt @@ -137,8 +137,10 @@ ENDIF(OpenCV_FOUND) IF(Ceres_FOUND) # Simple AHP test - ADD_EXECUTABLE(test_simple_AHP test_simple_AHP.cpp) - TARGET_LINK_LIBRARIES(test_simple_AHP ${PROJECT_NAME}) + IF(OpenCV_FOUND) + ADD_EXECUTABLE(test_simple_AHP test_simple_AHP.cpp) + TARGET_LINK_LIBRARIES(test_simple_AHP ${PROJECT_NAME}) + ENDIF(OpenCV_FOUND) ENDIF(Ceres_FOUND) # Processor Tracker Feature test diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt index 895990fb0..7680d9f62 100644 --- a/src/test/CMakeLists.txt +++ b/src/test/CMakeLists.txt @@ -111,6 +111,7 @@ wolf_add_gtest(gtest_odom_3D gtest_odom_3D.cpp) target_link_libraries(gtest_odom_3D ${PROJECT_NAME}) # ROI test -wolf_add_gtest(gtest_roi_ORB gtest_roi_ORB.cpp) -target_link_libraries(gtest_roi_ORB ${PROJECT_NAME}) - +IF(OpenCV_FOUND) + wolf_add_gtest(gtest_roi_ORB gtest_roi_ORB.cpp) + target_link_libraries(gtest_roi_ORB ${PROJECT_NAME}) +ENDIF(OpenCV_FOUND) -- GitLab