Skip to content

Commit

Permalink
Add exports to cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
rafal-gorecki committed Jan 13, 2025
1 parent 3d47255 commit 09199bc
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 56 deletions.
4 changes: 3 additions & 1 deletion husarion_ugv_battery/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10.2)
project(husarion_ugv_battery)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
add_compile_options(-Wall -Wextra -Wpedantic -Wshadow -Wold-style-cast)
endif()

set(PACKAGE_DEPENDENCIES
Expand Down Expand Up @@ -174,4 +174,6 @@ if(BUILD_TESTING)

endif()

ament_export_dependencies(${PACKAGE_DEPENDENCIES})

ament_package()
4 changes: 3 additions & 1 deletion husarion_ugv_diagnostics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ else()
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
add_compile_options(-Wall -Wextra -Wpedantic -Wshadow -Wold-style-cast)
endif()

set(PACKAGE_DEPENDENCIES
Expand Down Expand Up @@ -80,4 +80,6 @@ if(BUILD_TESTING)

endif()

ament_export_dependencies(${PACKAGE_DEPENDENCIES})

ament_package()
25 changes: 9 additions & 16 deletions husarion_ugv_gazebo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10.2)
project(husarion_ugv_gazebo)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
add_compile_options(-Wall -Wextra -Wpedantic -Wshadow -Wold-style-cast)
endif()

set(PACKAGE_DEPENDENCIES
Expand Down Expand Up @@ -60,22 +60,13 @@ target_link_libraries(LEDStrip ignition-gazebo6 ignition-msgs8 ignition-plugin1
ignition-transport11)

install(
TARGETS estop_system
TARGETS estop_system EStop LEDStrip
EXPORT export_${PROJECT_NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)

install(
TARGETS EStop
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)

install(
TARGETS LEDStrip
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(DIRECTORY include/ DESTINATION include/${PROJECT_NAME})

install(DIRECTORY config launch DESTINATION share/${PROJECT_NAME})

Expand All @@ -84,10 +75,12 @@ if(BUILD_TESTING)
ament_lint_auto_find_test_dependencies()
endif()

ament_export_include_directories(include)
ament_environment_hooks("${CMAKE_CURRENT_SOURCE_DIR}/hooks/setup_envs.sh.in")

ament_export_dependencies(${PACKAGE_DEPENDENCIES})
ament_export_include_directories(include/${PROJECT_NAME})
ament_export_targets(export_${PROJECT_NAME} HAS_LIBRARY_TARGET)

pluginlib_export_plugin_description_file(ign_ros2_control plugins.xml)

ament_environment_hooks("${CMAKE_CURRENT_SOURCE_DIR}/hooks/setup_envs.sh.in")

ament_package()
17 changes: 10 additions & 7 deletions husarion_ugv_hardware_interfaces/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ else()
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
add_compile_options(-Wall -Wextra -Wpedantic -Wshadow -Wold-style-cast)
endif()

set(PACKAGE_DEPENDENCIES
Expand Down Expand Up @@ -75,15 +75,15 @@ target_link_libraries(${PROJECT_NAME} PkgConfig::LIBLELY_COAPP
target_compile_definitions(
${PROJECT_NAME} PRIVATE "HUSARION_UGV_HARDWARE_INTERFACES_BUILDING_DLL")

pluginlib_export_plugin_description_file(hardware_interface
husarion_ugv_hardware_interfaces.xml)

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

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

install(DIRECTORY config DESTINATION share/${PROJECT_NAME})

if(BUILD_TESTING)
Expand Down Expand Up @@ -342,8 +342,11 @@ if(BUILD_TESTING)

endif()

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

pluginlib_export_plugin_description_file(hardware_interface
husarion_ugv_hardware_interfaces.xml)

ament_package()
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ void GPIODriver::ChangePinDirection(const GPIOPin pin, const gpiod::line::direct

auto line_config = gpiod::line_config();

for (const auto & gpio_info : gpio_info_storage_) {
gpiod::line_settings settings = GenerateLineSettings(gpio_info);
line_config.add_line_settings(gpio_info.offset, settings);
for (const auto & info : gpio_info_storage_) {
gpiod::line_settings settings = GenerateLineSettings(info);
line_config.add_line_settings(info.offset, settings);
}

line_request_->reconfigure_lines(line_config);
Expand Down
30 changes: 12 additions & 18 deletions husarion_ugv_lights/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10.2)
project(husarion_ugv_lights)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
add_compile_options(-Wall -Wextra -Wpedantic -Wshadow -Wold-style-cast)
endif()

set(PACKAGE_DEPENDENCIES
Expand All @@ -25,8 +25,6 @@ endforeach()

include_directories(include)

pluginlib_export_plugin_description_file(${PROJECT_NAME} plugins.xml)

add_library(animation_plugins SHARED src/animation/image_animation.cpp
src/animation/charging_animation.cpp)
ament_target_dependencies(animation_plugins husarion_ugv_utils pluginlib)
Expand Down Expand Up @@ -75,27 +73,20 @@ rclcpp_components_register_node(
lights_controller_node_component PLUGIN
"husarion_ugv_lights::LightsControllerNode" EXECUTABLE lights_controller_node)

ament_export_targets(export_lights_driver_node_component)
install(
TARGETS lights_driver_node_component lights_driver_parameters
EXPORT export_lights_driver_node_component
TARGETS animation_plugins lights_driver_node_component
lights_driver_parameters lights_controller_node_component
lights_controller_parameters
EXPORT export_${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)

ament_export_targets(export_lights_controller_node_component)
install(
TARGETS lights_controller_node_component lights_controller_parameters
EXPORT export_lights_controller_node_component
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)

install(TARGETS animation_plugins LIBRARY DESTINATION lib)

install(DIRECTORY animations config launch test
DESTINATION share/${PROJECT_NAME})

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

if(BUILD_TESTING)
find_package(ament_cmake_gtest REQUIRED)
find_package(ament_cmake_gmock REQUIRED)
Expand Down Expand Up @@ -242,7 +233,10 @@ if(BUILD_TESTING)

endif()

ament_export_include_directories(include)
ament_export_libraries(animation_plugins)
ament_export_dependencies(${PACKAGE_DEPENDENCIES})
ament_export_include_directories(include/${PROJECT_NAME})
ament_export_targets(export_${PROJECT_NAME} HAS_LIBRARY_TARGET)

pluginlib_export_plugin_description_file(${PROJECT_NAME} plugins.xml)

ament_package()
4 changes: 2 additions & 2 deletions husarion_ugv_lights/src/lights_driver_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ void LightsDriverNode::FrameCB(
} else if (msg->height != 1) {
message = "Incorrect image height " + std::to_string(msg->height);
} else if (
msg->width !=
(std::uint32_t)(panel_name == "channel_1" ? channel_1_num_led_ : channel_2_num_led_)) {
msg->width != static_cast<std::uint32_t>(
panel_name == "channel_1" ? channel_1_num_led_ : channel_2_num_led_)) {
message = "Incorrect image width " + std::to_string(msg->width);
}

Expand Down
9 changes: 6 additions & 3 deletions husarion_ugv_manager/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.8)
project(husarion_ugv_manager)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
add_compile_options(-Wall -Wextra -Wpedantic -Wshadow -Wold-style-cast)
endif()

set(PACKAGE_DEPENDENCIES
Expand Down Expand Up @@ -116,7 +116,8 @@ install(TARGETS safety_manager_node lights_manager_node
install(DIRECTORY behavior_trees config launch
DESTINATION share/${PROJECT_NAME})

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

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

if(BUILD_TESTING)
Expand Down Expand Up @@ -304,5 +305,7 @@ if(BUILD_TESTING)
safety_manager_parameters)
endif()

ament_export_include_directories(include)
ament_export_dependencies(${PACKAGE_DEPENDENCIES})
ament_export_include_directories(include/${PROJECT_NAME})

ament_package()
2 changes: 1 addition & 1 deletion husarion_ugv_msgs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10.2)
project(husarion_ugv_msgs)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
add_compile_options(-Wall -Wextra -Wpedantic -Wshadow -Wold-style-cast)
endif()

find_package(ament_cmake REQUIRED)
Expand Down
9 changes: 5 additions & 4 deletions husarion_ugv_utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10.2)
project(husarion_ugv_utils)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
add_compile_options(-Wall -Wextra -Wpedantic -Wshadow -Wold-style-cast)
endif()

set(PACKAGE_DEPENDENCIES
Expand All @@ -18,7 +18,7 @@ foreach(PACKAGE IN ITEMS ${PACKAGE_DEPENDENCIES})
find_package(${PACKAGE} REQUIRED)
endforeach()

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

if(BUILD_TESTING)
find_package(ament_cmake_gtest REQUIRED)
Expand Down Expand Up @@ -73,8 +73,9 @@ if(BUILD_TESTING)
target_link_libraries(${PROJECT_NAME}_test_yaml_utils yaml-cpp)
endif()

ament_export_include_directories(include)
ament_export_dependencies(realtime_tools)
ament_export_dependencies(${PACKAGE_DEPENDENCIES})
ament_export_include_directories(include/${PROJECT_NAME})

ament_python_install_package(${PROJECT_NAME})

ament_package()

0 comments on commit 09199bc

Please sign in to comment.