-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
168 lines (145 loc) · 3.28 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
cmake_minimum_required(VERSION 2.8.3)
project(dhaiba_ros)
set(${PROJECT_NAME}_VERSION 1.0.0)
## Compile as C++14
add_compile_options(-w)
add_compile_options(-std=c++14)
add_compile_options(-fpermissive)
add_compile_options(-pthread)
add_compile_options(-O2)
find_package(PkgConfig REQUIRED)
pkg_check_modules(URDFDOM urdfdom REQUIRED)
find_package(catkin REQUIRED
COMPONENTS
roscpp
roslib
geometry_msgs
tf2_ros
tf2_geometry_msgs
pybind11_catkin
)
set(CMAKE_MODULE_PATH $ENV{CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR})
find_package(DhaibaConnectN REQUIRED)
if (${DhaibaConnectN_FOUND})
message(STATUS "DhaibaConnectN found")
message(STATUS "DhaibaConnectN_INCLUDE_DIR: ${DhaibaConnectN_INCLUDE_DIR}")
message(STATUS "DhaibaConnectN_LIBRARY: ${DhaibaConnectN_LIBRARY}")
else()
set( DhaibaConnectN_INCLUDE_DIR /usr/local/include/Dhaiba )
set( DhaibaConnectN_LIBRARY DhaibaConnectN )
message(STATUS "DhaibaConnectN not found")
message(STATUS "DhaibaConnectN_INCLUDE_DIR: ${DhaibaConnectN_INCLUDE_DIR}")
message(STATUS "DhaibaConnectN_LIBRARY: ${DhaibaConnectN_LIBRARY}")
endif()
add_definitions(-DVERSION_INFO=\"${PROJECT_NAME}_VERSION\")
add_definitions(-DLIBRARY_NAME=${PROJECT_NAME})
add_definitions(-D__MY_TEST__ -g -Wall)
if (NOT "${PROJECT_NAME}_BUILDTOOL_DEPENDS")
set(${PROJECT_NAME}_BUILDTOOL_DEPENDS "catkin")
endif()
###########
## Build ##
###########
include_directories(
${catkin_INCLUDE_DIRS}
${URDFDOM_INCLUDE_DIRS}
${DhaibaConnectN_INCLUDE_DIR}
)
catkin_package(
CATKIN_DEPENDS
roscpp
geometry_msgs
LIBRARIES
${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_PYTHON_DESTINATION}/${PROJECT_NAME}.so
)
catkin_package(
LIBRARIES
CATKIN_DEPENDS
pybind11_catkin
)
#
# urdf_publisher
#
add_executable(
urdf_publisher
src/urdf_publisher.cpp
)
add_dependencies(
urdf_publisher
${${PREOJECT_NAME}_EXPORTED_TARGETS}
${catkin_EXPORTED_TARGETS}
)
target_link_libraries(
urdf_publisher
${catkin_LIBRARIES}
${roscpp_LIBRARIES}
${URDFDOM_LIBRARIES}
${DhaibaConnectN_LIBRARY}
)
#
# test_note_pub
#
add_executable(
test_note_pub
src/test_note_pub.cpp
src/dhaiba_note.cpp
)
add_dependencies(
test_note_pub
${${PREOJECT_NAME}_EXPORTED_TARGETS}
${catkin_EXPORTED_TARGETS}
)
target_link_libraries(
test_note_pub
${catkin_LIBRARIES}
${roscpp_LIBRARIES}
${DhaibaConnectN_LIBRARY}
)
#
# test_note_sub
#
add_executable(
test_note_sub
src/test_note_sub.cpp
src/dhaiba_note.cpp
)
add_dependencies(
test_note_sub
${${PREOJECT_NAME}_EXPORTED_TARGETS}
${catkin_EXPORTED_TARGETS}
)
target_link_libraries(
test_note_sub
${catkin_LIBRARIES}
${roscpp_LIBRARIES}
${DhaibaConnectN_LIBRARY}
)
#
# pybind11 module
#
pybind_add_module(
${PROJECT_NAME} MODULE
src/dhaiba_note.cpp
)
target_link_libraries(
${PROJECT_NAME} PRIVATE
${DhaibaConnectN_LIBRARY}
)
#############
## Install ##
#############
install(
TARGETS
urdf_publisher test_note_pub test_note_sub ${PROJECT_NAME}
ARCHIVE
DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
RUNTIME
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
catkin_install_python(
PROGRAMS
scripts/dhaiba_bridge.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)