|
3 | 3 | # Author: Florent Lamiraux, Nirmal Giftsun, Guilhem Saurel
|
4 | 4 | #
|
5 | 5 |
|
6 |
| -CMAKE_MINIMUM_REQUIRED(VERSION 3.1) |
| 6 | +cmake_minimum_required(VERSION 3.1) |
7 | 7 |
|
8 | 8 | # Project properties
|
9 |
| -SET(PROJECT_ORG stack-of-tasks) |
10 |
| -SET(PROJECT_NAME dynamic_graph_bridge) |
11 |
| -SET(PROJECT_DESCRIPTION "Dynamic graph bridge library") |
12 |
| -SET(PROJECT_URL "https://github.com/${PROJECT_ORG}/${PROJECT_NAME}") |
| 9 | +set(PROJECT_ORG stack-of-tasks) |
| 10 | +set(PROJECT_NAME dynamic_graph_bridge) |
| 11 | +set(PROJECT_DESCRIPTION "Dynamic graph bridge library") |
| 12 | +set(PROJECT_URL "https://github.com/${PROJECT_ORG}/${PROJECT_NAME}") |
13 | 13 |
|
14 | 14 | # Project options
|
15 |
| -OPTION(BUILD_PYTHON_INTERFACE "Build the python bindings" ON) |
| 15 | +option(BUILD_PYTHON_INTERFACE "Build the python bindings" ON) |
16 | 16 |
|
17 | 17 | # Project configuration
|
18 |
| -SET(PROJECT_USE_CMAKE_EXPORT TRUE) |
19 |
| -SET(CUSTOM_HEADER_DIR ${PROJECT_NAME}) |
| 18 | +set(PROJECT_USE_CMAKE_EXPORT TRUE) |
| 19 | +set(CUSTOM_HEADER_DIR ${PROJECT_NAME}) |
20 | 20 | set(CXX_DISABLE_WERROR FALSE)
|
21 |
| -SET(DOXYGEN_USE_MATHJAX YES) |
22 |
| -SET(CATKIN_ENABLE_TESTING OFF) |
| 21 | +set(DOXYGEN_USE_MATHJAX YES) |
| 22 | +set(CATKIN_ENABLE_TESTING OFF) |
23 | 23 |
|
24 | 24 | # JRL-cmakemodule setup
|
25 |
| -INCLUDE(cmake/base.cmake) |
26 |
| -INCLUDE(cmake/boost.cmake) |
27 |
| -INCLUDE(cmake/python.cmake) |
28 |
| -INCLUDE(cmake/ros.cmake) |
| 25 | +include(cmake/base.cmake) |
| 26 | +include(cmake/boost.cmake) |
| 27 | +include(cmake/ros.cmake) |
29 | 28 |
|
30 | 29 | # Project definition
|
31 |
| -COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX) |
32 |
| -PROJECT(${PROJECT_NAME} ${PROJECT_ARGS}) |
| 30 | +compute_project_args(PROJECT_ARGS LANGUAGES CXX) |
| 31 | +project(${PROJECT_NAME} ${PROJECT_ARGS}) |
33 | 32 |
|
34 | 33 | # Project dependencies
|
35 |
| -SET(CATKIN_REQUIRED_COMPONENTS roscpp std_msgs message_generation std_srvs geometry_msgs sensor_msgs tf2_ros |
| 34 | +set(CATKIN_REQUIRED_COMPONENTS |
| 35 | + roscpp |
| 36 | + std_msgs |
| 37 | + message_generation |
| 38 | + std_srvs |
| 39 | + geometry_msgs |
| 40 | + sensor_msgs |
| 41 | + tf2_ros |
36 | 42 | realtime_tools)
|
37 |
| -ADD_PROJECT_DEPENDENCY(Boost REQUIRED COMPONENTS program_options) |
38 |
| -ADD_PROJECT_DEPENDENCY(dynamic_graph_bridge_msgs 0.3.0 REQUIRED) |
39 |
| - |
40 |
| -IF(BUILD_PYTHON_INTERFACE) |
41 |
| - FINDPYTHON() |
42 |
| - SEARCH_FOR_BOOST_PYTHON() |
43 |
| - STRING(REGEX REPLACE "-" "_" PY_NAME ${PROJECT_NAME}) |
44 |
| - ADD_PROJECT_DEPENDENCY(dynamic-graph-python 4.0.0 REQUIRED) |
45 |
| - SET(CATKIN_REQUIRED_COMPONENTS ${CATKIN_REQUIRED_COMPONENTS} rospy) |
46 |
| - |
47 |
| - IF(Boost_VERSION GREATER 107299 OR Boost_VERSION_MACRO GREATER 107299) |
48 |
| - # Silence a warning about a deprecated use of boost bind by boost >= 1.73 |
49 |
| - # without dropping support for boost < 1.73 |
50 |
| - ADD_DEFINITIONS(-DBOOST_BIND_GLOBAL_PLACEHOLDERS) |
51 |
| - ENDIF() |
52 |
| -ENDIF(BUILD_PYTHON_INTERFACE) |
53 | 43 |
|
54 |
| -find_package(catkin REQUIRED COMPONENTS ${CATKIN_REQUIRED_COMPONENTS}) |
| 44 | +if(BUILD_PYTHON_INTERFACE) |
| 45 | + add_project_dependency(dynamic-graph-python 4.0.0 REQUIRED) |
| 46 | + string(REGEX REPLACE "-" "_" PY_NAME ${PROJECT_NAME}) |
| 47 | + set(CATKIN_REQUIRED_COMPONENTS ${CATKIN_REQUIRED_COMPONENTS} rospy) |
| 48 | +endif(BUILD_PYTHON_INTERFACE) |
| 49 | + |
| 50 | +add_project_dependency(Boost REQUIRED COMPONENTS program_options) |
| 51 | +add_project_dependency(dynamic_graph_bridge_msgs 0.3.0 REQUIRED) |
| 52 | +add_project_dependency(sot-core REQUIRED) |
55 | 53 |
|
56 |
| -ADD_PROJECT_DEPENDENCY(sot-core REQUIRED) |
| 54 | +if(Boost_VERSION GREATER 107299 OR Boost_VERSION_MACRO GREATER 107299) |
| 55 | + # Silence a warning about a deprecated use of boost bind by boost >= 1.73 |
| 56 | + # without dropping support for boost < 1.73 |
| 57 | + add_definitions(-DBOOST_BIND_GLOBAL_PLACEHOLDERS) |
| 58 | +endif() |
| 59 | + |
| 60 | +find_package(catkin REQUIRED COMPONENTS ${CATKIN_REQUIRED_COMPONENTS}) |
57 | 61 |
|
58 | 62 | # Main Library
|
59 | 63 | set(${PROJECT_NAME}_HEADERS
|
60 |
| - include/${PROJECT_NAME}/fwd.hh |
61 |
| - include/${PROJECT_NAME}/ros_init.hh |
62 |
| - include/${PROJECT_NAME}/sot_loader.hh |
63 |
| - include/${PROJECT_NAME}/sot_loader_basic.hh |
64 |
| - include/${PROJECT_NAME}/ros_interpreter.hh |
65 |
| - src/converter.hh |
66 |
| - src/sot_to_ros.hh |
67 |
| - ) |
68 |
| - |
69 |
| -SET(${PROJECT_NAME}_SOURCES |
70 |
| - src/ros_init.cpp |
71 |
| - src/sot_to_ros.cpp |
72 |
| - src/ros_parameter.cpp |
73 |
| - ) |
74 |
| - |
75 |
| -ADD_LIBRARY(ros_bridge SHARED |
76 |
| - ${${PROJECT_NAME}_SOURCES} ${${PROJECT_NAME}_HEADERS}) |
77 |
| -TARGET_INCLUDE_DIRECTORIES(ros_bridge SYSTEM PUBLIC ${catkin_INCLUDE_DIRS}) |
78 |
| -TARGET_INCLUDE_DIRECTORIES(ros_bridge PUBLIC $<INSTALL_INTERFACE:include>) |
79 |
| -TARGET_LINK_LIBRARIES(ros_bridge ${catkin_LIBRARIES} |
80 |
| - sot-core::sot-core pinocchio::pinocchio dynamic_graph_bridge_msgs::dynamic_graph_bridge_msgs) |
81 |
| - |
82 |
| -IF(SUFFIX_SO_VERSION) |
83 |
| - SET_TARGET_PROPERTIES(ros_bridge PROPERTIES SOVERSION ${PROJECT_VERSION}) |
84 |
| -ENDIF(SUFFIX_SO_VERSION) |
85 |
| - |
86 |
| -IF(NOT INSTALL_PYTHON_INTERFACE_ONLY) |
87 |
| - INSTALL(TARGETS ros_bridge EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib) |
88 |
| -ENDIF(NOT INSTALL_PYTHON_INTERFACE_ONLY) |
| 64 | + include/${PROJECT_NAME}/fwd.hh |
| 65 | + include/${PROJECT_NAME}/ros_init.hh |
| 66 | + include/${PROJECT_NAME}/sot_loader.hh |
| 67 | + include/${PROJECT_NAME}/sot_loader_basic.hh |
| 68 | + include/${PROJECT_NAME}/ros_interpreter.hh |
| 69 | + src/converter.hh |
| 70 | + src/sot_to_ros.hh) |
| 71 | + |
| 72 | +set(${PROJECT_NAME}_SOURCES src/ros_init.cpp src/sot_to_ros.cpp |
| 73 | + src/ros_parameter.cpp) |
| 74 | + |
| 75 | +add_library(ros_bridge SHARED ${${PROJECT_NAME}_SOURCES} |
| 76 | + ${${PROJECT_NAME}_HEADERS}) |
| 77 | +target_include_directories(ros_bridge SYSTEM PUBLIC ${catkin_INCLUDE_DIRS}) |
| 78 | +target_include_directories(ros_bridge PUBLIC $<INSTALL_INTERFACE:include>) |
| 79 | +target_link_libraries(ros_bridge ${catkin_LIBRARIES} sot-core::sot-core |
| 80 | + pinocchio::pinocchio dynamic_graph_bridge_msgs::dynamic_graph_bridge_msgs) |
| 81 | + |
| 82 | +if(SUFFIX_SO_VERSION) |
| 83 | + set_target_properties(ros_bridge PROPERTIES SOVERSION ${PROJECT_VERSION}) |
| 84 | +endif(SUFFIX_SO_VERSION) |
| 85 | + |
| 86 | +if(NOT INSTALL_PYTHON_INTERFACE_ONLY) |
| 87 | + install( |
| 88 | + TARGETS ros_bridge |
| 89 | + EXPORT ${TARGETS_EXPORT_NAME} |
| 90 | + DESTINATION lib) |
| 91 | +endif(NOT INSTALL_PYTHON_INTERFACE_ONLY) |
89 | 92 |
|
90 | 93 | add_subdirectory(src)
|
91 | 94 | add_subdirectory(tests)
|
92 | 95 |
|
93 |
| -#install ros executables |
94 |
| -install(PROGRAMS |
95 |
| - scripts/robot_pose_publisher |
96 |
| - scripts/run_command |
97 |
| - scripts/tf_publisher |
98 |
| - DESTINATION share/${PROJECT_NAME} |
99 |
| - ) |
| 96 | +# install ros executables |
| 97 | +install(PROGRAMS scripts/robot_pose_publisher scripts/run_command |
| 98 | + scripts/tf_publisher DESTINATION share/${PROJECT_NAME}) |
100 | 99 |
|
101 | 100 | # Install package information
|
102 | 101 | install(FILES manifest.xml package.xml DESTINATION share/${PROJECT_NAME})
|
0 commit comments