forked from youbot/youbot_driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
220 lines (190 loc) · 8.13 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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# Catkin User Guide: http://www.ros.org/doc/groovy/api/catkin/html/user_guide/user_guide.html
# Catkin CMake Standard: http://www.ros.org/doc/groovy/api/catkin/html/user_guide/standards.html
cmake_minimum_required(VERSION 2.8.3)
project(youbot_driver)
# Load catkin and all dependencies required for this package
# TODO: remove all from COMPONENTS that are not catkin packages.
find_package(catkin REQUIRED COMPONENTS roscpp)
# include_directories(include ${Boost_INCLUDE_DIR} ${catkin_INCLUDE_DIRS})PROJECT(YouBot_Driver)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
OPTION(USE_ROS "Enable ROS as compile tool" OFF)
########### ROS ###########
SET(ROS_ROOT_PATH $ENV{ROS_ROOT})
IF(DEFINED ROS_ROOT_PATH AND USE_ROS MATCHES ON)
# CATKIN_MIGRATION: removed during catkin migration
# include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
# CATKIN_MIGRATION: removed during catkin migration
# rosbuild_init()
ADD_DEFINITIONS(-DUSE_ROS_LOGGING)
ENDIF(DEFINED ROS_ROOT_PATH AND USE_ROS MATCHES ON)
########### cmake configuration and compiler flags ###########
SET(CMAKE_BUILD_TYPE Release)
SET(CMAKE_C_FLAGS_DEBUG "-fPIC -Wall -g")
SET(CMAKE_CXX_FLAGS_DEBUG "-fPIC -Wall -g")
SET(CMAKE_C_FLAGS_RELEASE "-fPIC -Wall")
SET(CMAKE_CXX_FLAGS_RELEASE "-fPIC -Wall")
SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake-modules")
SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) #static libraries
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) #executables
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib) #dynamic libraries (plugins)
# find required and optional dependencies
########### Boost ###########
#SET(Boost_USE_STATIC_LIBS ON)
SET(Boost_ADDITIONAL_VERSIONS "1.39" "1.39.0" "1.40" "1.40.0" "1.41" "1.41.0" "1.42" "1.42.0")
FIND_PACKAGE(Boost REQUIRED COMPONENTS thread date_time filesystem system regex)
IF (Boost_FOUND)
LINK_LIBRARIES(boost_thread boost_date_time boost_filesystem boost_system boost_regex)
MESSAGE(STATUS "SUCCESSFUL: Boost found")
ELSE (Boost_FOUND)
MESSAGE(STATUS "ERROR: Boost not found")
ENDIF (Boost_FOUND)
########### Doxygen ###########
SET(DOXYFILE_LATEX "NO")
SET(DOXYFILE_OUTPUT_DIR ${PROJECT_SOURCE_DIR}/doc)
include(UseDoxygen)
########### Simple Open EtherCAT Master Library ###########
add_subdirectory(soem)
INCLUDE_DIRECTORIES(
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/soem/src
)
########### CppUnit and tests ###########
FIND_PACKAGE(CppUnit)
IF(CppUnit_FOUND)
MESSAGE(STATUS "SUCCESSFUL: CPP_UNIT found")
add_subdirectory(testing)
#ELSE(CppUnit_FOUND)
# MESSAGE(STATUS "WARNING: CPP_UNIT not found")
ENDIF (CppUnit_FOUND)
########### youBot display example application ###########
add_subdirectory(display)
SET(YOUBOT_DRIVER_SRC
${PROJECT_SOURCE_DIR}/youbot/EthercatMaster.cpp
${PROJECT_SOURCE_DIR}/youbot/EthercatMasterWithThread.cpp
${PROJECT_SOURCE_DIR}/youbot/EthercatMasterWithoutThread.cpp
${PROJECT_SOURCE_DIR}/generic/Logger.cpp
${PROJECT_SOURCE_DIR}/generic/ConfigFile.cpp
${PROJECT_SOURCE_DIR}/generic/PidController.cpp
${PROJECT_SOURCE_DIR}/generic-joint/JointData.cpp
${PROJECT_SOURCE_DIR}/generic-joint/JointTrajectory.cpp
${PROJECT_SOURCE_DIR}/youbot/YouBotJoint.cpp
${PROJECT_SOURCE_DIR}/youbot/JointLimitMonitor.cpp
${PROJECT_SOURCE_DIR}/youbot/YouBotBase.cpp
${PROJECT_SOURCE_DIR}/youbot/YouBotManipulator.cpp
${PROJECT_SOURCE_DIR}/youbot/YouBotGripper.cpp
${PROJECT_SOURCE_DIR}/youbot/YouBotGripperBar.cpp
${PROJECT_SOURCE_DIR}/youbot/YouBotGripperParameter.cpp
${PROJECT_SOURCE_DIR}/youbot/DataTrace.cpp
${PROJECT_SOURCE_DIR}/youbot/GripperDataTrace.cpp
${PROJECT_SOURCE_DIR}/youbot/YouBotJointParameter.cpp
${PROJECT_SOURCE_DIR}/youbot/YouBotJointParameterReadOnly.cpp
${PROJECT_SOURCE_DIR}/youbot/YouBotJointParameterPasswordProtected.cpp
${PROJECT_SOURCE_DIR}/youbot/JointTrajectoryController.cpp
${PROJECT_SOURCE_DIR}/base-kinematic/FourSwedishWheelOmniBaseKinematic.cpp
${PROJECT_SOURCE_DIR}/base-kinematic/FourSwedishWheelOmniBaseKinematicConfiguration.cpp
)
SET(YOUBOT_DRIVER_HEADERS
youbot/EthercatMaster.hpp
youbot/EthercatMasterInterface.hpp
youbot/EthercatMasterWithThread.hpp
youbot/EthercatMasterWithoutThread.hpp
youbot/YouBotGripper.hpp
youbot/YouBotGripperBar.hpp
youbot/YouBotGripperParameter.hpp
youbot/YouBotBase.hpp
youbot/YouBotManipulator.hpp
youbot/YouBotJoint.hpp
youbot/JointLimitMonitor.hpp
youbot/YouBotJointParameterReadOnly.hpp
youbot/YouBotJointParameterPasswordProtected.hpp
youbot/YouBotJointParameter.hpp
youbot/YouBotSlaveMailboxMsg.hpp
youbot/YouBotSlaveMsg.hpp
youbot/ProtocolDefinitions.hpp
youbot/YouBotJointStorage.hpp
youbot/DataTrace.hpp
youbot/GripperDataTrace.hpp
youbot/JointTrajectoryController.hpp
base-kinematic/FourSwedishWheelOmniBaseKinematic.hpp
base-kinematic/FourSwedishWheelOmniBaseKinematicConfiguration.hpp
base-kinematic/WheeledBaseKinematic.hpp
generic/Exceptions.hpp
generic/Logger.hpp
generic/Time.hpp
generic/Units.hpp
generic/ConfigFile.hpp
generic/PidController.hpp
generic/dataobjectlockfree/DataObjectLockFree.hpp
generic/dataobjectlockfree/target.hpp
generic/dataobjectlockfree/os/oro_arch.h
generic/dataobjectlockfree/os/oro_gcc/oro_arch.h
generic/dataobjectlockfree/os/oro_i386/oro_arch.h
generic/dataobjectlockfree/os/oro_msvc/oro_arch.h
generic/dataobjectlockfree//os/oro_powerpc/oro_arch.h
generic/dataobjectlockfree/os/oro_powerpc/oro_atomic.h
generic/dataobjectlockfree/os/oro_powerpc/oro_system.h
generic/dataobjectlockfree/os/oro_x86_64/oro_arch.h
generic-gripper/Gripper.hpp
generic-gripper/GripperData.hpp
generic-gripper/GripperParameter.hpp
generic-joint/Joint.hpp
generic-joint/JointData.hpp
generic-joint/JointTrajectory.hpp
generic-joint/JointParameter.hpp
one-dof-gripper/OneDOFGripper.hpp
one-dof-gripper/OneDOFGripperData.hpp
)
SET(YOUBOT_DRIVER_CONFIG
${PROJECT_SOURCE_DIR}/config/youbot-ethercat.cfg
${PROJECT_SOURCE_DIR}/config/youbot-base.cfg
${PROJECT_SOURCE_DIR}/config/youbot-manipulator.cfg
)
IF(DEFINED ROS_ROOT_PATH AND USE_ROS MATCHES ON)
add_library(YouBotDriver ${YOUBOT_DRIVER_SRC})
ELSE(DEFINED ROS_ROOT_PATH AND USE_ROS MATCHES ON)
ADD_LIBRARY(YouBotDriver ${YOUBOT_DRIVER_SRC})
ENDIF(DEFINED ROS_ROOT_PATH AND USE_ROS MATCHES ON)
TARGET_LINK_LIBRARIES(YouBotDriver soem)
ADD_LIBRARY(YouBotDriverShared SHARED "")
SET_TARGET_PROPERTIES(YouBotDriverShared PROPERTIES OUTPUT_NAME "YouBotDriver")
SET_TARGET_PROPERTIES(YouBotDriverShared PROPERTIES LINKER_LANGUAGE CXX)
TARGET_LINK_LIBRARIES(YouBotDriverShared -Wl,-whole-archive YouBotDriver soem -Wl,-no-whole-archive)
MACRO(INSTALL_HEADERS_WITH_DIRECTORY HEADER_LIST)
FOREACH(HEADER ${${HEADER_LIST}})
STRING(REGEX MATCH "(.*)[/\\]" DIR ${HEADER})
INSTALL(FILES ${HEADER} DESTINATION include/youbot/youbot/${DIR})
ENDFOREACH(HEADER)
ENDMACRO(INSTALL_HEADERS_WITH_DIRECTORY)
MACRO(INSTALL_CONFIG_WITH_DIRECTORY CONFIG_LIST)
FOREACH(CONFIG ${${CONFIG_LIST}})
STRING(REGEX MATCH "(.*)[/\\]" DIR ${CONFIG})
INSTALL(FILES ${CONFIG} DESTINATION config)
ENDFOREACH(CONFIG)
ENDMACRO(INSTALL_CONFIG_WITH_DIRECTORY)
INSTALL_HEADERS_WITH_DIRECTORY(YOUBOT_DRIVER_HEADERS)
INSTALL_CONFIG_WITH_DIRECTORY(YOUBOT_DRIVER_CONFIG)
INSTALL(TARGETS YouBotDriver YouBotDriverShared RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
#ADD_EXECUTABLE(YouBot_test
# ${PROJECT_SOURCE_DIR}/Test_commutation.cpp
#)
#target_link_libraries(YouBot_test YouBotDriver)
## Generate added messages and services with any dependencies listed here
#generate_messages(
# #TODO DEPENDENCIES geometry_msgs std_msgs
#)
# catkin_package parameters: http://ros.org/doc/groovy/api/catkin/html/dev_guide/generated_cmake_api.html#catkin-package
# TODO: fill in what other packages will need to use this package
catkin_package(
DEPENDS roscpp boost-all
CATKIN_DEPENDS # TODO
INCLUDE_DIRS ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/soem/src
LIBRARIES YouBotDriver# TODO
)
install(DIRECTORY ${PROJECT_SOURCE_DIR}
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/soem/src
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE)