Skip to content

Commit 5d64d24

Browse files
authored
Merge pull request #2 from Maidbot/bugfix/proper-catkin-package
[Bugfix] Make proper catkin package for use by external packages
2 parents 999e5f7 + dbb7514 commit 5d64d24

File tree

14 files changed

+30
-92
lines changed

14 files changed

+30
-92
lines changed

.gitmodules

Lines changed: 0 additions & 6 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,20 @@ if( POLICY CMP0042 )
4040
cmake_policy(SET CMP0042 NEW)
4141
endif()
4242
project( OpticalFlow )
43+
44+
find_package(catkin REQUIRED COMPONENTS
45+
klt_feature_tracker)
46+
47+
catkin_package(
48+
INCLUDE_DIRS include
49+
CATKIN_DEPENDS klt_feature_tracker
50+
)
51+
52+
include_directories(
53+
include
54+
${catkin_INCLUDE_DIRS}
55+
)
56+
4357
set(version_major 0)
4458
set(version_minor 1)
4559
set(version_patch 0)
@@ -55,15 +69,11 @@ set(${PROJECT_NAME}_INCLUDE_DIRS
5569
find_package( OpenCV REQUIRED )
5670
OPTION(OPENCV "ON for OpenCV" ON) # -DOPENCV=OFF
5771

58-
add_subdirectory( external/klt_feature_tracker klt_feature_tracker )
59-
set( klt_feature_tracker_LIBS "klt_feature_tracker" )
60-
6172
if(OpenCV_FOUND AND OPENCV)
6273
message(STATUS "Building ${PROJECT_NAME} with OpenCV")
6374

6475
set(OpticalFlow_INCLUDE_DIRS
65-
${CMAKE_CURRENT_SOURCE_DIR}/include
66-
${klt_feature_tracker_INCLUDE_DIRS}
76+
${catkin_INCLUDE_DIRS}
6777
${OpenCV_INCLUDE_DIRS}
6878
)
6979

@@ -78,7 +88,7 @@ if(OpenCV_FOUND AND OPENCV)
7888

7989
target_link_libraries( OpticalFlow
8090
${OpenCV_LIBS}
81-
${klt_feature_tracker_LIBS}
91+
${catkin_LIBRARIES}
8292
)
8393
else()
8494
message(STATUS "Building ${PROJECT_NAME} without OpenCV")
@@ -98,24 +108,3 @@ else()
98108
endif()
99109

100110
target_include_directories(OpticalFlow PUBLIC include)
101-
102-
# Generate the Config file from the .in file, doing @VAR@ substitution only
103-
configure_file(OpticalFlowConfig.cmake.in FindOpticalFlow.cmake @ONLY)
104-
105-
# INSTALL STEPS
106-
INSTALL(
107-
TARGETS OpticalFlow
108-
RUNTIME DESTINATION lib
109-
LIBRARY DESTINATION lib)
110-
111-
INSTALL(
112-
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/external/klt_feature_tracker/include/
113-
DESTINATION include)
114-
115-
INSTALL(
116-
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
117-
DESTINATION include)
118-
119-
INSTALL(
120-
FILES ${CMAKE_CURRENT_BINARY_DIR}/FindOpticalFlow.cmake
121-
DESTINATION ${CMAKE_INSTALL_PREFIX})

OpticalFlowConfig.cmake.in

Lines changed: 0 additions & 8 deletions
This file was deleted.

external/klt_feature_tracker

Lines changed: 0 additions & 1 deletion
This file was deleted.
File renamed without changes.

include/flow_opencv.hpp renamed to include/OpticalFlow/flow_opencv.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
#include <opencv2/opencv.hpp>
4545
#include <cmath>
4646

47-
#include "optical_flow.hpp"
48-
#include "trackFeatures.h"
47+
#include "OpticalFlow/optical_flow.hpp"
48+
#include "klt_feature_tracker/trackFeatures.h"
4949

5050
#define DEFAULT_NUMBER_OF_FEATURES 20
5151
#define DEFAULT_CONFIDENCE_MULTIPLIER 1.645f //90% confidence interval

include/flow_px4.hpp renamed to include/OpticalFlow/flow_px4.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@
4040

4141
#pragma once
4242

43-
#include "optical_flow.hpp"
44-
#include "px4flow.hpp"
43+
#include "OpticalFlow/optical_flow.hpp"
44+
#include "OpticalFlow/px4flow.hpp"
4545
#include <memory.h>
46-
#include "constants.hpp"
46+
#include "OpticalFlow/constants.hpp"
4747

4848
class OpticalFlowPX4 : public OpticalFlow
4949
{

include/optical_flow.hpp renamed to include/OpticalFlow/optical_flow.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
#include <stdint.h>
4444
#include <iostream>
4545
#include <cmath>
46-
#include "constants.hpp"
46+
#include "OpticalFlow/constants.hpp"
4747

4848
class OpticalFlow
4949
{
File renamed without changes.

package.xml

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -31,57 +31,21 @@
3131
- POSSIBILITY OF SUCH DAMAGE.
3232
-
3333
-->
34-
<package>
34+
<package format="2">
3535
<name>OpticalFlow</name>
3636
<version>0.0.0</version>
3737
<description>Optical flow package</description>
3838

39-
<!-- One maintainer tag required, multiple allowed, one person per tag -->
40-
<!-- Example: -->
41-
<!-- <maintainer email="[email protected]">Jane Doe</maintainer> -->
4239
<maintainer email="[email protected]">christoph</maintainer>
4340

44-
45-
<!-- One license tag required, multiple allowed, one license per tag -->
46-
<!-- Commonly used license strings: -->
47-
<!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
4841
<license>BSD</license>
4942

43+
<buildtool_depend>catkin</buildtool_depend>
5044

51-
<!-- Url tags are optional, but mutiple are allowed, one per tag -->
52-
<!-- Optional attribute type can be: website, bugtracker, or repository -->
53-
<!-- Example: -->
54-
<!-- <url type="website">http://wiki.ros.org/snap_cam_publisher</url> -->
55-
56-
57-
<!-- Author tags are optional, mutiple are allowed, one per tag -->
58-
<!-- Authors do not have to be maintianers, but could be -->
59-
<!-- Example: -->
60-
<!-- <author email="[email protected]">Jane Doe</author> -->
61-
62-
63-
<!-- The *_depend tags are used to specify dependencies -->
64-
<!-- Dependencies can be catkin packages or system dependencies -->
65-
<!-- Examples: -->
66-
<!-- Use build_depend for packages you need at compile time: -->
67-
<!-- <build_depend>message_generation</build_depend> -->
68-
<!-- Use buildtool_depend for build tool packages: -->
69-
<!-- <buildtool_depend>catkin</buildtool_depend> -->
70-
<!-- Use run_depend for packages you need at runtime: -->
71-
<!-- <run_depend>message_runtime</run_depend> -->
72-
<!-- Use test_depend for packages you need only for testing: -->
73-
<!-- <test_depend>gtest</test_depend> -->
74-
75-
<build_depend>libopencv-dev</build_depend>
76-
<run_depend>libopencv-dev</run_depend>
77-
78-
<build_depend>klt_feature_tracker</build_depend>
79-
<run_depend>klt_feature_tracker</run_depend>
80-
45+
<depend>libopencv-dev</depend>
46+
<depend>klt_feature_tracker</depend>
8147

82-
<!-- The export tag contains other, unspecified, tags -->
8348
<export>
84-
<!-- Other tools can request additional information be placed here -->
8549

8650
</export>
8751
</package>

0 commit comments

Comments
 (0)