Skip to content

Commit

Permalink
refactor: Clean up CMake and package.xml files
Browse files Browse the repository at this point in the history
  • Loading branch information
2b-t committed Nov 2, 2024
1 parent 14a78a1 commit 6998235
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
28 changes: 11 additions & 17 deletions myactuator_rmd_hardware/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
endif()

find_package(ament_cmake REQUIRED)
find_package(ament_cmake_ros REQUIRED)
find_package(hardware_interface REQUIRED)
find_package(myactuator_rmd REQUIRED)
find_package(pluginlib REQUIRED)
Expand All @@ -16,28 +15,29 @@ find_package(rclcpp_lifecycle REQUIRED)
add_library(${PROJECT_NAME}
src/myactuator_rmd_hardware_interface.cpp
)
target_compile_features(${PROJECT_NAME} PUBLIC c_std_99 cxx_std_17)
target_compile_features(${PROJECT_NAME} PUBLIC
cxx_std_17
)
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
# Needed for std::atomic
target_compile_definitions(${PROJECT_NAME} PRIVATE
MYACTUATOR_RMD_HARDWARE_BUILDING_LIBRARY
)
# Required for std::atomic
target_link_libraries(${PROJECT_NAME} -latomic)
ament_target_dependencies(
myactuator_rmd_hardware
ament_target_dependencies(${PROJECT_NAME}
hardware_interface
myactuator_rmd
pluginlib
rclcpp
rclcpp_lifecycle
)

target_compile_definitions(${PROJECT_NAME} PRIVATE
MYACTUATOR_RMD_HARDWARE_BUILDING_LIBRARY
pluginlib_export_plugin_description_file(hardware_interface
myactuator_rmd_hardware.xml
)

pluginlib_export_plugin_description_file(hardware_interface myactuator_rmd_hardware.xml)

install(
DIRECTORY include/
DESTINATION include
Expand All @@ -50,14 +50,8 @@ install(
RUNTIME DESTINATION bin
)

ament_export_include_directories(
include
)
ament_export_libraries(
${PROJECT_NAME}
)
ament_export_targets(
export_${PROJECT_NAME}
HAS_LIBRARY_TARGET
)

ament_package()
2 changes: 1 addition & 1 deletion myactuator_rmd_hardware/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<maintainer email="tobit.flatscher@outlook.com">Tobit Flatscher</maintainer>
<license>MIT</license>

<buildtool_depend>ament_cmake_ros</buildtool_depend>
<buildtool_depend>ament_cmake</buildtool_depend>

<depend>hardware_interface</depend>
<depend>myactuator_rmd</depend>
Expand Down

0 comments on commit 6998235

Please sign in to comment.