diff --git a/scripts/build-verification.sh b/scripts/build-verification.sh index e99dc38..896c283 100755 --- a/scripts/build-verification.sh +++ b/scripts/build-verification.sh @@ -32,6 +32,7 @@ function install_prerequisites () { echo "[${FUNCNAME[0]}]: update and install dependent packages." apt update && apt upgrade -y apt install -y ros-${ROS_DISTRO}-desktop ros-${ROS_DISTRO}-rmw-cyclonedds-cpp --no-install-recommends + apt install -y libyaml-cpp-dev libboost-program-options-dev libboost-filesystem-dev cd $there } diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 85b8564..1dacc4a 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -1,35 +1,71 @@ cmake_minimum_required(VERSION 3.5) -project(parameter_server VERSION 1.0.0) +project(parameter_server VERSION 1.0.1) -# Default to C++14 +# Set Release build if no build type was specified +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Release" CACHE STRING + "Build type for the build. Possible values are: Debug, Release, RelWithDebInfo, MinSizeRel" + FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Release" "RelWithDebInfo" "MinSizeRel") +endif() + +# Default to C++17 if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 14) + set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD_REQUIRED ON) endif() +# Enable additional warnings and warnings as errors if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra -Wpedantic) endif() find_package(ament_cmake REQUIRED) + find_package(rclcpp REQUIRED) find_package(rclcpp_components REQUIRED) -find_package(rcutils) +find_package(rcutils REQUIRED) find_package(std_msgs REQUIRED) find_package(rmw REQUIRED) find_package(Boost REQUIRED COMPONENTS program_options filesystem) find_package(yaml_cpp_vendor REQUIRED) -include_directories(include) -include_directories(${Boost_INCLUDE_DIRS}) -include_directories(${yaml_cpp_vendor_INCLUDE_DIRS}) - add_executable(server src/parameter_server.cpp src/main.cpp ) -ament_target_dependencies(server rclcpp rclcpp_components std_msgs) -target_link_libraries(server ${Boost_LIBRARIES} ${yaml_cpp_vendor_LIBRARIES}) + +# yaml-cpp updates CMake thing significantly on v0.8.0 or later. +# so we ended up having the if statement to process differently instead of creating branches. +# see https://github.com/jbeder/yaml-cpp/releases/tag/0.8.0 +find_package(yaml-cpp 0.8.0 QUIET) +if (yaml-cpp_FOUND) + message(STATUS "yaml-cpp package is greater equal than version 0.8.0") + target_link_libraries(server + rclcpp::rclcpp + rcutils::rcutils + ${Boost_LIBRARIES} + yaml-cpp::yaml-cpp + ) +else() + message(STATUS "yaml-cpp package is less than version 0.8.0") + find_package(yaml-cpp REQUIRED) + target_link_libraries(server + rclcpp::rclcpp + rcutils::rcutils + ${Boost_LIBRARIES} + yaml-cpp + ) +endif() + +target_include_directories(server + PUBLIC + $ +) + +ament_target_dependencies(server rclcpp rclcpp_components std_msgs rcutils) install(TARGETS server DESTINATION lib/${PROJECT_NAME}) diff --git a/server/package.xml b/server/package.xml index d3b5710..c4719a9 100644 --- a/server/package.xml +++ b/server/package.xml @@ -2,7 +2,7 @@ parameter_server - 1.0.0 + 1.0.1 ros2 parameter server that other nodes can write/read parameters including persistent parameters. @@ -12,22 +12,15 @@ ament_cmake - rclcpp - rclcpp_components - rcutils - rmw - rmw_implementation_cmake - std_msgs - yaml_cpp_vendor + rclcpp + rclcpp_components + rcutils + rmw + rmw_implementation_cmake + std_msgs + yaml_cpp_vendor launch_ros - rclcpp yaml_cpp_vendor - - rclcpp_components - rcutils - rmw - std_msgs - yaml_cpp_vendor ament_cmake_pytest ament_lint_auto diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2e4bf5e..205e4b9 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,29 +1,50 @@ cmake_minimum_required(VERSION 3.5) -project(ros2_persistent_parameter_server_test) +project(ros2_persistent_parameter_server_test VERSION 1.0.1) + +# Set Release build if no build type was specified +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Release" CACHE STRING + "Build type for the build. Possible values are: Debug, Release, RelWithDebInfo, MinSizeRel" + FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Release" "RelWithDebInfo" "MinSizeRel") +endif() +# Default to C++17 if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 14) + set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD_REQUIRED ON) endif() +# Enable additional warnings and warnings as errors if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra -Wpedantic) endif() -# find dependencies find_package(ament_cmake REQUIRED) -find_package(rclcpp_components REQUIRED) + find_package(rclcpp REQUIRED) +find_package(rclcpp_components REQUIRED) find_package(rcutils REQUIRED) +find_package(std_msgs REQUIRED) find_package(rmw REQUIRED) -include_directories(include) - add_executable(client src/test.cpp src/persist_parameter_client.cpp ) -ament_target_dependencies(client rclcpp rclcpp_components) +target_link_libraries(client + rclcpp::rclcpp + rcutils::rcutils +) + +target_include_directories(client + PUBLIC + $ +) + +ament_target_dependencies(client rclcpp rclcpp_components std_msgs rcutils) install(TARGETS client DESTINATION lib/${PROJECT_NAME}) diff --git a/test/package.xml b/test/package.xml index e4b9b19..0abf09f 100644 --- a/test/package.xml +++ b/test/package.xml @@ -2,25 +2,24 @@ ros2_persistent_parameter_server_test - 1.0.0 - Client test demo for persistent parameter server - dbt + 1.0.1 + + Client test demo for persistent parameter server + + dbt Apache License 2.0 + Tomoya Fujita> ament_cmake - rclcpp - rclcpp_components - rcutils - rmw - rmw_implementation_cmake - std_msgs + + rclcpp + rclcpp_components + rcutils + rmw + rmw_implementation_cmake + std_msgs launch_ros - rclcpp - rclcpp_components - rcutils - rmw - std_msgs launch ament_lint_auto