-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
139 lines (115 loc) · 3.42 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
cmake_minimum_required(VERSION 3.5)
project(ros_ign_bridge)
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra)
endif()
find_package(catkin REQUIRED COMPONENTS
geometry_msgs
rosconsole
roscpp
rostest
sensor_msgs
std_msgs
tf2_msgs
visualization_msgs)
# Fortress
if ("$ENV{IGNITION_VERSION}" STREQUAL "fortress")
find_package(ignition-transport11 REQUIRED)
set(IGN_TRANSPORT_VER ${ignition-transport11_VERSION_MAJOR})
find_package(ignition-msgs8 REQUIRED)
set(IGN_MSGS_VER ${ignition-msgs8_VERSION_MAJOR})
message(STATUS "Compiling against Ignition Fortress")
# Edifice
elseif ("$ENV{IGNITION_VERSION}" STREQUAL "edifice")
find_package(ignition-transport10 REQUIRED)
set(IGN_TRANSPORT_VER ${ignition-transport10_VERSION_MAJOR})
find_package(ignition-msgs7 REQUIRED)
set(IGN_MSGS_VER ${ignition-msgs7_VERSION_MAJOR})
message(STATUS "Compiling against Ignition Edifice")
# Default to Citadel
else()
find_package(ignition-transport8 REQUIRED)
set(IGN_TRANSPORT_VER ${ignition-transport8_VERSION_MAJOR})
find_package(ignition-msgs5 REQUIRED)
set(IGN_MSGS_VER ${ignition-msgs5_VERSION_MAJOR})
message(STATUS "Compiling against Ignition Citadel")
add_definitions(-DIGNITION_CITADEL)
endif()
catkin_package()
include_directories(include ${catkin_INCLUDE_DIRS})
set(common_sources
src/convert.cpp
src/factories.cpp
)
set(bridge_lib
ros_ign_bridge_lib
)
add_library(${bridge_lib}
${common_sources}
)
target_link_libraries(${bridge_lib}
${catkin_LIBRARIES}
ignition-msgs${IGN_MSGS_VER}::core
ignition-transport${IGN_TRANSPORT_VER}::core
)
set(bridge_executables
parameter_bridge
static_bridge
)
foreach(bridge ${bridge_executables})
add_executable(${bridge}
src/${bridge}.cpp
)
target_link_libraries(${bridge}
${bridge_lib}
)
install(TARGETS ${bridge}
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
endforeach(bridge)
catkin_package(INCLUDE_DIRS include
LIBRARIES ${bridge_lib})
install(TARGETS ${bridge_lib}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION})
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})
if(CATKIN_ENABLE_TESTING)
# Tests
find_package(rostest REQUIRED)
set(test_publishers
ign_publisher
ros_publisher
)
set(test_subscribers
ign_subscriber
ros_subscriber
)
foreach(test_publisher ${test_publishers})
add_executable(${test_publisher}
test/publishers/${test_publisher}.cpp
)
target_link_libraries(${test_publisher}
${catkin_LIBRARIES}
ignition-msgs${IGN_MSGS_VER}::core
ignition-transport${IGN_TRANSPORT_VER}::core
gtest
gtest_main
)
endforeach(test_publisher)
foreach(test_subscriber ${test_subscribers})
add_rostest_gtest(test_${test_subscriber}
test/${test_subscriber}.test
test/subscribers/${test_subscriber}.cpp)
target_link_libraries(test_${test_subscriber}
${catkin_LIBRARIES}
ignition-msgs${IGN_MSGS_VER}::core
ignition-transport${IGN_TRANSPORT_VER}::core
)
endforeach(test_subscriber)
endif()