Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions ethercat_driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,17 @@ add_library(
SHARED
src/ethercat_driver.cpp)

target_include_directories(
${PROJECT_NAME}
PRIVATE
include
target_include_directories(${PROJECT_NAME} PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/${PROJECT_NAME}>
)

ament_target_dependencies(
${PROJECT_NAME}
hardware_interface
pluginlib
rclcpp
rclcpp_lifecycle
ethercat_interface
target_link_libraries(${PROJECT_NAME} PUBLIC
hardware_interface::hardware_interface
pluginlib::pluginlib
rclcpp::rclcpp
rclcpp_lifecycle::rclcpp_lifecycle
ethercat_interface::ethercat_interface
)

# Causes the visibility macros to use dllexport rather than dllimport,
Expand Down
7 changes: 3 additions & 4 deletions ethercat_driver_ros2/sphinx/developer_guide/new_plugin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,9 @@ Modify your :code:`CMakeLists.txt` file so that it looks like this:
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
ament_target_dependencies(
${PROJECT_NAME}
"ethercat_interface"
"pluginlib"
target_link_libraries(${PROJECT_NAME} PUBLIC
ethercat_interface::ethercat_interface
pluginlib::pluginlib
)
pluginlib_export_plugin_description_file(ethercat_interface ethercat_plugins.xml)
install(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,11 @@ target_compile_features(${PROJECT_NAME} PUBLIC c_std_99 cxx_std_17) # Require C
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_link_libraries(${PROJECT_NAME} yaml-cpp)


ament_target_dependencies(
${PROJECT_NAME}
ethercat_interface
ethercat_generic_slave
pluginlib
yaml_cpp_vendor
target_link_libraries(${PROJECT_NAME} PUBLIC
ethercat_interface::ethercat_interface
ethercat_generic_slave::ethercat_generic_slave
pluginlib::pluginlib
yaml-cpp
)

Expand Down
16 changes: 7 additions & 9 deletions ethercat_generic_plugins/ethercat_generic_slave/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,9 @@ target_compile_features(${PROJECT_NAME} PUBLIC c_std_99 cxx_std_17) # Require C
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
ament_target_dependencies(
${PROJECT_NAME}
ethercat_interface
pluginlib
yaml_cpp_vendor
yaml-cpp
)
target_link_libraries(${PROJECT_NAME}
target_link_libraries(${PROJECT_NAME} PUBLIC
ethercat_interface::ethercat_interface
pluginlib::pluginlib
yaml-cpp
)

Expand Down Expand Up @@ -70,7 +65,10 @@ if(BUILD_TESTING)
test_generic_ec_slave
test/test_generic_ec_slave.cpp
)
target_include_directories(test_generic_ec_slave PRIVATE include)
target_include_directories(test_generic_ec_slave PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/${PROJECT_NAME}>
)
target_link_libraries(test_generic_ec_slave
${PROJECT_NAME}
)
Expand Down
36 changes: 13 additions & 23 deletions ethercat_interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,34 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

find_library(ETHERCAT_LIB ethercat HINTS ${ETHERLAB_DIR}/lib)

ament_export_include_directories(
include
${ETHERLAB_DIR}/include
)

add_library(
${PROJECT_NAME}
SHARED
src/ec_master.cpp)

target_include_directories(
${PROJECT_NAME}
PRIVATE
include
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/${PROJECT_NAME}>
${ETHERLAB_DIR}/include
)

target_link_libraries(${PROJECT_NAME} ${ETHERCAT_LIB})

ament_target_dependencies(
${PROJECT_NAME}
rclcpp
target_link_libraries(${PROJECT_NAME}
${ETHERCAT_LIB}
rclcpp::rclcpp
)

# INSTALL
install(
TARGETS ${PROJECT_NAME}
DESTINATION lib
EXPORT export_${PROJECT_NAME}
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
)

install(
DIRECTORY include/
DESTINATION include
DESTINATION include/${PROJECT_NAME}
)

if(BUILD_TESTING)
Expand All @@ -79,13 +75,7 @@ if(BUILD_TESTING)
endif()

## EXPORTS
ament_export_include_directories(
include
)
ament_export_libraries(
${PROJECT_NAME}
${ETHERCAT_LIBRARY}
)
ament_export_targets(export_${PROJECT_NAME} HAS_LIBRARY_TARGET)
ament_export_dependencies(
rclcpp
)
Expand Down
7 changes: 5 additions & 2 deletions ethercat_manager/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ target_include_directories(
include
${ETHERLAB_DIR}/include
)
target_link_libraries(ethercat_sdo_srv_server ${ETHERCAT_LIB})
ament_target_dependencies(ethercat_sdo_srv_server rclcpp ethercat_msgs)
target_link_libraries(ethercat_sdo_srv_server PUBLIC
${ETHERCAT_LIB}
rclcpp::rclcpp
${ethercat_msgs_TARGETS}
)

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
Expand Down