-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
126 lines (107 loc) · 4.62 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
cmake_minimum_required(VERSION 2.8.3)
project(rtt-gazebo-robot-sim)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
find_package(gazebo REQUIRED)
if(GAZEBO_VERSION)
if(${GAZEBO_VERSION} GREATER 6)
add_definitions(-DGAZEBO_GREATER_6)
endif()
endif()
find_package(OROCOS-RTT REQUIRED COMPONENTS rtt-scripting rtt-typekit)
if (NOT OROCOS-RTT_FOUND)
message (FATAL_ERROR "\nCould not find Orocos-RTT. Please use the shell command\n 'source orocos_toolchain/env.sh' and then run cmake again.")
endif()
include(${OROCOS-RTT_USE_FILE_PATH}/UseOROCOS-RTT.cmake )
set (Eigen_INCLUDE_DIRS "/usr/include/eigen3")
find_package(orocos_kdl REQUIRED)
find_package(Boost COMPONENTS thread REQUIRED)
find_package(srdfdom_advr REQUIRED)
find_package(XBotInterface REQUIRED)
find_package(XBotCoreModel REQUIRED)
find_package(RST-RT REQUIRED)
message(STATUS "RST-RT version: ${RST-RT_VERSION}")
include_directories(BEFORE SYSTEM ${RST-RT_INCLUDE_DIRS})
add_definitions(${RST-RT_CFLAGS})
link_directories(${RST-RT_LIBRARY_DIR} ${RST-RT_LIBRARY_DIRS})
option(DISABLE_INTROSPECTION "Disable introspection features" TRUE)
if (DISABLE_INTROSPECTION)
message(STATUS "###################################################")
message(STATUS "### RTT-CORE-EXTENSIONS Introspection disabled! ###")
message(STATUS "###################################################")
else()
find_package(RTT-CORE-EXTENSIONS 0.2)
if (RTT-CORE-EXTENSIONS_FOUND)
message(STATUS "RTT-CORE-EXTENSIONS_LIBRARIES: ${RTT-CORE-EXTENSIONS_LIBRARIES}")
message(STATUS "RTT-CORE-EXTENSIONS_LIBRARY_DIRS: ${RTT-CORE-EXTENSIONS_LIBRARY_DIRS}")
message(STATUS "RTT-CORE-EXTENSIONS_INCLUDE_DIRS: ${RTT-CORE-EXTENSIONS_INCLUDE_DIRS}")
message(STATUS "##################################################")
message(STATUS "### RTT-CORE-EXTENSIONS Introspection enabled! ###")
message(STATUS "##################################################")
set_property(DIRECTORY ${PROJECT_SOURCE_DIR} APPEND PROPERTY COMPILE_DEFINITIONS USE_INTROSPECTION)
else()
message(STATUS "###################################################")
message(STATUS "### RTT-CORE-EXTENSIONS Introspection disabled! ###")
message(STATUS "###################################################")
endif()
endif()
link_directories(${RTT-CORE-EXTENSIONS_LIBRARY_DIRS})
find_package(PkgConfig REQUIRED)
pkg_search_module(TINYXML REQUIRED tinyxml)
if(NOT TINYXML_INCLUDE_DIR)
find_path("/usr/include" tinyxml.h)
find_library(TINYXML_LIBRARY NAMES tinyxml)
set(TINYXML_LIBRARIES ${TINYXML_LIBRARY})
set(TINYXML_INCLUDE_DIRS ${TINYXML_INCLUDE_DIR})
set(TINYXML_LIBRARY_DIR "/usr/lib/x86_64-linux-gnu")
endif()
message(STATUS "TINYXML_VERSION: ${TINYXML_VERSION}")
include_directories(BEFORE SYSTEM ${TINYXML_INCLUDE_DIRS})
link_directories(${TINYXML_LIBRARY_DIR})
message(STATUS "TINYXML_LIBRARIES: ${TINYXML_LIBRARIES}")
message(STATUS "TINYXML_LIBRARY_DIR: ${TINYXML_LIBRARY_DIR}")
message(STATUS "TINYXML_INCLUDE_DIR: ${TINYXML_INCLUDE_DIRS}")
message(STATUS "TINYXML_LIBRARY: ${TINYXML_LIBRARY}")
include_directories(
include
${Boost_INCLUDE_DIR}
${Eigen_INCLUDE_DIRS}
${orocos_kdl_INCLUDE_DIRS}
${USE_OROCOS_INCLUDE_DIRS}
${GAZEBO_INCLUDE_DIRS}
${RST-RT_INCLUDE_DIRS}
${TINYXML_INCLUDE_DIRS}
${srdfdom_advr_INCLUDE_DIRS}
${XBotInterface_INCLUDE_DIRS}
${RTT-CORE-EXTENSIONS_INCLUDE_DIRS}
${XBotCoreModel_INCLUDE_DIRS}
)
file(GLOB_RECURSE rtt_gazebo_robot_sim_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/include" *.h)
ADD_LIBRARY(gain_parser SHARED src/parser.cpp)
#set_property(TARGET gain_parser APPEND PROPERTY COMPILE_DEFINITIONS RTT_COMPONENT)
TARGET_LINK_LIBRARIES(gain_parser ${TINYXML_LIBRARIES})
orocos_component(${PROJECT_NAME} src/rtt-gazebo-robot-sim.cpp src/rtt-gazebo-robot-sim_hooks.cpp src/kinematic_chain.cpp
src/force_torque_sensor.cpp src/imu.cpp ${rtt_gazebo_robot_sim_INCLUDES})
set_property(TARGET ${PROJECT_NAME} APPEND PROPERTY COMPILE_DEFINITIONS RTT_COMPONENT)
target_link_libraries(${PROJECT_NAME}
gain_parser
${USE_OROCOS_LIBRARIES}
${orocos_kdl_LIBRARIES}
${GAZEBO_LIBRARIES}
${OROCOS-RTT_LIBRARIES}
${Boost_LIBRARIES}
${RST-RT_LIBRARIES}
${TINYXML_LIBRARIES}
${srdfdom_advr_LIBRARIES}
${XBotInterface_LIBRARIES}
${RTT-CORE-EXTENSIONS_LIBRARIES}
${XBotCoreModel_LIBRARIES}
)
install (TARGETS gain_parser
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
orocos_generate_package(INCLUDE_DIRS include)
#######################
# Add Testing target #
#######################
enable_testing()
add_subdirectory(tests)