-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
122 lines (105 loc) · 3.04 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
cmake_minimum_required(VERSION 2.8.3)
project(rosflight)
set(CMAKE_BUILD_TYPE Release)
message("CMAKE_C_FLAGS_RELEASE is ${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS "-std=c++0x")
find_package(catkin REQUIRED COMPONENTS
roscpp
eigen_stl_containers
geometry_msgs
rosflight_msgs
sensor_msgs
nav_msgs
std_msgs
std_srvs
tf
)
find_package(Boost REQUIRED COMPONENTS system thread)
find_package(Eigen3 REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(YAML_CPP REQUIRED yaml-cpp)
## Look for and clone MAVLINK if it is missing
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/include/rosflight/mavlink/v1.0/.git")
message(STATUS "MAVLink submodule not found at ${CMAKE_CURRENT_SOURCE_DIR}/include/rosflight/mavlink/v1.0")
execute_process(
COMMAND git submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endif()
###################################
## catkin specific configuration ##
###################################
catkin_package(
INCLUDE_DIRS include
LIBRARIES mavrosflight
CATKIN_DEPENDS roscpp nav_msgs geometry_msgs rosflight_msgs sensor_msgs std_msgs tf
DEPENDS Boost EIGEN3 YAML_CPP tf
)
###########
## Build ##
###########
include_directories(include)
include_directories(
${catkin_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIRS}
${YAML_CPP_INCLUDEDIR}
)
# mavrosflight library
add_library(mavrosflight
src/mavrosflight/mavrosflight.cpp
src/mavrosflight/mavlink_comm.cpp
src/mavrosflight/mavlink_serial.cpp
src/mavrosflight/mavlink_udp.cpp
src/mavrosflight/param_manager.cpp
src/mavrosflight/param.cpp
src/mavrosflight/time_manager.cpp
)
add_dependencies(mavrosflight ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(mavrosflight
${catkin_LIBRARIES}
${Boost_LIBRARIES}
${YAML_CPP_LIBRARIES}
)
# rosflight_io_node
add_executable(rosflight_io
src/rosflight_io_node.cpp
src/rosflight_io.cpp
)
add_dependencies(rosflight_io ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(rosflight_io
mavrosflight
${catkin_LIBRARIES}
${Boost_LIBRARES}
)
add_executable(vrpn2odom
src/vrpn2odom.cpp
)
add_dependencies(vrpn2odom ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(vrpn2odom
${catkin_LIBRARIES}
)
add_executable(calibrate_mag
src/mag_cal_node.cpp
src/mag_cal.cpp
)
add_dependencies(calibrate_mag ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(calibrate_mag
${catkin_LIBRARIES}
${Boost_LIBRARIES}
)
#############
## Install ##
#############
# Mark executables and libraries for installation
install(TARGETS mavrosflight rosflight_io
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/rosflight/mavrosflight/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE
)