-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
185 lines (156 loc) · 5.18 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
set(FTAG2_LIB_NAME "ftag2" CACHE STRING "FTag v2 API library name")
option(USE_OPENMP "Enable parallelism with OpenMP" ON)
set(FTAG2_READER_NODELET_NAME "ftag2_reader_nodelet")
set(FTAG2_TRACKER_NODELET_NAME "ftag2_tracker_nodelet")
cmake_minimum_required(VERSION 2.8.3)
project(ftag2)
set(CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS} -g -Wall -O2")
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
ftag2_core
nodelet
dynamic_reconfigure
image_transport
std_msgs
cv_bridge
geometry_msgs
sensor_msgs
visualization_msgs
tf
image_geometry
image_transport
)
find_package(Boost REQUIRED COMPONENTS date_time system thread serialization program_options)
find_package(OpenCV REQUIRED COMPONENTS core imgproc highgui calib3d)
if(USE_OPENMP)
FIND_PACKAGE(OpenMP REQUIRED)
if(OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
else()
message("Could not find OpenMP libraries")
endif()
endif()
#######################################
## Declare ROS messages and services ##
#######################################
#add_message_files(
# DIRECTORY msg
# FILES TagDetection.msg TagDetections.msg ARMarkerFT.msg ARMarkersFT.msg
#)
## Generate services in the 'srv' folder
# add_service_files(
# FILES
# Service1.srv
# )
## Generate added messages and services with any dependencies listed here
#generate_messages(
# DEPENDENCIES
# geometry_msgs sensor_msgs std_msgs
#)
generate_dynamic_reconfigure_options(
cfg/FTag2Reader.cfg
cfg/FTag2Tracker.cfg
)
###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if you package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
INCLUDE_DIRS include
LIBRARIES ${FTAG2_LIB_NAME} ${FTAG2_READER_NODELET_NAME} ${FTAG2_TRACKER_NODELET_NAME}
CATKIN_DEPENDS roscpp rospy ftag2_core nodelet dynamic_reconfigure image_transport cv_bridge std_msgs geometry_msgs sensor_msgs visualization_msgs tf
# DEPENDS system_lib
)
###########
## Build ##
###########
include_directories(
include
${catkin_INCLUDE_DIRS}
)
link_directories(
lib
${OpenCV_LIBRARY_DIRS}
)
FILE ( GLOB COMMON_HEADERS "include/common/*.h*" )
FILE ( GLOB DETECTOR_HEADERS "include/detector/*.h*" )
FILE ( GLOB DECODER_HEADERS "include/decoder/*.h*" )
FILE ( GLOB ENCODER_HEADERS "include/encoder/*.h*" )
FILE ( GLOB TRACKER_HEADERS "include/tracker/*.h*" )
FILE ( GLOB KALMAN_HEADERS "include/kalman/*.h*" )
FILE ( GLOB COMMON_SOURCES "src/common/*.c*" )
FILE ( GLOB DETECTOR_SOURCES "src/detector/*.c*" )
FILE ( GLOB DECODER_SOURCES "src/decoder/*.c*" )
FILE ( GLOB ENCODER_SOURCES "src/encoder/*.c*" )
FILE ( GLOB TRACKER_SOURCES "src/tracker/*.c*" )
FILE ( GLOB KALMAN_SOURCES "src/kalman/*.c*" )
add_library(${FTAG2_LIB_NAME}
${COMMON_SOURCES}
${DETECTOR_SOURCES}
${DECODER_SOURCES}
${ENCODER_SOURCES}
${TRACKER_SOURCES}
${KALMAN_SOURCES}
)
target_link_libraries( ${FTAG2_LIB_NAME}
${OpenCV_LIBRARIES}
)
add_library(${FTAG2_READER_NODELET_NAME} src/ftag2_reader_nodelet.cpp)
target_link_libraries(${FTAG2_READER_NODELET_NAME}
${FTAG2_LIB_NAME}
${OpenCV_LIBRARIES}
${catkin_LIBRARIES}
)
add_dependencies(${FTAG2_READER_NODELET_NAME} ${PROJECT_NAME}_gencfg)
add_library(${FTAG2_TRACKER_NODELET_NAME} src/ftag2_tracker_nodelet.cpp)
target_link_libraries(${FTAG2_TRACKER_NODELET_NAME}
${FTAG2_LIB_NAME}
${OpenCV_LIBRARIES}
${catkin_LIBRARIES}
)
add_dependencies(${FTAG2_TRACKER_NODELET_NAME} ${PROJECT_NAME}_gencfg)
#############
## Install ##
#############
## Mark executable scripts (Python etc.) for installation
## in contrast to setup.py, you can choose the destination
# install(PROGRAMS
# scripts/my_python_script
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )
## Mark executables and/or libraries for installation
install(TARGETS ${FTAG2_LIB_NAME} ${FTAG2_READER_NODELET_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
## Mark cpp header files for installation
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE
)
install(FILES nodelet_plugins.xml
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
install(DIRECTORY launch/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
)
#############
## Testing ##
#############
## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/test_ftag2.cpp)
# if(TARGET ${PROJECT_NAME}-test)
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
# endif()
## Add folders to be run by python nosetests
# catkin_add_nosetests(test)